1<?php 2 3/** 4 * Observium 5 * 6 * This file is part of Observium. 7 * 8 * @package observium 9 * @subpackage poller 10 * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited 11 * 12 */ 13 14// FIXME - store state data in database 15 16$table_rows = array(); 17 18$diskio_data = dbFetchRows("SELECT * FROM `ucd_diskio` WHERE `device_id` = ?",array($device['device_id'])); 19 20if (count($diskio_data)) 21{ 22 $diskio_cache = array(); 23 $diskio_cache = snmpwalk_cache_oid($device, "diskIOEntry", $diskio_cache, "UCD-DISKIO-MIB"); 24 25 //echo("Checking UCD DiskIO MIB: "); 26 27 foreach ($diskio_data as $diskio) 28 { 29 $index = $diskio['diskio_index']; 30 31 $entry = $diskio_cache[$index]; 32 33 //echo($diskio['diskio_descr'] . " "); 34 35 if (OBS_DEBUG > 1) { print_vars($entry); } 36 37 $rrd = "ucd_diskio-" . $diskio['diskio_descr'] .".rrd"; 38 39 rrdtool_create($device, $rrd, " \ 40 DS:read:DERIVE:600:0:125000000000 \ 41 DS:written:DERIVE:600:0:125000000000 \ 42 DS:reads:DERIVE:600:0:125000000000 \ 43 DS:writes:DERIVE:600:0:125000000000 "); 44 45 rrdtool_update($device, $rrd, array($entry['diskIONReadX'], $entry['diskIONWrittenX'], $entry['diskIOReads'], $entry['diskIOWrites'])); 46 47 $table_row = array(); 48 $table_row[] = $diskio['diskio_descr']; 49 $table_row[] = $diskio['diskio_index']; 50 $table_row[] = $entry['diskIONReadX']; 51 $table_row[] = $entry['diskIONWrittenX']; 52 $table_row[] = $entry['diskIOReads']; 53 $table_row[] = $entry['diskIOWrites']; 54 $table_rows[] = $table_row; 55 unset($table_row); 56 57 } 58 59 //echo(PHP_EOL); 60} 61 62$headers = array('%WLabel%n', '%WIndex%n', '%WRead%n', '%WWritten%n', '%WReads%n', '%WWrites%n'); 63print_cli_table($table_rows, $headers); 64 65unset($diskio_data, $diskio_cache); 66 67// EOF 68