mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
cleanups
git-svn-id: http://www.observium.org/svn/observer/trunk@912 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,68 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
$query = mysql_query("SELECT * FROM `hrDevice` where `device_id` = '".mres($device_id)."' AND hrDeviceType = 'hrDeviceProcessor'");
|
|
||||||
|
|
||||||
$i=0;
|
|
||||||
while($proc = mysql_fetch_array($query)) {
|
|
||||||
|
|
||||||
$rrd_filename = $config['rrd_dir'] . "/$hostname/" . safename("hrProcessor-" . $proc['hrDeviceIndex'] . ".rrd");
|
|
||||||
|
|
||||||
if(is_file($rrd_filename)) {
|
|
||||||
|
|
||||||
$descr = str_pad($proc['hrDeviceDescr'], 8);
|
|
||||||
$descr = substr($descr,0,8);
|
|
||||||
|
|
||||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
|
||||||
$rrd_list[$i]['descr'] = $descr;
|
|
||||||
$rrd_list[$i]['rra'] = "usage";
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$unit_text = "Load %";
|
|
||||||
|
|
||||||
$units='%';
|
|
||||||
$total_units='%';
|
|
||||||
$colours='mixed';
|
|
||||||
|
|
||||||
$scale_min = "0";
|
|
||||||
$scale_max = "100";
|
|
||||||
|
|
||||||
$nototal = 1;
|
|
||||||
|
|
||||||
include ("generic_multi_line.inc.php");
|
|
||||||
|
|
||||||
if ($not) {
|
|
||||||
|
|
||||||
include("common.inc.php");
|
|
||||||
$rrd_filename = $config['rrd_dir'] . "/" . $hostname . "/" . "ucd_cpu.rrd";
|
|
||||||
$rrd_options .= " DEF:user=$rrd_filename:user:AVERAGE";
|
|
||||||
$rrd_options .= " DEF:nice=$rrd_filename:nice:AVERAGE";
|
|
||||||
$rrd_options .= " DEF:system=$rrd_filename:system:AVERAGE";
|
|
||||||
$rrd_options .= " DEF:idle=$rrd_filename:idle:AVERAGE";
|
|
||||||
$rrd_options .= " CDEF:total=user,nice,system,idle,+,+,+";
|
|
||||||
$rrd_options .= " CDEF:user_perc=user,total,/,100,*";
|
|
||||||
$rrd_options .= " CDEF:nice_perc=nice,total,/,100,*";
|
|
||||||
$rrd_options .= " CDEF:system_perc=system,total,/,100,*";
|
|
||||||
$rrd_options .= " CDEF:idle_perc=idle,total,/,100,*";
|
|
||||||
$rrd_options .= " COMMENT:Usage\ \ \ \ \ \ \ Current\ \ \ \ \ Average\ \ \ \ Maximum\\\\n";
|
|
||||||
$rrd_options .= " AREA:user_perc#c02020:user";
|
|
||||||
$rrd_options .= " GPRINT:user_perc:LAST:\ \ \ \ \ %5.2lf%%";
|
|
||||||
$rrd_options .= " GPRINT:user_perc:AVERAGE:\ \ \ %5.2lf%%";
|
|
||||||
$rrd_options .= " GPRINT:user_perc:MAX:\ \ \ %5.2lf%%\\\\n";
|
|
||||||
$rrd_options .= " AREA:nice_perc#008f00:nice:STACK";
|
|
||||||
$rrd_options .= " GPRINT:nice_perc:LAST:\ \ \ \ \ %5.2lf%%";
|
|
||||||
$rrd_options .= " GPRINT:nice_perc:AVERAGE:\ \ \ %5.2lf%%";
|
|
||||||
$rrd_options .= " GPRINT:nice_perc:MAX:\ \ \ %5.2lf%%\\\\n";
|
|
||||||
$rrd_options .= " AREA:system_perc#ea8f00:system:STACK";
|
|
||||||
$rrd_options .= " GPRINT:system_perc:LAST:\ \ \ %5.2lf%%";
|
|
||||||
$rrd_options .= " GPRINT:system_perc:AVERAGE:\ \ \ %5.2lf%%";
|
|
||||||
$rrd_options .= " GPRINT:system_perc:MAX:\ \ \ %5.2lf%%\\\\n";
|
|
||||||
$rrd_options .= " AREA:idle_perc#f5f5e5:idle:STACK";
|
|
||||||
$rrd_options .= " GPRINT:idle_perc:LAST:\ \ \ \ \ %5.2lf%%";
|
|
||||||
$rrd_options .= " GPRINT:idle_perc:AVERAGE:\ \ \ %5.2lf%%";
|
|
||||||
$rrd_options .= " GPRINT:idle_perc:MAX:\ \ \ %5.2lf%%\\\\n";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if($device['os_group'] == "unix")
|
if($device['os_group'] == "unix" || $device['os'] == "windows")
|
||||||
{
|
{
|
||||||
echo("hrDevice ");
|
echo("hrDevice ");
|
||||||
$hrDevice_oids = array('hrDevice','hrProcessorLoad');
|
$hrDevice_oids = array('hrDevice','hrProcessorLoad');
|
||||||
|
|||||||
@@ -3,24 +3,25 @@
|
|||||||
## JUNOSe Processors
|
## JUNOSe Processors
|
||||||
if($device['os'] == "junos")
|
if($device['os'] == "junos")
|
||||||
{
|
{
|
||||||
echo("JUNOSe : ");
|
echo("JUNOS : ");
|
||||||
$processors_array = snmpwalk_cache_multi_oid($device, "jnxOperatingCPU", $processors_array, "JUNIPER-MIB" , "+".$config['install_dir']."/mibs/junos");
|
$processors_array = snmpwalk_cache_multi_oid($device, "jnxOperatingCPU", $processors_array, "JUNIPER-MIB" , "+".$config['install_dir']."/mibs/junos");
|
||||||
$processors_array = snmpwalk_cache_multi_oid($device, "jnxOperatingDRAMSize", $processors_array, "JUNIPER-MIB" , "+".$config['install_dir']."/mibs/junos");
|
$processors_array = snmpwalk_cache_multi_oid($device, "jnxOperatingDRAMSize", $processors_array, "JUNIPER-MIB" , "+".$config['install_dir']."/mibs/junos");
|
||||||
$processors_array = snmpwalk_cache_multi_oid($device, "jnxOperatingDescr", $processors_array, "JUNIPER-MIB" , "+".$config['install_dir']."/mibs/junos");
|
$processors_array = snmpwalk_cache_multi_oid($device, "jnxOperatingDescr", $processors_array, "JUNIPER-MIB" , "+".$config['install_dir']."/mibs/junos");
|
||||||
if($debug) { print_r($processors_array); }
|
if($debug) { print_r($processors_array); }
|
||||||
foreach($processors_array[$device['device_id']] as $index => $entry) {
|
|
||||||
|
|
||||||
if($entry['jnxOperatingDRAMSize'] && !strpos($entry['jnxOperatingDescr'], "sensor") && !strstr($entry['jnxOperatingDescr'], "fan")) {
|
if(is_array($processors_array[$device['device_id']])) {
|
||||||
echo($index . " " . $entry['jnxOperatingDescr'] . " -> " . $entry['jnxOperatingCPU'] . " -> " . $entry['jnxOperatingDRAMSize'] . "\n");
|
foreach($processors_array[$device['device_id']] as $index => $entry) {
|
||||||
|
if($entry['jnxOperatingDRAMSize'] && !strpos($entry['jnxOperatingDescr'], "sensor") && !strstr($entry['jnxOperatingDescr'], "fan")) {
|
||||||
$usage_oid = ".1.3.6.1.4.1.2636.3.1.13.1.8." . $index;
|
echo($index . " " . $entry['jnxOperatingDescr'] . " -> " . $entry['jnxOperatingCPU'] . " -> " . $entry['jnxOperatingDRAMSize'] . "\n");
|
||||||
$descr = $entry['jnxOperatingDescr'];
|
$usage_oid = ".1.3.6.1.4.1.2636.3.1.13.1.8." . $index;
|
||||||
$usage = $entry['jnxOperatingCPU'];
|
$descr = $entry['jnxOperatingDescr'];
|
||||||
if(!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" ) {
|
$usage = $entry['jnxOperatingCPU'];
|
||||||
discover_processor($valid_processor, $device, $usage_oid, $index, "junos", $descr, "1", $usage, NULL, NULL);
|
if(!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" ) {
|
||||||
}
|
discover_processor($valid_processor, $device, $usage_oid, $index, "junos", $descr, "1", $usage, NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
} ## End if checks
|
||||||
|
} ## End Foreach
|
||||||
|
} ## End if array
|
||||||
} ## End JUNOS Processors
|
} ## End JUNOS Processors
|
||||||
|
|
||||||
unset ($processors_array);
|
unset ($processors_array);
|
||||||
|
|||||||
Reference in New Issue
Block a user