Merge pull request #1300 from laf/issue-1293

Function and use to get main cisco serial number
This commit is contained in:
Neil Lathwood
2015-06-19 11:30:29 +01:00
4 changed files with 17 additions and 5 deletions
+13 -2
View File
@@ -1,4 +1,4 @@
<?php
<?php
function poll_sensor($device, $class, $unit)
{
@@ -370,4 +370,15 @@ function rrd_create_update($device, $name, $def, $val, $step = 300)
rrdtool_update($rrd, $val);
}
?>
function get_main_serial($device) {
if ($device['os_group'] == 'cisco') {
$serial_output = snmp_get_multi($device, "entPhysicalSerialNum.1 entPhysicalSerialNum.1001", "-OQUs", "ENTITY-MIB:OLD-CISCO-CHASSIS-MIB");
if (!empty($serial_output[1]['entPhysicalSerialNum'])) {
return $serial_output[1]['entPhysicalSerialNum'];
} elseif (!empty($serial_output[1001]['entPhysicalSerialNum'])) {
return $serial_output[1001]['entPhysicalSerialNum'];
}
}
}
+1 -1
View File
@@ -44,5 +44,5 @@ if ($data[1]['entPhysicalContainedIn'] == "0")
if(empty($hardware)) { $hardware = snmp_get($device, "sysObjectID.0", "-Osqv", "SNMPv2-MIB:CISCO-PRODUCTS-MIB"); }
#if(isset($cisco_hardware_oids[$poll_device['sysObjectID']])) { $hardware = $cisco_hardware_oids[$poll_device['sysObjectID']]; }
$serial = get_main_serial($device);
?>
+1 -1
View File
@@ -48,5 +48,5 @@ else
if(empty($hardware)) { $hardware = snmp_get($device, "sysObjectID.0", "-Osqv", "SNMPv2-MIB:CISCO-PRODUCTS-MIB"); }
#if(isset($cisco_hardware_oids[$poll_device['sysObjectID']])) { $hardware = $cisco_hardware_oids[$poll_device['sysObjectID']]; }
$serial = get_main_serial($device);
?>
+2 -1
View File
@@ -11,6 +11,7 @@ else
# It is not an IOS-XR ... What should we do ?
}
$serial = get_main_serial($device);
echo("\n".$poll_device['sysDescr']."\n");
?>