diff --git a/discovery.php b/discovery.php index cd3ecb9c6..43f9a63c3 100755 --- a/discovery.php +++ b/discovery.php @@ -7,6 +7,7 @@ include("includes/functions.php"); include("includes/discovery/functions.inc.php"); $start = utime(); +$runtime_stats = array(); ### Observer Device Discovery @@ -122,6 +123,7 @@ while ($device = mysql_fetch_array($device_query)) include("includes/discovery/cisco-vrf.inc.php"); include("includes/discovery/toner.inc.php"); include("includes/discovery/ups.inc.php"); + include("includes/discovery/ucd-diskio.inc.php"); if ($device['type'] == "unknown") { diff --git a/html/images/icons/diskio.png b/html/images/icons/diskio.png new file mode 100644 index 000000000..dfa0c3f34 Binary files /dev/null and b/html/images/icons/diskio.png differ diff --git a/html/images/icons/greyscale/diskio.png b/html/images/icons/greyscale/diskio.png new file mode 100644 index 000000000..7262022dd Binary files /dev/null and b/html/images/icons/greyscale/diskio.png differ diff --git a/html/images/icons/greyscale/storage.png b/html/images/icons/greyscale/storage.png index 6c0f1b978..4e82a8ce6 100644 Binary files a/html/images/icons/greyscale/storage.png and b/html/images/icons/greyscale/storage.png differ diff --git a/html/images/icons/storage.png b/html/images/icons/storage.png index 5dd9b8bea..1c48c415d 100755 Binary files a/html/images/icons/storage.png and b/html/images/icons/storage.png differ diff --git a/html/includes/graphs/generic_duplex.inc.php b/html/includes/graphs/generic_duplex.inc.php index 5d92a7d0d..f7ccab7ae 100644 --- a/html/includes/graphs/generic_duplex.inc.php +++ b/html/includes/graphs/generic_duplex.inc.php @@ -5,7 +5,6 @@ include("common.inc.php"); - $unit_text = str_pad(truncate($unit_text,10),10); $rrd_options .= " DEF:".$out."=".$rrd_filename.":".$rra_out.":AVERAGE"; diff --git a/html/pages/device/health.inc.php b/html/pages/device/health.inc.php index 034afbef5..267643b7f 100644 --- a/html/pages/device/health.inc.php +++ b/html/pages/device/health.inc.php @@ -2,6 +2,7 @@ $temperatures = mysql_result(mysql_query("select count(*) from temperature WHERE device_id = '" . $device['device_id'] . "'"), 0); $storage = mysql_result(mysql_query("select count(*) from storage WHERE device_id = '" . $device['device_id'] . "'"), 0); +$diskio = mysql_result(mysql_query("select count(*) from ucd_diskio WHERE device_id = '" . $device['device_id'] . "'"), 0); $memory = mysql_result(mysql_query("select count(*) from mempools WHERE device_id = '" . $device['device_id'] . "'"), 0); $processor = mysql_result(mysql_query("select count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"), 0); $fans = mysql_result(mysql_query("select count(*) from fanspeed WHERE device_id = '" . $device['device_id'] . "'"), 0); @@ -13,6 +14,7 @@ $datas[] = 'overview'; if ($processor) { $datas[] = 'processors'; } if ($memory) { $datas[] = 'memory'; } if ($storage) { $datas[] = 'storage'; } +if ($diskio) { $datas[] = 'diskio'; } if ($temperatures) { $datas[] = 'temperatures'; } if ($fans) { $datas[] = 'fanspeeds'; } if ($volts) { $datas[] = 'voltages'; } @@ -24,6 +26,7 @@ $type_text['overview'] = "Overview"; $type_text['temperatures'] = "Temperatures"; $type_text['memory'] = "Memory Pools"; $type_text['storage'] = "Disk Usage"; +$type_text['diskio'] = "Disk IO"; $type_text['processors'] = "Processor Usage"; $type_text['voltages'] = "Voltages"; $type_text['fanspeeds'] = "Fan Speeds"; diff --git a/html/pages/device/health/diskio.inc.php b/html/pages/device/health/diskio.inc.php new file mode 100644 index 000000000..f9d870fe4 --- /dev/null +++ b/html/pages/device/health/diskio.inc.php @@ -0,0 +1,73 @@ +"); + +#echo(" +# Drive +# Usage +# Free +# +# "); + +$row = 1; + +while($drive = mysql_fetch_array($query)) { + + if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + +# $total = $drive['storage_size']; +# $used = $drive['storage_used']; +# $free = $drive['storage_free']; +# $perc = round($drive['storage_perc'], 0); +# $used = formatStorage($used); +# $total = formatStorage($total); +# $free = formatStorage($free); + + $fs_url = "/device/".$device['device_id']."/health/diskio/"; + + $fs_popup = "onmouseover=\"return overlib('
".$device['hostname']." - ".$drive['diskio_descr']; + $fs_popup .= "
"; + $fs_popup .= "', RIGHT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\""; + + if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; + } elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; + } elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; + } elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; + } else { $left_background='9abf5b'; $right_background='bbd392'; } + + echo("" . $drive['diskio_descr'] . ""); + + $types = array("diskio_bits", "diskio_ops"); + + foreach($types as $graph_type) { + + echo(''); + + $graph_array['height'] = "100"; + $graph_array['width'] = "215"; + $graph_array['to'] = $now; + $graph_array['id'] = $drive['diskio_id']; + $graph_array['type'] = $graph_type; + + $periods = array('day', 'week', 'month', 'year'); + + foreach($periods as $period) { + $graph_array['from'] = $$period; + $graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; + echo(overlib_link($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL)); + } + + echo(''); + + } + + $row++; + +} + + echo(""); + +?> diff --git a/includes/discovery/ucd-diskio.inc.php b/includes/discovery/ucd-diskio.inc.php new file mode 100644 index 000000000..1abadc521 --- /dev/null +++ b/includes/discovery/ucd-diskio.inc.php @@ -0,0 +1,52 @@ + $entry) { + + if($entry['diskIONRead'] > "0" || $entry['diskIONWritten'] > "0") { + echo("$index ".$entry['diskIODevice']."\n"); + + if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ucd_diskio` WHERE `device_id` = '".$device['device_id']."' AND `diskio_index` = '".$index."'"),0) == "0") + { + $sql = "INSERT INTO `ucd_diskio` (`device_id`,`diskio_index`,`diskio_descr`) VALUES ('".$device['device_id']."','".$index."','".$entry['diskIODevice']."')"; + mysql_query($sql); echo("+"); + if($debug) { echo($sql . " - " . mysql_affected_rows() . "inserted "); } + } + else + { + echo("."); + ## Need update code here! + } + + $valid_diskio[$index] = 1; + + } ## end validity check + } ## end array foreach + } ## End array if + + +### Remove diskio entries which weren't redetected here + + $sql = "SELECT * FROM `ucd_diskio` where `device_id` = '".$device['device_id']."'"; + $query = mysql_query($sql); + + if($debug) { print_r ($valid_vp); } + + while ($test = mysql_fetch_array($query)) { + if($debug) { echo($test['diskio_index'] . " -> " . $test['diskio_descr'] . "\n"); } + if(!$valid_diskio[$test['diskio_index']]) { + echo("-"); + mysql_query("DELETE FROM `ucd_diskio` WHERE `diskio_id` = '" . $test['diskio_id'] . "'"); + } + } + + unset($valid_diskio); + echo("\n"); + + +?> diff --git a/includes/polling/ucd-diskio.inc.php b/includes/polling/ucd-diskio.inc.php new file mode 100644 index 000000000..32b2be4d5 --- /dev/null +++ b/includes/polling/ucd-diskio.inc.php @@ -0,0 +1,65 @@ + diff --git a/poll-device.php b/poll-device.php index e36ce2694..f5908ed1e 100755 --- a/poll-device.php +++ b/poll-device.php @@ -179,6 +179,7 @@ while ($device = mysql_fetch_array($device_query)) { include("includes/polling/cisco-mac-accounting.inc.php"); include("includes/polling/bgpPeer.inc.php"); include("includes/polling/toner.inc.php"); + include("includes/polling/ucd-diskio.inc.php"); unset( $update ) ; unset( $seperator) ;