diff --git a/database-update.sql b/database-update.sql index b1ff99a32..90f982f56 100644 --- a/database-update.sql +++ b/database-update.sql @@ -8,3 +8,4 @@ DROP TABLE IF EXISTS `graph_types`; CREATE TABLE IF NOT EXISTS `graph_types` ( `graph_type` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `graph_subtype` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `graph_section` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `graph_descr` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `graph_order` int(11) NOT NULL, KEY `graph_type` (`graph_type`), KEY `graph_subtype` (`graph_subtype`), KEY `graph_section` (`graph_section`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `graph_types` (`graph_type`, `graph_subtype`, `graph_section`, `graph_descr`, `graph_order`) VALUES('device', 'bits', 'netstats', 'Total Traffic', 0),('device', 'hr_users', 'system', 'Users Logged In', 0),('device', 'ucd_load', 'system', 'Load Averages', 0),('device', 'ucd_cpu', 'system', 'Detailed Processor Usage', 0),('device', 'ucd_memory', 'system', 'Detailed Memory Usage', 0),('device', 'netstat_tcp', 'netstats', 'TCP Statistics', 0),('device', 'netstat_icmp_info', 'netstats', 'ICMP Informational Statistics', 0),('device', 'netstat_icmp_stat', 'netstats', 'ICMP Statistics', 0),('device', 'netstat_ip', 'netstats', 'IP Statistics', 0),('device', 'netstat_ip_frag', 'netstats', 'IP Fragmentation Statistics', 0),('device', 'netstat_udp', 'netstats', 'UDP Statistics', 0),('device', 'netstat_snmp', 'netstats', 'SNMP Statistics', 0),('device', 'temperatures', 'system', 'Temperatures', 0),('device', 'mempools', 'system', 'Memory Pool Usage', 0),('device', 'processors', 'system', 'Processor Usage', 0),('device', 'storage', 'system', 'Filesystem Usage', 0),('device', 'hr_processes', 'system', 'Running Processes', 0),('device', 'uptime', 'system', 'System Uptime', ''),('device', 'ipsystemstats_ipv4', 'netstats', 'IPv4 Packet Statistics', 0),('device', 'ipsystemstats_ipv6_frag', 'netstats', 'IPv6 Fragmentation Statistics', 0),('device', 'ipsystemstats_ipv6', 'netstats', 'IPv6 Packet Statistics', 0),('device', 'ipsystemstats_ipv4_frag', 'netstats', 'IPv4 Fragmentation Statistics', 0),('device', 'fortigate_sessions', 'firewall', 'Active Sessions', ''), ('device', 'screenos_sessions', 'firewall', 'Active Sessions', ''), ('device', 'fdb_count', 'system', 'MAC Addresses Learnt', '0'),('device', 'cras_sessions', 'firewall', 'Remote Access Sessions', 0); DROP TABLE `frequency`; +ALTER TABLE `mempools` CHANGE `mempool_index` `mempool_index` VARCHAR( 16 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index 9cb33884c..1351e87d6 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -1,23 +1,5 @@ '1000BaseLX GBIC', 'cevPort10GigBaseLR' => '10GigBaseLR'); - ?> diff --git a/includes/discovery/cisco-entity-sensor.inc.php b/includes/discovery/cisco-entity-sensor.inc.php index b59e8cedb..3d89f8d0a 100644 --- a/includes/discovery/cisco-entity-sensor.inc.php +++ b/includes/discovery/cisco-entity-sensor.inc.php @@ -35,7 +35,15 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios") { $entPhysicalIndex = $index; $descr = snmp_get($device, "entPhysicalName.".$index, "-Oqv", "ENTITY-MIB"); - if(!$descr) { $descr = snmp_get($device, "entPhysicalDescr.".$index, "-Oqv", "ENTITY-MIB"); } + if($descr || $device['os'] == "iosxr") + { + $descr = rewrite_entity_descr($descr); + } else { + $descr = snmp_get($device, "entPhysicalDescr.".$index, "-Oqv", "ENTITY-MIB"); + $descr = rewrite_entity_descr($descr); + } + + if(is_numeric($entry['entSensorMeasuredEntity']) && $entry['entSensorMeasuredEntity']) { $measured_descr = snmp_get($device, "entPhysicalName.".$entry['entSensorMeasuredEntity'],"-Oqv", "ENTITY-MIB"); if(!measured_descr) { $measured_descr = snmp_get($device, "entPhysicalDescr.".$entry['entSensorMeasuredEntity'],"-Oqv", "ENTITY-MIB");} @@ -44,7 +52,7 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios") ### Bit dirty also, clean later $descr = str_replace("Temp: ", "", $descr); - $descr = str_ireplace("temperature ", "", $descr); + $descr = str_ireplace("temperature ", "", $descr); $oid = ".1.3.6.1.4.1.9.9.91.1.1.1.1.4.".$index; $current = $entry['entSensorValue']; diff --git a/includes/polling/os/allied.inc.php b/includes/polling/os/allied.inc.php index 5e00d49bd..af39d67e8 100644 --- a/includes/polling/os/allied.inc.php +++ b/includes/polling/os/allied.inc.php @@ -5,9 +5,9 @@ echo("Doing Allied Telesyn AlliedWare "); ### Allied Telesis have somewhat messy MIBs. It's often hard to work out what is where. :) -$hardware = snmp_get($device, "atiswitchProductType.0", "-OsvQU", "+AtiSwitch-MIB", "+".$config['mib_dir']."/alliedtelesis"); -$version = snmp_get($device, "atiswitchSwVersion.0", "-OsvQU", "+AtiSwitch-MIB", "+".$config['mib_dir']."/alliedtelesis"); -$software = snmp_get($device, "atiswitchSw.0", "-OsvQU", "+AtiSwitch-MIB", "+".$config['mib_dir']."/alliedtelesis"); +$hardware = snmp_get($device, "atiswitchProductType.0", "-OsvQU", "+AtiSwitch-MIB"); +$version = snmp_get($device, "atiswitchSwVersion.0", "-OsvQU", "+AtiSwitch-MIB"); +$software = snmp_get($device, "atiswitchSw.0", "-OsvQU", "+AtiSwitch-MIB"); if($software && $version) $version = $software . " " . $version; @@ -22,8 +22,8 @@ if($software && $version) # AtiL2-MIB::atiL2SwVersion.0 = STRING: "AT-S41 v1.1.6 " if(!$hardware && !$version && !$features) { - $hardware = snmp_get($device, "atiL2SwProduct.0", "-OsvQU", "+AtiL2-MIB", "+".$config['mib_dir']."/alliedtelesis"); - $version = snmp_get($device, "atiL2SwVersion.0", "-OsvQU", "+AtiL2-MIB", "+".$config['mib_dir']."/alliedtelesis"); + $hardware = snmp_get($device, "atiL2SwProduct.0", "-OsvQU", "+AtiL2-MIB"); + $version = snmp_get($device, "atiL2SwVersion.0", "-OsvQU", "+AtiL2-MIB"); } #Allied Telesyn AT-8948 version 2.7.4-02 22-Aug-2005 diff --git a/includes/polling/os/ftos.inc.php b/includes/polling/os/ftos.inc.php index 6bf236f98..78f24448b 100644 --- a/includes/polling/os/ftos.inc.php +++ b/includes/polling/os/ftos.inc.php @@ -36,15 +36,15 @@ $hardware = rewrite_ftos_hardware($sysObjectID); if(strstr($sysObjectID, ".1.3.6.1.4.1.6027.1.3.")) { echo("S-Series "); - $version = snmp_get($device, "chStackUnitCodeVersion.1", "-Oqvn", "F10-S-SERIES-CHASSIS-MIB", $config['mib_dir'].":".$config['mib_dir']."/ftos"); + $version = snmp_get($device, "chStackUnitCodeVersion.1", "-Oqvn", "F10-S-SERIES-CHASSIS-MIB"); } elseif(strstr($sysObjectID, ".1.3.6.1.4.1.6027.1.2.")) { echo("C-Series "); - $version = snmp_get($device, "chSwVersion.0", "-Oqvn", "F10-C-SERIES-CHASSIS-MIB", $config['mib_dir'].":".$config['mib_dir']."/ftos"); + $version = snmp_get($device, "chSwVersion.0", "-Oqvn", "F10-C-SERIES-CHASSIS-MIB"); } else { echo("E-Series "); - $version = snmp_get($device, "chSysSwRuntimeImgVersion.1.1", "-Oqvn", "F10-CHASSIS-MIB", $config['mib_dir'].":".$config['mib_dir']."/ftos"); + $version = snmp_get($device, "chSysSwRuntimeImgVersion.1.1", "-Oqvn", "F10-CHASSIS-MIB"); } $version = str_replace("\"","", $version); diff --git a/includes/polling/os/procurve.inc.php b/includes/polling/os/procurve.inc.php index d80bf2c46..d62e88431 100755 --- a/includes/polling/os/procurve.inc.php +++ b/includes/polling/os/procurve.inc.php @@ -5,7 +5,7 @@ list($features) = explode("(", $version); $fdb_rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/fdb_count.rrd"; -$FdbAddressCount = snmp_get ($device, "hpSwitchFdbAddressCount.0", "-Ovqn", "STATISTICS-MIB", $config['mib_dir'].":".$config['mib_dir']."/hp"); +$FdbAddressCount = snmp_get ($device, "hpSwitchFdbAddressCount.0", "-Ovqn", "STATISTICS-MIB"); if(is_numeric($FdbAddressCount)) { diff --git a/includes/polling/os/radlan.inc.php b/includes/polling/os/radlan.inc.php index a57569bc6..96543722b 100644 --- a/includes/polling/os/radlan.inc.php +++ b/includes/polling/os/radlan.inc.php @@ -6,10 +6,10 @@ if($sysDescr == "Neyland 24T") { $hardware = "Dell ".snmp_get($device, "productIdentificationDisplayName.0", "-Ovq", "Dell-Vendor-MIB"); $version = snmp_get($device, "productIdentificationVersion.0", "-Ovq", "Dell-Vendor-MIB"); } else { - $version = snmp_get($device, "rndBrgVersion.0", "-Ovq", "RADLAN-MIB", $config['mib_dir'].":".$config['mib_dir'] . "radlan/"); + $version = snmp_get($device, "rndBrgVersion.0", "-Ovq", "RADLAN-MIB"); $hardware = str_replace("ATI", "Allied Telesis", $sysDescr); } -$features = snmp_get($device, "rndBaseBootVersion.00", "-Ovq", "RADLAN-MIB", $config['mib_dir'].":".$config['mib_dir'] . "radlan/"); +$features = snmp_get($device, "rndBaseBootVersion.00", "-Ovq", "RADLAN-MIB"); $version = str_replace("\"","", $version); $features = str_replace("\"","", $features); diff --git a/includes/rewrites.php b/includes/rewrites.php index 47626d4a3..6f5455c21 100644 --- a/includes/rewrites.php +++ b/includes/rewrites.php @@ -5,6 +5,28 @@ function formatMac($mac) { return $mac; } +function rewrite_entity_descr ($descr) { + + $descr = str_replace("Distributed Forwarding Card", "DFC", $descr); + $descr = preg_replace("/7600 Series SPA Interface Processor-/", "7600 SIP-", $descr); + $descr = preg_replace("/Rev\.\ [0-9\.]+\ /", "", $descr); + $descr = preg_replace("/12000 Series Performance Route Processor/", "12000 PRP", $descr); + $descr = preg_replace("/^12000/", "", $descr); + $descr = preg_replace("/Gigabit Ethernet/", "GigE", $descr); + $descr = preg_replace("/^ASR1000\ /", "", $descr); + $descr = str_replace("Routing Processor", "RP", $descr); + $descr = str_replace("Route Processor", "RP", $descr); + $descr = str_replace("Switching Processor", "SP", $descr); + $descr = str_replace("Sub-Module", "Module ", $descr); + $descr = str_replace("DFC Card", "DFC", $descr); + $descr = str_replace("Power Supply Module", "PSU ", $descr); + $descr = str_replace("/Voltage Sensor/", "Voltage", $descr); + $descr = preg_replace("/^temperatures /", "", $descr); + $descr = preg_replace("/^voltages /", "", $descr); + + + return $descr; +} function ifNameDescr($interface, $device = NULL) { return ifLabel($interface, $device); diff --git a/poller.php b/poller.php index deca1ceea..f1ee026a7 100755 --- a/poller.php +++ b/poller.php @@ -105,22 +105,13 @@ while ($device = mysql_fetch_assoc($device_query)) $sysDescr = trim(shell_exec($config['snmpget'] . " -m SNMPv2-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " sysDescr.0")); $sysName = strtolower($sysName); - $hrSystemUptime = snmp_get($device, ".1.3.6.1.2.1.25.1.1.0", "-Oqv", "HOST-RESOURCES-MIB"); +# $hrSystemUptime = snmp_get($device, ".1.3.6.1.2.1.25.1.1.0", "-Oqv", "HOST-RESOURCES-MIB"); - #echo("UPTIMES: ".$hrSystemUptime."|".$sysUptime."]"); + echo("UPTIMES: ".$hrSystemUptime."|".$sysUptime."]"); - #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); - list($secs, $microsecs) = explode(".", $secs); - $hours = $hours + ($days * 24); - $mins = $mins + ($hours * 60); - $secs = $secs + ($mins * 60); - $uptime = $secs; - - if ($hrSystemUptime != "No Such Object available on this agent at this OID" && $hrSystemUptime != "") + if ($hrSystemUptime != "" && !strpos($hrSystemUptime, "No")) { + echo("Using 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); @@ -132,6 +123,17 @@ while ($device = mysql_fetch_assoc($device_query)) $secs = $secs + ($mins * 60); $uptime = $secs; if ($device['os'] == "windows") { $uptime /= 10; } + } else { + echo("Using Agent Uptime\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); + list($secs, $microsecs) = explode(".", $secs); + $hours = $hours + ($days * 24); + $mins = $mins + ($hours * 60); + $secs = $secs + ($mins * 60); + $uptime = $secs; } if (is_numeric($uptime)) @@ -148,12 +150,7 @@ while ($device = mysql_fetch_assoc($device_query)) if (!is_file($uptimerrd)) { - $woo = shell_exec($config['rrdtool'] . " create $uptimerrd \ - 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_create ($uptimerrd, "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($uptimerrd, "N:$uptime");