mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix some rrdtool_graph calls to use arrays. add NRG printer support.
git-svn-id: http://www.observium.org/svn/observer/trunk@3187 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
BIN
html/images/os/nrg.png
Normal file
BIN
html/images/os/nrg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
@@ -758,6 +758,14 @@ $config['os'][$os]['icon'] = "ricoh";
|
||||
$config['os'][$os]['over'][0]['graph'] = "device_toner";
|
||||
$config['os'][$os]['over'][0]['text'] = "Toner";
|
||||
|
||||
$os = "nrg";
|
||||
$config['os'][$os]['group'] = "printer";
|
||||
$config['os'][$os]['text'] = "NRG Printer";
|
||||
$config['os'][$os]['type'] = "printer";
|
||||
$config['os'][$os]['icon'] = "nrg";
|
||||
$config['os'][$os]['over'][0]['graph'] = "device_toner";
|
||||
$config['os'][$os]['over'][0]['text'] = "Toner";
|
||||
|
||||
$os = "epson";
|
||||
$config['os'][$os]['group'] = "printer";
|
||||
$config['os'][$os]['text'] = "Epson Printer";
|
||||
|
||||
8
includes/discovery/os/nrg.inc.php
Normal file
8
includes/discovery/os/nrg.inc.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
if (!$os)
|
||||
{
|
||||
if (strstr($sysDescr, "NRG Network Printer")) { $os = "nrg"; }
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -74,8 +74,10 @@ if ($device['os_group'] == "cisco")
|
||||
DS:PIN:COUNTER:600:0:12500000000 \
|
||||
DS:POUT:COUNTER:600:0:12500000000 " . $config['rrd_rra']);
|
||||
}
|
||||
$woo = "N:".($b_in+0).":".($b_out+0).":".($p_in+0).":".($p_out+0);
|
||||
$ret = rrdtool_update("$rrdfile", $woo);
|
||||
|
||||
// FIXME - use memcached to make sure these values don't go backwards?
|
||||
$rrdupdate = array($b_in, $b_out, $p_in, $p_out);
|
||||
$ret = rrdtool_update("$rrdfile", $rrdupdate);
|
||||
|
||||
if ($acc['update'])
|
||||
{ /// Do Updates
|
||||
|
||||
17
includes/polling/os/nrg.inc.php
Normal file
17
includes/polling/os/nrg.inc.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
# SNMPv2-MIB::sysDescr.0 = STRING: NRG MP C4500 1.60 / NRG Network Printer C model / NRG Network Scanner C model / NRG Network Facsimile C model
|
||||
# SNMPv2-MIB::sysDescr.0 = STRING: NRG SP C410DN 1.01 / NRG Network Printer C model
|
||||
# SNMPv2-MIB::sysDescr.0 = STRING: NRG MP 171 1.01 / NRG Network Printer C model / NRG Network Scanner C model / NRG Network Facsimile C model
|
||||
|
||||
$descr = trim(snmp_get($device, ".1.3.6.1.2.1.1.1.0", "-OQv", "", ""),'" ');
|
||||
|
||||
$ninfo=trim(substr($descr,0,strpos($descr,'/')));
|
||||
|
||||
$hardware=trim(substr($ninfo,0,strrpos($ninfo,' ')));
|
||||
$version=trim(substr($ninfo,strrpos($ninfo,' ')));
|
||||
|
||||
# SNMPv2-SMI::enterprises.367.3.2.1.2.1.4.0 = STRING: "M6394300657"
|
||||
# $serial = trim(snmp_get($device, "1.3.6.1.4.1.367.3.2.1.2.1.4.0", "-OQv", "", ""),'" ');
|
||||
|
||||
?>
|
||||
@@ -52,7 +52,7 @@ if (is_numeric($ss['ssCpuRawUser']) && is_numeric($ss['ssCpuRawNice']) && is_num
|
||||
{
|
||||
rrdtool_create($cpu_rrd, $cpu_rrd_create);
|
||||
}
|
||||
rrdtool_update($cpu_rrd, "N:".$ss['ssCpuRawUser'].":".$ss['ssCpuRawSystem'].":".$ss['ssCpuRawNice'].":".$ss['ssCpuRawIdle']);
|
||||
rrdtool_update($cpu_rrd, array($ss['ssCpuRawUser'],$ss['ssCpuRawSystem'],$ss['ssCpuRawNice'],$ss['ssCpuRawIdle']));
|
||||
$graphs['ucd_cpu'] = TRUE;
|
||||
}
|
||||
|
||||
@@ -115,6 +115,8 @@ if (is_array($snmpdata[0]))
|
||||
foreach (array_keys($snmpdata[0]) as $key) { $$key = $snmpdata[0][$key]; }
|
||||
}
|
||||
|
||||
$snmpdata = $snmpdata[0];
|
||||
|
||||
## Check to see that the OIDs are actually populated before we make the rrd
|
||||
if (is_numeric($memTotalReal) && is_numeric($memAvailReal) && is_numeric($memTotalFree))
|
||||
{
|
||||
@@ -123,7 +125,7 @@ if (is_numeric($memTotalReal) && is_numeric($memAvailReal) && is_numeric($memTot
|
||||
## Create the rrd file if it doesn't exist
|
||||
rrdtool_create($mem_rrd, $mem_rrd_create);
|
||||
}
|
||||
rrdtool_update($mem_rrd, "N:$memTotalSwap:$memAvailSwap:$memTotalReal:$memAvailReal:$memTotalFree:".($memShared+0).":".($memBuffer+0).":".($memCached+0));
|
||||
rrdtool_update($mem_rrd, array($memTotalSwap, $memAvailSwap, $memTotalReal, $memAvailReal, $memTotalFree, $memShared, $memBuffer, $memCached));
|
||||
$graphs['ucd_memory'] = TRUE;
|
||||
}
|
||||
|
||||
@@ -134,26 +136,20 @@ if (is_numeric($memTotalReal) && is_numeric($memAvailReal) && is_numeric($memTot
|
||||
#UCD-SNMP-MIB::laLoadInt.2 = INTEGER: 429
|
||||
#UCD-SNMP-MIB::laLoadInt.3 = INTEGER: 479
|
||||
|
||||
$la_load_create = " --step 300 DS:1min:GAUGE:600:0:5000 DS:5min:GAUGE:600:0:5000 DS:15min:GAUGE:600:0:5000 ".$config['rrd_rra'];
|
||||
$load_raw = snmp_get_multi($device, "laLoadInt.1 laLoadInt.2 laLoadInt.3", "-OQUs", "UCD-SNMP-MIB");
|
||||
|
||||
$load_get = "laLoadInt.1 laLoadInt.2 laLoadInt.3";
|
||||
$load_raw = snmp_get_multi($device, $load_get, "-OQUs", "UCD-SNMP-MIB");
|
||||
$load1 = $load_raw[1]['laLoadInt'];
|
||||
$load5 = $load_raw[2]['laLoadInt'];
|
||||
$load10 = $load_raw[3]['laLoadInt'];
|
||||
|
||||
## Check to see that the OIDs are actually populated before we make the rrd
|
||||
if (is_numeric($load1) && is_numeric($load5) && is_numeric($load10))
|
||||
## Check to see that the 5-min OID is actually populated before we make the rrd
|
||||
if (is_numeric($load_raw[2]['laLoadInt']))
|
||||
{
|
||||
if (!is_file($load_rrd))
|
||||
{
|
||||
rrdtool_create($load_rrd, $la_load_create);
|
||||
rrdtool_create($load_rrd, " --step 300 DS:1min:GAUGE:600:0:5000 DS:5min:GAUGE:600:0:5000 DS:15min:GAUGE:600:0:5000 ".$config['rrd_rra']);
|
||||
}
|
||||
rrdtool_update($load_rrd, "N:$load1:$load5:$load10");
|
||||
rrdtool_update($load_rrd, array($load_raw[1]['laLoadInt'], $load_raw[2]['laLoadInt'], $load_raw[3]['laLoadInt']));
|
||||
$graphs['ucd_load'] = "TRUE";
|
||||
}
|
||||
|
||||
unset($ss, $load1, $load5, $load10, $load_rrd, $la_load_create, $load_raw, $load_get, $snmpdata);
|
||||
unset($ss, $load_rrd, $load_raw, $snmpdata);
|
||||
unset($memTotalSwap, $memAvailSwap, $memTotalReal, $memAvailReal, $memTotalFree, $memShared, $memBuffer, $memCached);
|
||||
unset($key, $mem_rrd, $mem_rrd_create, $collect_oids, $value, $filename, $cpu_rrd, $cpu_rrd_create, $oid);
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ if ($device['type'] == 'network' || $device['type'] == 'firewall')
|
||||
DS:wificlients:GAUGE:600:-273:1000 ".$config['rrd_rra']);
|
||||
}
|
||||
|
||||
rrdtool_update($wificlientsrrd,"N:".$wificlients1);
|
||||
rrdtool_update($wificlientsrrd,array($wificlients1));
|
||||
|
||||
$graphs['wifi_clients'] = TRUE;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ if ($device['type'] == 'network' || $device['type'] == 'firewall')
|
||||
DS:wificlients:GAUGE:600:-273:1000 ".$config['rrd_rra']);
|
||||
}
|
||||
|
||||
rrdtool_update($wificlientsrrd,"N:".$wificlients2);
|
||||
rrdtool_update($wificlientsrrd,array($wificlients2));
|
||||
|
||||
$graphs['wifi_clients'] = TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user