Skip to content

Commit

Permalink
Merge pull request #1300 from laf/issue-1293
Browse files Browse the repository at this point in the history
Function and use to get main cisco serial number
  • Loading branch information
laf committed Jun 19, 2015
2 parents a154e3d + d098431 commit dd2c36c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
15 changes: 13 additions & 2 deletions includes/polling/functions.inc.php
@@ -1,4 +1,4 @@
<?php
<?php

function poll_sensor($device, $class, $unit)
{
Expand Down Expand Up @@ -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'];
}
}

}
2 changes: 1 addition & 1 deletion includes/polling/os/cisco.inc.php
Expand Up @@ -44,5 +44,5 @@
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 changes: 1 addition & 1 deletion includes/polling/os/ios.inc.php
Expand Up @@ -48,5 +48,5 @@
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);

?>
3 changes: 2 additions & 1 deletion includes/polling/os/iosxr.inc.php
Expand Up @@ -11,6 +11,7 @@
# It is not an IOS-XR ... What should we do ?
}

$serial = get_main_serial($device);

echo("\n".$poll_device['sysDescr']."\n");

?>

0 comments on commit dd2c36c

Please sign in to comment.