diff --git a/database-update.sql b/database-update.sql index 5e07cf8fe..fb404e9cd 100644 --- a/database-update.sql +++ b/database-update.sql @@ -106,3 +106,4 @@ ALTER TABLE `syslog` CHANGE `datetime` `datetime` TIMESTAMP NOT NULL DEFAULT CUR ALTER TABLE `syslog` DROP `host`, DROP `processed`; RENAME TABLE `interfaces` TO `ports` ; RENAME TABLE `interfaces_perms` TO `ports_perms` ; +ALTER TABLE `temperature` ADD `temp_index` VARCHAR( 32 ) NOT NULL AFTER `device_id` , ADD `temp_type` VARCHAR( 16 ) NOT NULL AFTER `temp_index`; diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index 3cf379181..d0ea23ae8 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -6,14 +6,13 @@ function print_percentage_bar ($width, $height, $percent, $left_text, $left_colo
| Drive | -Usage | -Used | -Total | +Drive | +Usage | Free | ||
|---|---|---|---|---|---|---|---|---|
| " . $drive['hrStorageDescr'] . " |
- | " . $perc . "% | " . $total . " | " . $free . " | " . $free . " | "); $graph_type = "hrstorage"; diff --git a/html/pages/device/storage.inc.php b/html/pages/device/storage.inc.php index 3b2b67598..888a1ad81 100644 --- a/html/pages/device/storage.inc.php +++ b/html/pages/device/storage.inc.php @@ -28,6 +28,12 @@ while($drive = mysql_fetch_array($query)) { $fs_url = "?page=device&id=".$device['device_id']."§ion=dev-storage"; + 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'; } + $fs_popup = "onmouseover=\"return overlib(' | ||
| " . $drive['hrStorageDescr'] . " |
- | " . $perc . "% | " . $total . " | " . $used . " | ||||
| Device | -Storage | -Usage | -- | Size | -Used | +Storage | +Usage | +Free |
| " . generatedevicelink($drive) . " | " . $drive['hrStorageDescr'] . " |
- | " . $perc . "% | " . $total . " | " . $used . " | " . formatStorage($free) . " | "); $row++; diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index 8dec6e5b8..35ae856fb 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -26,6 +26,27 @@ function discover_link($local_interface_id, $protocol, $remote_interface_id, $re } +function discover_processor(&$valid_processor, $device, $oid, $index, $type, $descr, $precision = "1", $current = NULL, $entPhysical = NULL, $hrDevice = NULL) { + + global $config; global $debug; global $valid_processor; + if($debug) { echo("$device, $oid, $index, $type, $descr, $precision, $current, $entPhysical, $hrDevice\n"); } + if($descr) { + if(mysql_result(mysql_query("SELECT count(processor_id) FROM `processors` WHERE `processor_index` = '$index' AND `device_id` = '".$device['device_id']."' AND `processor_type` = '$type'"),0) == '0') { + $query = "INSERT INTO processors (`entPhysicalIndex`, `device_id`, `processor_descr`, `processor_index`, `processor_oid`, `processor_usage`, `processor_type`) + values ('$entPhysicalIndex', '".$device['device_id']."', '$descr', '$index', '$usage_oid', '$usage', '$type')"; + mysql_query($query); + if($debug) { print $query . "\n"; } + echo("+"); + } else { + echo("."); + $query = "UPDATE `processors` SET `processor_descr` = '".$descr."', `processor_oid` = '".$usage_oid."', `processor_usage` = '".$usage."' + WHERE `device_id` = '".$device['device_id']."' AND `processor_index` = '".$index."' AND `processor_type` = '".$type."'"; + mysql_query($query); + if($debug) { print $query . "\n"; } + } + $valid_processor[$type][$index] = 1; + } +} function discover_fan($device, $oid, $index, $type, $descr, $precision = 1, $low_limit = NULL, $high_limit = NULL, $current = NULL) { diff --git a/includes/discovery/processors-ios.inc.php b/includes/discovery/processors-ios.inc.php index 329e47772..3254dd7f5 100755 --- a/includes/discovery/processors-ios.inc.php +++ b/includes/discovery/processors-ios.inc.php @@ -33,23 +33,16 @@ if(!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" ) { - if(mysql_result(mysql_query("SELECT count(processor_id) FROM `processors` WHERE `processor_index` = '$index' AND `device_id` = '".$device['device_id']."' AND `processor_type` = 'cpm'"),0) == '0') { - $query = "INSERT INTO processors (`entPhysicalIndex`, `device_id`, `processor_descr`, `processor_index`, `processor_oid`, `processor_usage`, `processor_type`) - values ('$entPhysicalIndex', '".$device['device_id']."', '$descr', '$index', '$usage_oid', '".$entry['juniSystemModuleCpuUtilPct']."', 'cpm')"; - mysql_query($query); - if($debug) { print $query . "\n"; } - echo("+"); - } else { - echo("."); - $query = "UPDATE `processors` SET `processor_descr` = '".$descr."', `processor_oid` = '".$usage_oid."', `processor_usage` = '".$usage."' - WHERE `device_id` = '".$device['device_id']."' AND `processor_index` = '".$index."' AND `processor_type` = 'cpm'"; - mysql_query($query); - if($debug) { print $query . "\n"; } - } - $valid_processor['cpm'][$index] = 1; + discover_processor($valid_processor, $device, $oid, $index, "cpm", $descr, "1", $entry['juniSystemModuleCpuUtilPct'], $entPhysicalIndex, NULL); } } } + if(!is_array($valid_processor['cpm'])) { + $avgBusy5 = snmp_get($device, ".1.3.6.1.4.1.9.2.1.58.0", "-Oqv"); + if(is_numeric($avgBusy5)) { + discover_processor($valid_processor, $device, ".1.3.6.1.4.1.9.2.1.58.0", "0", "ios", "Processor", $precision = "1", $current = $avgBusy5, $entPhysical = NULL, $hrDevice = NULL); + } + } } ## End Cisco Processors diff --git a/poll-device.php b/poll-device.php index c2e2e67ff..9aba77052 100755 --- a/poll-device.php +++ b/poll-device.php @@ -43,7 +43,7 @@ $polled_devices = 0; $device_query = mysql_query("SELECT * FROM `devices` WHERE `ignore` = '0' $where ORDER BY `device_id` ASC"); while ($device = mysql_fetch_array($device_query)) { $status = 0; unset($array); - + $device_start = utime(); // Start counting device poll time echo($device['hostname'] . " ".$device['device_id']." ".$device['os']." "); if ($os_groups[$device[os]]) {$device['os_group'] = $os_groups[$device[os]]; echo "(".$device['os_group'].")";} echo("\n"); @@ -203,6 +203,9 @@ while ($device = mysql_fetch_array($device_query)) { echo("No Changes to " . $device['hostname'] . "\n"); } + $device_end = utime(); $device_run = $device_end - $device_start; $device_time = substr($device_run, 0, 5); + echo("Polled in $device_time seconds\n"); + } $poller_end = utime(); $poller_run = $poller_end - $poller_start; $poller_time = substr($poller_run, 0, 5);