From 00121fd3f84e084111a1c015440c63bc644e4b6e Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Tue, 3 May 2011 21:46:25 +0000 Subject: [PATCH] fixes to new poller git-svn-id: http://www.observium.org/svn/observer/trunk@2233 61d68cd4-352d-0410-923a-c4978735b2b8 --- includes/discovery/ports-stack.inc.php | 2 + includes/polling/os.inc.php | 25 ++++++++++ includes/polling/os/allied.inc.php | 2 +- includes/polling/os/aos.inc.php | 2 +- includes/polling/os/arista_eos.inc.php | 2 +- includes/polling/os/bnt.inc.php | 2 +- includes/polling/os/cat1900.inc.php | 2 +- includes/polling/os/catos.inc.php | 6 +-- includes/polling/os/dell-laser.inc.php | 2 +- includes/polling/os/extremeware.inc.php | 6 +-- includes/polling/os/ies.inc.php | 2 +- includes/polling/os/ios.inc.php | 11 +++-- includes/polling/os/junos.inc.php | 2 +- includes/polling/os/junose.inc.php | 2 +- includes/polling/os/powerconnect.inc.php | 2 +- includes/polling/os/procurve.inc.php | 2 +- includes/polling/os/radlan.inc.php | 4 +- includes/polling/os/screenos.inc.php | 2 +- includes/polling/os/snom.inc.php | 8 ++-- includes/polling/os/speedtouch.inc.php | 2 +- includes/polling/os/tranzeo.inc.php | 2 +- includes/polling/os/unix.inc.php | 36 +++++++------- includes/polling/os/vrp.inc.php | 2 +- includes/polling/os/windows.inc.php | 60 ++++++++++++------------ includes/polling/os/zywall.inc.php | 2 +- includes/polling/os/zyxelnwa.inc.php | 2 +- includes/polling/system.inc.php | 54 ++++++--------------- includes/static-config.php | 4 +- 28 files changed, 126 insertions(+), 124 deletions(-) diff --git a/includes/discovery/ports-stack.inc.php b/includes/discovery/ports-stack.inc.php index 5b57f7761..9d239f9b8 100644 --- a/includes/discovery/ports-stack.inc.php +++ b/includes/discovery/ports-stack.inc.php @@ -35,4 +35,6 @@ foreach($stack_poll_array as $interface_id_high => $entry_high) } } +echo("\n"); + ?> diff --git a/includes/polling/os.inc.php b/includes/polling/os.inc.php index d7546e0f2..0d85474f6 100644 --- a/includes/polling/os.inc.php +++ b/includes/polling/os.inc.php @@ -15,5 +15,30 @@ echo("Generic :(\n"); } + if ($version && $device['version'] != $version) + { + $device['db_update'] .= ", `version` = '".mres($version)."'"; + log_event("OS Version -> ".$version, $device, 'system'); + } + + if ($features != $device['features']) + { + $device['db_update'] .= ", `features` = '".mres($features)."'"; + log_event("OS Features -> ".$features, $device, 'system'); + } + + if ($hardware && $hardware != $device['hardware']) + { + $device['db_update'] .= ", `hardware` = '".mres($hardware)."'"; + log_event("Hardware -> ".$hardware, $device, 'system'); + } + + if ($serial && $serial != $device['serial']) + { + $device['db_update'] .= ", `serial` = '".mres($serial)."'"; + log_event("serial -> ".$serial, $device, 'system'); + } + + echo("Hardware: ".$hardware." Version: ".$version." Features: ".$features."\n"); ?> diff --git a/includes/polling/os/allied.inc.php b/includes/polling/os/allied.inc.php index c12f2b240..b62b79a9e 100644 --- a/includes/polling/os/allied.inc.php +++ b/includes/polling/os/allied.inc.php @@ -28,7 +28,7 @@ if (!$hardware && !$version && !$features) #Allied Telesyn AT-8948 version 2.7.4-02 22-Aug-2005 -list($a,$b,$c,$d,$e,$f) = explode(" ", $sysDescr); +list($a,$b,$c,$d,$e,$f) = explode(" ", $poll_device[sysDescr]); if (!$hardware && !$version && !$features) { diff --git a/includes/polling/os/aos.inc.php b/includes/polling/os/aos.inc.php index 2af525b0e..16ec03c10 100755 --- a/includes/polling/os/aos.inc.php +++ b/includes/polling/os/aos.inc.php @@ -1,5 +1,5 @@ diff --git a/includes/polling/os/arista_eos.inc.php b/includes/polling/os/arista_eos.inc.php index d0ff19c36..26cefa536 100755 --- a/includes/polling/os/arista_eos.inc.php +++ b/includes/polling/os/arista_eos.inc.php @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/includes/polling/os/bnt.inc.php b/includes/polling/os/bnt.inc.php index e6956c62d..29ed1798e 100644 --- a/includes/polling/os/bnt.inc.php +++ b/includes/polling/os/bnt.inc.php @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/includes/polling/os/catos.inc.php b/includes/polling/os/catos.inc.php index b2ff952bf..ea05a5686 100755 --- a/includes/polling/os/catos.inc.php +++ b/includes/polling/os/catos.inc.php @@ -15,10 +15,10 @@ if (!strstr($ciscomodel, " ") && strlen($ciscomodel) >= '3') $hardware = $ciscomodel; } -$sysDescr = str_replace(", Inc.", "", $sysDescr); ## Make the two formats the same -$sysDescr = str_replace("\n", " ", $sysDescr); +$poll_device[sysDescr] = str_replace(", Inc.", "", $poll_device[sysDescr]); ## Make the two formats the same +$poll_device[sysDescr] = str_replace("\n", " ", $poll_device[sysDescr]); -list(,,$hardware,,,,,,,$version,,,$features) = explode(" ", $sysDescr); +list(,,$hardware,,,,,,,$version,,,$features) = explode(" ", $poll_device[sysDescr]); list(,$features) = explode("-", $features); ?> \ No newline at end of file diff --git a/includes/polling/os/dell-laser.inc.php b/includes/polling/os/dell-laser.inc.php index 94b0027b5..cd1c7fafc 100644 --- a/includes/polling/os/dell-laser.inc.php +++ b/includes/polling/os/dell-laser.inc.php @@ -13,7 +13,7 @@ foreach ($dellinfo as $dellinf) $hardware = $dell_laser['MDL']; -list(,$version) = explode('Engine ',$sysDescr); +list(,$version) = explode('Engine ',$poll_device[sysDescr]); $version = "Engine " . trim($version,')'); diff --git a/includes/polling/os/extremeware.inc.php b/includes/polling/os/extremeware.inc.php index e1429cdbb..ab00befb5 100644 --- a/includes/polling/os/extremeware.inc.php +++ b/includes/polling/os/extremeware.inc.php @@ -9,10 +9,10 @@ echo("Doing Extreme: "); #Summit48(Yonetan) - Version 4.1.19 (Build 2) by Release_Master Wed 08/09/2000 6:09p #Alpine3808 - Version 7.2.0 (Build 33) by Release_Master 07/09/04 14:05:12 -if (!strpos($sysDescr, "XOS")) +if (!strpos($poll_device[sysDescr], "XOS")) { echo(" Extremeware \n"); - list(, $datas) = explode(" - ", $sysDescr); + list(, $datas) = explode(" - ", $poll_device[sysDescr]); $datas = str_replace("(","", $datas); $datas = str_replace(")","", $datas); list($a,$b,$c,$d,$e,$f,$g,$h) = explode(" ", $datas); @@ -28,7 +28,7 @@ else #ExtremeWare XOS version 11.5.2.10 v1152b10 by release-manager on Thu Oct 26 09:53:04 PDT 2006 echo(" XOS \n"); - list($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l,$m) = explode(" ", str_replace("ExtremeWare XOS", "ExtremeXOS", $sysDescr)); + list($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l,$m) = explode(" ", str_replace("ExtremeWare XOS", "ExtremeXOS", $poll_device[sysDescr])); if ($b == "version") { $version = $c; diff --git a/includes/polling/os/ies.inc.php b/includes/polling/os/ies.inc.php index af3c43a46..2e696b601 100644 --- a/includes/polling/os/ies.inc.php +++ b/includes/polling/os/ies.inc.php @@ -2,7 +2,7 @@ $version = trim(snmp_get($device, "accessSwitchFWVersion.0", "-OQv", "ZYXEL-AS-MIB"),'"'); -preg_match("/IES-(\d)*/",$sysDescr, $matches); +preg_match("/IES-(\d)*/",$poll_device[sysDescr], $matches); $hardware = $matches[0]; ?> \ No newline at end of file diff --git a/includes/polling/os/ios.inc.php b/includes/polling/os/ios.inc.php index 02a8419c7..347c9fb15 100755 --- a/includes/polling/os/ios.inc.php +++ b/includes/polling/os/ios.inc.php @@ -1,7 +1,8 @@ \ No newline at end of file +?> diff --git a/includes/polling/os/junos.inc.php b/includes/polling/os/junos.inc.php index e18d8f0d1..a323e5ee5 100644 --- a/includes/polling/os/junos.inc.php +++ b/includes/polling/os/junos.inc.php @@ -2,7 +2,7 @@ $jun_ver = snmp_get($device, ".1.3.6.1.2.1.25.6.3.1.2.2", "-Oqv", "HOST-RESOURCES-MIB"); -if (strpos($sysDescr, "olive")) +if (strpos($poll_device[sysDescr], "olive")) { $hardware = "Olive"; $serial = ""; diff --git a/includes/polling/os/junose.inc.php b/includes/polling/os/junose.inc.php index 0d9877e1e..87f82b595 100644 --- a/includes/polling/os/junose.inc.php +++ b/includes/polling/os/junose.inc.php @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/includes/polling/os/procurve.inc.php b/includes/polling/os/procurve.inc.php index c43da1202..278d720a2 100755 --- a/includes/polling/os/procurve.inc.php +++ b/includes/polling/os/procurve.inc.php @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/includes/polling/os/windows.inc.php b/includes/polling/os/windows.inc.php index fada42e18..5dc6f96d6 100755 --- a/includes/polling/os/windows.inc.php +++ b/includes/polling/os/windows.inc.php @@ -9,48 +9,48 @@ #sysDescr.0 = STRING: Hardware: Intel64 Family 6 Model 23 Stepping 6 AT/AT COMPATIBLE - Software: Windows Version 6.1 (Build 7600 Multiprocessor Free) #sysDescr.0 = STRING: Hardware: AMD64 Family 16 Model 8 Stepping 0 AT/AT COMPATIBLE - Software: Windows Version 6.1 (Build 7600 Multiprocessor Free) -if (strstr($sysDescr, "x86")) { $hardware = "Generic x86"; } -if (strstr($sysDescr, "ia64")) { $hardware = "Intel Itanium IA64"; } -if (strstr($sysDescr, "EM64")) { $hardware = "Intel x64"; } -if (strstr($sysDescr, "AMD64")) { $hardware = "AMD x64"; } -if (strstr($sysDescr, "Intel64")) { $hardware = "Intel x64"; } +if (strstr($poll_device[sysDescr], "x86")) { $hardware = "Generic x86"; } +if (strstr($poll_device[sysDescr], "ia64")) { $hardware = "Intel Itanium IA64"; } +if (strstr($poll_device[sysDescr], "EM64")) { $hardware = "Intel x64"; } +if (strstr($poll_device[sysDescr], "AMD64")) { $hardware = "AMD x64"; } +if (strstr($poll_device[sysDescr], "Intel64")) { $hardware = "Intel x64"; } if($sysObjectID == ".1.3.6.1.4.1.311.1.1.3.1.1") { ## Workstation - if (strstr($sysDescr, "Build Number: 1057")) { $version = "NT 3.51 Workstation"; } - if (strstr($sysDescr, "Build Number: 1381")) { $version = "NT 4.0 Workstation"; } - if (strstr($sysDescr, "Build 2195")) { $version = "2000 (NT 5.0)"; } - if (strstr($sysDescr, "Build 2600")) { $version = "XP (NT 5.1)"; } - if (strstr($sysDescr, "Build 3790")) { $version = "XP x64 (NT 5.2)"; } - if (strstr($sysDescr, "Build 6000")) { $version = "Vista (NT 6.0)"; } - if (strstr($sysDescr, "Build 6001")) { $version = "Vista SP1 (NT 6.0)"; } - if (strstr($sysDescr, "Build 6002")) { $version = "Vista SP2 (NT 6.0)"; } - if (strstr($sysDescr, "Build 7600")) { $version = "7 (NT 6.1)"; } + if (strstr($poll_device[sysDescr], "Build Number: 1057")) { $version = "NT 3.51 Workstation"; } + if (strstr($poll_device[sysDescr], "Build Number: 1381")) { $version = "NT 4.0 Workstation"; } + if (strstr($poll_device[sysDescr], "Build 2195")) { $version = "2000 (NT 5.0)"; } + if (strstr($poll_device[sysDescr], "Build 2600")) { $version = "XP (NT 5.1)"; } + if (strstr($poll_device[sysDescr], "Build 3790")) { $version = "XP x64 (NT 5.2)"; } + if (strstr($poll_device[sysDescr], "Build 6000")) { $version = "Vista (NT 6.0)"; } + if (strstr($poll_device[sysDescr], "Build 6001")) { $version = "Vista SP1 (NT 6.0)"; } + if (strstr($poll_device[sysDescr], "Build 6002")) { $version = "Vista SP2 (NT 6.0)"; } + if (strstr($poll_device[sysDescr], "Build 7600")) { $version = "7 (NT 6.1)"; } } elseif ($sysObjectID == ".1.3.6.1.4.1.311.1.1.3.1.2") { ## Server - if (strstr($sysDescr, "Build Number: 1057")) { $version = "NT Server 3.51"; } - if (strstr($sysDescr, "Build Number: 1381")) { $version = "NT Server 4.0"; } - if (strstr($sysDescr, "Build 2195")) { $version = "2000 Server (NT 5.0)"; } - if (strstr($sysDescr, "Build 3790")) { $version = "Server 2003 (NT 5.2)"; } - if (strstr($sysDescr, "Build 6001")) { $version = "Server 2008 (NT 6.0)"; } - if (strstr($sysDescr, "Build 6002")) { $version = "Server 2008 SP2 (NT 6.0)"; } - if (strstr($sysDescr, "Build 7600")) { $version = "Server 2008 R2(NT 6.1)"; } + if (strstr($poll_device[sysDescr], "Build Number: 1057")) { $version = "NT Server 3.51"; } + if (strstr($poll_device[sysDescr], "Build Number: 1381")) { $version = "NT Server 4.0"; } + if (strstr($poll_device[sysDescr], "Build 2195")) { $version = "2000 Server (NT 5.0)"; } + if (strstr($poll_device[sysDescr], "Build 3790")) { $version = "Server 2003 (NT 5.2)"; } + if (strstr($poll_device[sysDescr], "Build 6001")) { $version = "Server 2008 (NT 6.0)"; } + if (strstr($poll_device[sysDescr], "Build 6002")) { $version = "Server 2008 SP2 (NT 6.0)"; } + if (strstr($poll_device[sysDescr], "Build 7600")) { $version = "Server 2008 R2(NT 6.1)"; } } elseif ($sysObjectID == ".1.3.6.1.4.1.311.1.1.3.1.3") { ## Datacentre Server - if (strstr($sysDescr, "Build Number: 1057")) { $version = "NT Datacenter 3.51"; } - if (strstr($sysDescr, "Build Number: 1381")) { $version = "NT Datacenter 4.0"; } - if (strstr($sysDescr, "Build 2195")) { $version = "2000 Datacenter Server (NT 5.0)"; } - if (strstr($sysDescr, "Build 3790")) { $version = "Server 2003 Datacenter (NT 5.2)"; } - if (strstr($sysDescr, "Build 6001")) { $version = "Server 2008 Datacenter (NT 6.0)"; } - if (strstr($sysDescr, "Build 6002")) { $version = "Server 2008 Datacenter SP2 (NT 6.0)"; } - if (strstr($sysDescr, "Build 7600")) { $version = "Server 2008 Datacenter R2 (NT 6.1)"; } + if (strstr($poll_device[sysDescr], "Build Number: 1057")) { $version = "NT Datacenter 3.51"; } + if (strstr($poll_device[sysDescr], "Build Number: 1381")) { $version = "NT Datacenter 4.0"; } + if (strstr($poll_device[sysDescr], "Build 2195")) { $version = "2000 Datacenter Server (NT 5.0)"; } + if (strstr($poll_device[sysDescr], "Build 3790")) { $version = "Server 2003 Datacenter (NT 5.2)"; } + if (strstr($poll_device[sysDescr], "Build 6001")) { $version = "Server 2008 Datacenter (NT 6.0)"; } + if (strstr($poll_device[sysDescr], "Build 6002")) { $version = "Server 2008 Datacenter SP2 (NT 6.0)"; } + if (strstr($poll_device[sysDescr], "Build 7600")) { $version = "Server 2008 Datacenter R2 (NT 6.1)"; } } -if (strstr($sysDescr, "Uniprocessor")) { $features = "Uniprocessor"; } -if (strstr($sysDescr, "Multiprocessor")) { $features = "Multiprocessor"; } +if (strstr($poll_device[sysDescr], "Uniprocessor")) { $features = "Uniprocessor"; } +if (strstr($poll_device[sysDescr], "Multiprocessor")) { $features = "Multiprocessor"; } ### Detect processor type? : I.E. x86 Family 15 Model 2 Stepping 7 diff --git a/includes/polling/os/zywall.inc.php b/includes/polling/os/zywall.inc.php index eb812a528..2022c2621 100644 --- a/includes/polling/os/zywall.inc.php +++ b/includes/polling/os/zywall.inc.php @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/includes/polling/os/zyxelnwa.inc.php b/includes/polling/os/zyxelnwa.inc.php index eb812a528..2022c2621 100644 --- a/includes/polling/os/zyxelnwa.inc.php +++ b/includes/polling/os/zyxelnwa.inc.php @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/includes/polling/system.inc.php b/includes/polling/system.inc.php index 48bb63323..306a73514 100755 --- a/includes/polling/system.inc.php +++ b/includes/polling/system.inc.php @@ -25,8 +25,8 @@ if ($hrSystemUptime != "" && !strpos($hrSystemUptime, "No") && ($device['os'] != "windows")) { - echo("Using hrSystemUptime\n"); - $agent_uptime = $poll_device['uptime']; ## Move uptime into agent_uptime + echo("Using hrSystemUptime (".$hrSystemUptime.")\n"); + $agent_uptime = $uptime; ## Move uptime into agent_uptime #HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (63050465) 7 days, 7:08:24.65 $hrSystemUptime = str_replace("(", "", $hrSystemUptime); $hrSystemUptime = str_replace(")", "", $hrSystemUptime); @@ -35,25 +35,25 @@ $hours = $hours + ($days * 24); $mins = $mins + ($hours * 60); $secs = $secs + ($mins * 60); - $poll_device['uptime'] = $secs; + $uptime = $secs; } else { - echo("Using Agent Uptime\n"); + echo("Using Agent Uptime (".$poll_device['sysUpTime'].")\n"); #SNMPv2-MIB::sysUpTime.0 = Timeticks: (2542831) 7:03:48.31 - $sysUpTime = str_replace("(", "", $sysUpTime); - $sysUpTime = str_replace(")", "", $sysUpTime); - list($days, $hours, $mins, $secs) = explode(":", $sysUpTime); + $poll_device['sysUpTime'] = str_replace("(", "", $poll_device['sysUpTime']); + $poll_device['sysUpTime'] = str_replace(")", "", $poll_device['sysUpTime']); + list($days, $hours, $mins, $secs) = explode(":", $poll_device['sysUpTime']); list($secs, $microsecs) = explode(".", $secs); $hours = $hours + ($days * 24); $mins = $mins + ($hours * 60); $secs = $secs + ($mins * 60); - $poll_device['uptime'] = $secs; + $uptime = $secs; } - if (is_numeric($poll_device['uptime'])) + if (is_numeric($uptime)) { - if ($poll_device['uptime'] < $device['uptime']) + if ($uptime < $device['uptime']) { - notify($device,"Device rebooted: " . $device['hostname'], "Device Rebooted : " . $device['hostname'] . " " . formatUptime($poll_device['uptime']) . " ago."); + notify($device,"Device rebooted: " . $device['hostname'], "Device Rebooted : " . $device['hostname'] . " " . formatUptime($uptime) . " ago."); log_event('Device rebooted after '.formatUptime($device['uptime']), $device, 'reboot', $device['uptime']); } @@ -63,26 +63,18 @@ { rrdtool_create ($uptime_rrd, "DS:uptime:GAUGE:600:0:U RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797"); } - rrdtool_update($uptime_rrd, "N:".$poll_device['uptime']); + rrdtool_update($uptime_rrd, "N:".$uptime); $graphs['uptime'] = TRUE; - echo("Uptime: ".formatUptime($poll_device['uptime'])."\n"); + echo("Uptime: ".formatUptime($uptime)."\n"); - $device['db_update'] .= ", `uptime` = '".mres($poll_device['uptime'])."'"; + $device['db_update'] .= ", `uptime` = '".mres($uptime)."'"; } - echo("Hardware: ".$poll_device['hardware']." Version: ".$poll_device['version']." Features: ".$poll_device['features']."\n"); - $poll_device['sysLocation'] = str_replace("\"","", $poll_device['sysLocation']); $poll_device['sysContact'] = str_replace("\"","", $poll_device['sysContact']); - if ($poll_device['serial'] && $poll_device['serial'] != $device['serial']) - { - $device['db_update'] .= ", `serial` = '".mres($poll_device['serial'])."'"; - log_event("Serial -> ".$poll_device['serial'], $device, 'system'); - } - if ($poll_device['sysContact'] && $poll_device['sysContact'] != $device['sysContact']) { $device['db_update'] .= ", `sysContact` = '".mres($poll_device['sysContact'])."'"; @@ -110,22 +102,4 @@ log_event("Location -> ".$poll_device['sysLocation'], $device, 'system'); } - if ($poll_device['version'] && $device['version'] != $poll_device['version']) - { - $device['db_update'] .= ", `version` = '".mres($poll_device['version'])."'"; - log_event("OS Version -> ".$poll_device['version'], $device, 'system'); - } - - if ($poll_device['features'] != $device['features']) - { - $device['db_update'] .= ", `features` = '".mres($poll_device['features'])."'"; - log_event("OS Features -> ".$poll_device['features'], $device, 'system'); - } - - if ($poll_device['hardware'] && $poll_device['hardware'] != $device['hardware']) - { - $device['db_update'] .= ", `hardware` = '".mres($poll_device['hardware'])."'"; - log_event("Hardware -> ".$poll_device['hardware'], $device, 'system'); - } - ?> diff --git a/includes/static-config.php b/includes/static-config.php index 4034b9cfd..50b5346aa 100644 --- a/includes/static-config.php +++ b/includes/static-config.php @@ -10,8 +10,8 @@ ## List of poller modules. Need to be in the array to be ## considered for execution. -#$config['poller_modules']['system'] = 1; -#$config['poller_modules']['os'] = 1; +$config['poller_modules']['system'] = 1; +$config['poller_modules']['os'] = 1; $config['poller_modules']['ipmi'] = 1; $config['poller_modules']['sensors'] = 1; $config['poller_modules']['processors'] = 1;