fix ios version detection

git-svn-id: http://www.observium.org/svn/observer/trunk@2917 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2012-03-20 23:56:40 +00:00
parent 28242d130b
commit 7bfc8babbf
3 changed files with 24 additions and 21 deletions

View File

@@ -2,7 +2,6 @@
if (is_file($config['install_dir'] . "/includes/polling/os/".$device['os'].".inc.php"))
{
echo "os = /includes/polling/os/".$device['os'].".inc.php\n";
/// OS Specific
include($config['install_dir'] . "/includes/polling/os/".$device['os'].".inc.php");
}

View File

@@ -2,7 +2,6 @@
if (preg_match('/^Cisco IOS Software, .+? Software \([^\-]+-([\w\d]+)-\w\), Version ([^,]+)/', $poll_device['sysDescr'], $regexp_result))
{
$features = $regexp_result[1];
$version = $regexp_result[2];
}

View File

@@ -3,34 +3,39 @@
# 7200 and IOS-XE (ASR1k)
if (preg_match('/^Cisco IOS Software, .+? Software \([^\-]+-([^\-]+)-\w\),.+?Version ([^, ]+)/', $poll_device['sysDescr'], $regexp_result))
{
$features = $regexp_result[1];
$version = $regexp_result[2];
$features = $regexp_result[1];
$version = $regexp_result[2];
}
# 7600
elseif (preg_match('/Cisco Internetwork Operating System Software\s+IOS \(tm\) [^ ]+ Software \([^\-]+-([^\-]+)-\w\),.+?Version ([^, ]+)/', $poll_device['sysDescr'], $regexp_result))
{
$features = $regexp_result[1];
$version = $regexp_result[2];
$features = $regexp_result[1];
$version = $regexp_result[2];
}
$oids = "entPhysicalModelName.1 entPhysicalContainedIn.1 entPhysicalName.1 entPhysicalSoftwareRev.1 entPhysicalModelName.1001 entPhysicalContainedIn.1001 cardDescr.1 cardSlotNumber.1";
$data = snmp_get_multi($device, $oids, "-OQUs", "ENTITY-MIB:OLD-CISCO-CHASSIS-MIB");
if ($data[1]['entPhysicalContainedIn'] == "0")
# If we have not managed to match any IOS string yet (and that would be surprising)
# we can try to poll the Entity Mib to see what's inside
else
{
if (!empty($data[1]['entPhysicalSoftwareRev']))
$oids = "entPhysicalModelName.1 entPhysicalContainedIn.1 entPhysicalName.1 entPhysicalSoftwareRev.1 entPhysicalModelName.1001 entPhysicalContainedIn.1001 cardDescr.1 cardSlotNumber.1";
$data = snmp_get_multi($device, $oids, "-OQUs", "ENTITY-MIB:OLD-CISCO-CHASSIS-MIB");
if ($data[1]['entPhysicalContainedIn'] == "0")
{
$version = $data[1]['entPhysicalSoftwareRev'];
}
if (!empty($data[1]['entPhysicalName']))
{
$hardware = $data[1]['entPhysicalName'];
}
if (!empty($data[1]['entPhysicalModelName']))
{
$hardware = $data[1]['entPhysicalModelName'];
if (!empty($data[1]['entPhysicalSoftwareRev']))
{
$version = $data[1]['entPhysicalSoftwareRev'];
}
if (!empty($data[1]['entPhysicalName']))
{
$hardware = $data[1]['entPhysicalName'];
}
if (!empty($data[1]['entPhysicalModelName']))
{
$hardware = $data[1]['entPhysicalModelName'];
}
}
}