diff --git a/discover-cdp.php b/discover-cdp.php index 0a6f48d17..7a9007d15 100755 --- a/discover-cdp.php +++ b/discover-cdp.php @@ -1,16 +1,21 @@ #!/usr/bin/php - ini_set('display_errors', 1); - ini_set('display_startup_errors', 1); - ini_set('log_errors', 1); - ini_set('error_reporting', E_WARNING); +#ini_set('display_errors', 1); +#ini_set('display_startup_errors', 1); +#ini_set('log_errors', 1); +#ini_set('error_reporting', E_WARNING); include("config.php"); include("includes/functions.php"); include("includes/cdp.inc.php"); -$device_query = mysql_query("SELECT * FROM `devices` WHERE `status` = '1' AND (`os` = 'IOS' OR `os` = 'IOS XE') AND hostname NOT LIKE '%bar%' ORDER BY `device_id` DESC"); +if($argv[1] == "--device" && $argv[2]) { + $where = "AND `device_id` = '".$argv[2]."'"; +} + + +$device_query = mysql_query("SELECT * FROM `devices` WHERE `status` = '1' AND (`os` = 'IOS' OR `os` = 'IOS XE') AND hostname NOT LIKE '%bar%' $where ORDER BY `device_id` DESC"); while ($device = mysql_fetch_array($device_query)) { @@ -54,10 +59,10 @@ while ($device = mysql_fetch_array($device_query)) { createHost ($dst_host, $community, "v2c"); } } else { - echo(".. Already got host $dst_host\n"); + echo("."); } } else { - #echo("!! Bad DNS for $dst_host\n"); + echo("!($dst_host)"); } if ( mysql_result(mysql_query("SELECT COUNT(*) FROM `devices` WHERE `sysName` = '$dst_host'"), 0) == '1' && @@ -72,9 +77,9 @@ while ($device = mysql_fetch_array($device_query)) { { $sql = "INSERT INTO `links` (`src_if`, `dst_if`, `cdp`) VALUES ('$src_if_id', '$dst_if_id', '1')"; mysql_query($sql); - echo("++ Creating Link : $src_host $src_if -> $dst_host $dst_if\n"); + echo("++($src_host $src_if -> $dst_host $dst_if)"); } else { - echo(".. Existing Link : $src_host $src_if -> $dst_host $dst_if\n "); + echo(".."); } } else { @@ -82,6 +87,8 @@ while ($device = mysql_fetch_array($device_query)) { } } +echo("\n"); + echo(count($linkalive) . " Entries\n"); $query = mysql_query("SELECT * FROM `links`"); diff --git a/discovery.php b/discovery.php index 187bf44a8..bf867a385 100755 --- a/discovery.php +++ b/discovery.php @@ -69,6 +69,7 @@ while ($device = mysql_fetch_array($device_query)) { include("includes/discovery/bgp-peers.php"); include("includes/discovery/cisco-pw.php"); include("includes/discovery/cisco-vrf.php"); + include("includes/discovery/cisco-processors.php"); } echo("\n"); $devices_polled++; diff --git a/html/css/styles.css b/html/css/styles.css index da64a3940..a81a29c02 100644 --- a/html/css/styles.css +++ b/html/css/styles.css @@ -574,6 +574,19 @@ a.interface-upup:hover, a.interface-updown:hover, a.interface-admindown:hover { padding-left:21px; } +.infobox,.infobox-down { + font-family: Verdana, Arial, Helvetica, sans-serif; + border: 2px dashed #AAAACC; + background-color: #CCCCFF; + padding: 8px; + font-size: 12px; + margin: 8px; +} + +.infobox-down { + +} + .errorbox { font-family: Verdana, Arial, Helvetica, sans-serif; border: 2px dashed #CC0000; diff --git a/html/graph.php b/html/graph.php index 94c943b6c..8b12338f3 100644 --- a/html/graph.php +++ b/html/graph.php @@ -132,7 +132,7 @@ case 'cpu': if($os == "Linux" || $os == "NetBSD" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "Windows" || $os == "m0n0wall" || $os == "Voswall" || $os == "pfSense" || $os == "DragonFly" || $os == "OpenBSD") { $graph = cpugraphUnix ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); - } elseif($os == "IOS") { + } elseif($os == "IOS" || $os == "IOS XE") { $graph = cpugraph ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } elseif($os == "Windows") { $graph = cpugraphwin ($hostname . "/cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); @@ -158,7 +158,7 @@ case 'mem': if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "NetBSD" ) { $graph = memgraphUnix ($hostname . "/mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); - } elseif($os == "IOS") { + } elseif($os == "IOS" || $os == "IOS XE") { $graph = memgraph ($hostname . "/mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } elseif($os == "Windows") { } elseif($os == "ProCurve") { @@ -168,7 +168,7 @@ case 'load': if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "NetBSD" ) { $graph = loadgraphUnix ($hostname . "/load.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); - } elseif($os == "IOS") { + } elseif($os == "IOS" || $os == "IOS XE") { $graph = loadgraph ($hostname . "/load.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); } elseif($os == "Windows") { $graph = loadgraphwin ($hostname . "/load.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); diff --git a/html/includes/hostbox.inc b/html/includes/hostbox.inc index 47eddd51c..bca797253 100644 --- a/html/includes/hostbox.inc +++ b/html/includes/hostbox.inc @@ -16,7 +16,7 @@ onclick=\"location.href='/device/".$device['device_id']."/'\" style='cursor: hand;'>
Processors
"); + echo("| " . $proc['entPhysicalDescr'] . " | +" . $proc['cpmCPUTotal5minRev'] . "% | +" . $total . " | +" . $used . " | +
Storage
"); diff --git a/html/pages/inventory.php b/html/pages/inventory.php index 05ad3e096..a87551fd6 100644 --- a/html/pages/inventory.php +++ b/html/pages/inventory.php @@ -36,7 +36,7 @@ ?> - + @@ -46,7 +46,11 @@ if($_POST['string']) { - $where = " AND E.entPhysicalDescr LIKE '%".$_POST['string']."%'"; + $where .= " AND E.entPhysicalDescr LIKE '%".$_POST['string']."%'"; +} + +if($_POST['device_string']) { + $where .= " AND D.hostname LIKE '%".$_POST['device_string']."%'"; } if($_POST['part']) { diff --git a/includes/discovery/bgp-peers.php b/includes/discovery/bgp-peers.php index 5f6569074..66a224c5a 100755 --- a/includes/discovery/bgp-peers.php +++ b/includes/discovery/bgp-peers.php @@ -37,7 +37,7 @@ } ## Get afi/safi and populate cbgp on cisco IOS - if($device['os'] == "IOS") { + if($device['os'] == "IOS" || $device['os'] == "IOS XE") { unset($af_list); $af_cmd = $config['snmpwalk'] . " -CI -m CISCO-BGP4-MIB -OsQ -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; $af_cmd .= "cbgpPeerAddrFamilyName." . $peer_ip; diff --git a/includes/discovery/cisco-processors.php b/includes/discovery/cisco-processors.php new file mode 100755 index 000000000..512757b32 --- /dev/null +++ b/includes/discovery/cisco-processors.php @@ -0,0 +1,50 @@ + + $id = $device['device_id']; + $hostname = $device['hostname']; + $community = $device['community']; + $snmpver = $device['snmpver']; + $port = $device['port']; + + echo("Cisco Procs : "); + + ## Cisco Processors + if($device['os'] == "IOS" || $device['os'] == "IOS XE") { + echo("Cisco "); + $oids = shell_exec($config['snmpwalk'] . " -v2c -CI -Osqn -c ".$community." ".$hostname.":".$port." .1.3.6.1.4.1.9.9.109.1.1.1.1.2 | sed s/.1.3.6.1.4.1.9.9.109.1.1.1.1.2.//g"); + $oids = trim($oids); + foreach(explode("\n", $oids) as $data) { + $data = trim($data); + if($data) { + list($oid, $entPhysicalIndex) = explode(" ", $data); + $usage_oid = "cpmCPUTotal5minRev.$oid"; + $descr_oid = "entPhysicalName.$entPhysicalIndex"; + $descr = trim(shell_exec("snmpget -O qv -v2c -c $community $hostname:$port $descr_oid")); + $usage = trim(shell_exec("snmpget -O qv -v2c -c $community $hostname:$port $usage_oid")); + if($entPhysicalIndex == "0") { $descr = "Proc $oid"; } + if(!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" ) { + $descr = str_replace("\"", "", $descr); + $descr = str_replace("CPU of ", "", $descr); + $descr = str_replace("Sub-", "", $descr); + $descr = str_replace("Routing Processor", "RP", $descr); + $descr = str_replace("Switching Processor", "SP", $descr); + $descr = trim($descr); +# echo("[$descr ($oid)] "); + if(mysql_result(mysql_query("SELECT count(cpmCPU_id) FROM `cpmCPU` WHERE `cpmCPU_oid` = '$oid' AND `device_id` = '$id'"),0) == '0') { + $query = "INSERT INTO cpmCPU (`entPhysicalIndex`, `device_id`, `entPhysicalDescr`, `cpmCPU_oid`) values ('$entPhysicalIndex', '$id', '$descr', '$oid')"; + mysql_query($query); +# echo("$query"); + echo("+"); + } else { echo("."); } + $valid_cpm[$id][$oid] = 1; + } + } + } + } ## End Cisco Processors + + +##### ************FIX ME***************** +##### WRITE CODE TO REMOVE OLD PROCESSORS +##### SOMETIMES CPUS FALL OUT, DONT THEY? +##### *********************************** + +?> diff --git a/includes/discovery/temperatures.php b/includes/discovery/temperatures.php index ed4c4c60d..eb19ca337 100755 --- a/includes/discovery/temperatures.php +++ b/includes/discovery/temperatures.php @@ -89,7 +89,7 @@ ## Cisco Temperatures - if($device['os'] == "IOS") { + if($device['os'] == "IOS" || $device['os'] == "IOS XE") { echo("Cisco "); $oids = shell_exec($config['snmpwalk'] . " -v2c -CI -Osqn -c $community $hostname:$port .1.3.6.1.4.1.9.9.13.1.3.1.2 | sed s/.1.3.6.1.4.1.9.9.13.1.3.1.2.//g"); $oids = trim($oids); diff --git a/includes/polling/bgpPeer.inc.php b/includes/polling/bgpPeer.inc.php index 21477153d..da34c1a04 100755 --- a/includes/polling/bgpPeer.inc.php +++ b/includes/polling/bgpPeer.inc.php @@ -39,7 +39,7 @@ while($peer = mysql_fetch_array($peers)) { mysql_query($update); - if($device['os'] == "IOS") { + if($device['os'] == "IOS" || $device['os'] == "IOS XE") { ## Poll each AFI/SAFI for this peer (using CISCO-BGP4-MIB) $afi_query = mysql_query("SELECT * FROM bgpPeers_cbgp WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '" . $peer['bgpPeerIdentifier'] . "'"); @@ -47,7 +47,7 @@ while($peer = mysql_fetch_array($peers)) { $afi = $peer_afi['afi']; $safi = $peer_afi['safi']; - echo($config['afi'][$afi][$safi]. " "); + #echo($config['afi'][$afi][$safi]. " "); $cbgp_cmd = $config['snmpget'] . " -m CISCO-BGP4-MIB -Ovq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port']; $cbgp_cmd .= " cbgpPeerAcceptedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi"; @@ -58,7 +58,7 @@ while($peer = mysql_fetch_array($peers)) { $cbgp_cmd .= " cbgpPeerAdvertisedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi"; $cbgp_cmd .= " cbgpPeerSuppressedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi"; $cbgp_cmd .= " cbgpPeerWithdrawnPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi"; - echo("\n$cbgp_cmd\n"); + #echo("\n$cbgp_cmd\n"); $cbgp_data = preg_replace("/^OID.*$/", "", trim(`$cbgp_cmd`)); list($cbgpPeerAcceptedPrefixes,$cbgpPeerDeniedPrefixes,$cbgpPeerPrefixAdminLimit,$cbgpPeerPrefixThreshold,$cbgpPeerPrefixClearThreshold,$cbgpPeerAdvertisedPrefixes,$cbgpPeerSuppressedPrefixes,$cbgpPeerWithdrawnPrefixes) = explode("\n", $cbgp_data); diff --git a/includes/polling/cisco-processors.inc.php b/includes/polling/cisco-processors.inc.php new file mode 100755 index 000000000..7b7c227a3 --- /dev/null +++ b/includes/polling/cisco-processors.inc.php @@ -0,0 +1,39 @@ + + +$query = "SELECT * FROM cpmCPU WHERE device_id = '" . $device['device_id'] . "'"; +$proc_data = mysql_query($query); +while($processor = mysql_fetch_array($proc_data)) { + + $proc_cmd = "snmpget -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpmCPUTotal5minRev." . $processor['cpmCPU_oid']; + $proc = shell_exec($proc_cmd); + + echo("Checking CPU " . $processor['entPhysicalDescr'] . "... "); + + $procrrd = addslashes($config['rrd_dir'] . "/" . $device['hostname'] . "/cpmCPU-" . str_replace("/", "_", str_replace(" ", "_",$processor['entPhysicalDescr'])) . ".rrd"); + $procrrd = str_replace(")", "_", $procrrd); + $procrrd = str_replace("(", "_", $procrrd); + + if (!is_file($procrrd)) { + `rrdtool create $procrrd \ + --step 300 \ + DS:usage:GAUGE:600:-273:1000 \ + RRA:AVERAGE:0.5:1:1200 \ + RRA:MIN:0.5:12:2400 \ + RRA:MAX:0.5:12:2400 \ + RRA:AVERAGE:0.5:12:2400`; + } + + $proc = trim(str_replace("\"", "", $proc)); + list($proc) = split(" ", $proc); + + echo($proc . "%\n"); + + $updatecmd = $config['rrdtool'] ." update $procrrd N:$proc"; + + shell_exec($updatecmd); + + mysql_query("UPDATE `cpmCPU` SET `cpmCPUTotal5minRev` = '$proc' WHERE `cpmCPU_id` = '".$processor['cpmCPU_id']."'"); + +} + +?> diff --git a/includes/polling/device-ios.inc.php b/includes/polling/device-ios.inc.php index 59f1cbefb..4368c66c7 100755 --- a/includes/polling/device-ios.inc.php +++ b/includes/polling/device-ios.inc.php @@ -106,6 +106,6 @@ `rrdtool update $memrrd N:$memfreeio:$memusedio:$memfreeproc:$memusedproc:$memtotal`; include("includes/polling/bgpPeer.inc.php"); - + include("includes/polling/cisco-processors.inc.php"); ?> diff --git a/includes/syslog.php b/includes/syslog.php index d65673e64..cfc13d48f 100755 --- a/includes/syslog.php +++ b/includes/syslog.php @@ -28,7 +28,13 @@ function process_syslog ($entry, $update) { list(,$entry[msg]) = split(": %", $entry['msg']); $entry['msg'] = "%" . $entry['msg']; $entry['msg'] = preg_replace("/^%(.+?):\ /", "\\1||", $entry['msg']); - } else { $entry['msg'] = "||" . $entry['msg']; } + } else { + $entry['msg'] = preg_replace("/^.*[0-9]:/", "", $entry['msg']); + $entry['msg'] = preg_replace("/^[0-9][0-9]\ [A-Z]{3}:/", "", $entry['msg']); + $entry['msg'] = preg_replace("/^(.+?):\ /", "\\1||", $entry['msg']); + #$entry['msg'] = "||" . $entry['msg']; + } + $entry['msg'] = preg_replace("/^.+\.[0-9]{3}:/", "", $entry['msg']); $entry['msg'] = preg_replace("/^.+-Traceback=/", "Traceback||", $entry['msg']); @@ -40,9 +46,7 @@ function process_syslog ($entry, $update) { list($entry['program'], $entry['msg']) = explode("||", $entry['msg']); } - if(!$entry['msg']) { $entry['msg'] = $entry['program']; } - - + if(!$entry['msg']) { $entry['msg'] = $entry['program']; unset ($entry['program']); } } else { $program = preg_quote($entry['program'],'/'); diff --git a/mibs/CISCO-ENTITY-SENSOR-MIB.my b/mibs/CISCO-ENTITY-SENSOR-MIB.my new file mode 100644 index 000000000..85812c17c --- /dev/null +++ b/mibs/CISCO-ENTITY-SENSOR-MIB.my @@ -0,0 +1,874 @@ +-- ***************************************************************** +-- CISCO-ENTITY-SENSOR-MIB +-- +-- November 1997, Cliff L. Sojourner +-- +-- Copyright (c) 1998-2003, 2005, 2006 by cisco Systems, Inc. +-- All rights reserved. +-- ***************************************************************** +-- +CISCO-ENTITY-SENSOR-MIB DEFINITIONS ::= BEGIN + +IMPORTS + MODULE-IDENTITY, + OBJECT-TYPE, + NOTIFICATION-TYPE, + Integer32 + FROM SNMPv2-SMI + MODULE-COMPLIANCE, + OBJECT-GROUP, + NOTIFICATION-GROUP + FROM SNMPv2-CONF + TEXTUAL-CONVENTION, + TimeStamp, + TruthValue + FROM SNMPv2-TC + entPhysicalIndex + FROM ENTITY-MIB + EntPhysicalIndexOrZero + FROM CISCO-TC + ciscoMgmt + FROM CISCO-SMI; + +ciscoEntitySensorMIB MODULE-IDENTITY + LAST-UPDATED "200711120000Z" + ORGANIZATION "Cisco Systems, Inc." + CONTACT-INFO + "Postal: Cisco Systems, Inc. + 170 West Tasman Drive + San Jose, CA 95134-1706 + USA + + Tel: +1 408 526 4000 + + E-mail: cs-snmp@cisco.com" + DESCRIPTION + "The CISCO-ENTITY-SENSOR-MIB is used to monitor + the values of sensors in the Entity-MIB (RFC 2037) + entPhysicalTable." + + REVISION "200711120000Z" + DESCRIPTION + "Added entitySensorNotifCtrlGlobalGroup." + + REVISION "200601010000Z" + DESCRIPTION + "Add new object entSensorMeasuredEntity to + entSensorValueTable." + + REVISION "200509080000Z" + DESCRIPTION + "Change the module descriptor name from entitySensorMIB + to ciscoEntitySensorMIB since ENTITY-SENSOR-MIB also + uses the same name and there is a conflict." + REVISION "200301070000Z" + DESCRIPTION + "[1] Add dBm(14) in SensorDataType." + + REVISION "200210160000Z" + DESCRIPTION + "[1] Add critical(30) in CSensorThresholdSeverity. + [2] Change to MAX-ACCESS read-write for 3 objects. + [3] Add entitySensorMIBComplianceV02." + + REVISION "200006200000Z" + DESCRIPTION + "Initial version of this MIB module." + + ::= { ciscoMgmt 91 } + +entitySensorMIBObjects + OBJECT IDENTIFIER ::= { ciscoEntitySensorMIB 1 } + +entitySensorMIBNotificationPrefix + OBJECT IDENTIFIER ::= { ciscoEntitySensorMIB 2 } + +entitySensorMIBConformance + OBJECT IDENTIFIER ::= { ciscoEntitySensorMIB 3 } + +-- textual conventions + +SensorDataType ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "sensor measurement data types. valid values are: + other(1): a measure other than those listed below + unknown(2): unknown measurement, or + arbitrary, relative numbers + voltsAC(3): electric potential + voltsDC(4): electric potential + amperes(5): electric current + watts(6): power + hertz(7): frequency + celsius(8): temperature + percentRH(9): percent relative humidity + rpm(10): shaft revolutions per minute + cmm(11),: cubic meters per minute (airflow) + truthvalue(12): value takes { true(1), false(2) } + specialEnum(13): value takes user defined enumerated values + dBm(14): dB relative to 1mW of power + " + SYNTAX INTEGER { + other(1), + unknown(2), + voltsAC(3), + voltsDC(4), + amperes(5), + watts(6), + hertz(7), + celsius(8), + percentRH(9), + rpm(10), + cmm(11), + truthvalue(12), + specialEnum(13), + dBm(14) + } + +SensorDataScale ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "International System of Units (SI) prefixes." + SYNTAX INTEGER { + yocto(1), -- 10^-24 + zepto(2), -- 10^-21 + atto(3), -- 10^-18 + femto(4), -- 10^-15 + pico(5), -- 10^-12 + nano(6), -- 10^-9 + micro(7), -- 10^-6 + milli(8), -- 10^-3 + units(9), -- 10^0 + kilo(10), -- 10^3 + mega(11), -- 10^6 + giga(12), -- 10^9 + tera(13), -- 10^12 + exa(14), -- 10^15 + peta(15), -- 10^18 + zetta(16), -- 10^21 + yotta(17) -- 10^24 + } + +SensorPrecision ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "When in the range 1 to 9, SensorPrecision is the number + of decimal places in the fractional part of + a SensorValue fixed-point number. When in the range -8 to + -1, SensorPrecision is the number of accurate digits in + a SensorValue fixed-point number. + + SensorPrecision is 0 for non-fixed-point numbers. + + Agent implementors must choose a value for SensorPrecision + so that the precision and accuracy of a SensorValue is + correctly indicated. + + For example, a temperature sensor that can measure 0o to + 100o C in 0.1o increments, +/- 0.05o, would have a + SensorPrecision of 1, a SensorDataScale of units(0), and a + SensorValue ranging from 0 to 1000. + The SensorValue would be interpreted as (degrees C * 10). + + If that temperature sensor's precision were 0.1o but its + accuracy were only +/- 0.5o, then the SensorPrecision would + be 0. The SensorValue would be interpreted as degrees C. + + Another example: a fan rotation speed sensor that measures RPM + from 0 to 10,000 in 100 RPM increments, with an accuracy of + +50/-37 RPM, would have a SensorPrecision of -2, a + SensorDataScale of units(9), and a SensorValue ranging from 0 + to 10000. The 10s and 1s digits of SensorValue would always + be 0. + " + SYNTAX INTEGER (-8..9) + +SensorValue ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "For sensors that measure voltsAC, voltsDC, + amperes, watts, hertz, celsius, cmm + this item is a fixed point number ranging from + -999,999,999 to +999,999,999. Use the value + -1000000000 to indicate underflow. Use the value + +1000000000 to indicate overflow. Use SensorPrecision + to indicate how many fractional digits the SensorValue + has. + + + For sensors that measure percentRH, this item + is a number ranging from 0 to 100. + + For sensors that measure rpm, this item + can take only nonnegative values, 0..999999999. + + For sensors of type truthvalue, this item + can take only two values: true(1), false(2). + + For sensors of type specialEnum, this item + can take any value in the range (-1000000000..1000000000), + but the meaning of each value is specific to the + sensor. + + For sensors of type other and unknown, + this item can take any value in the range + (-1000000000..1000000000), but the meaning of the values + are specific to the sensor. + + Use Entity-MIB entPhysicalTable.entPhysicalVendorType + to learn about the sensor type. + " + SYNTAX INTEGER (-1000000000..1000000000) + +SensorStatus ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "Indicates the operational status of the sensor. + + ok(1) means the agent can read the sensor + value. + + unavailable(2) means that the agent presently + can not report the sensor value. + + nonoperational(3) means that the agent believes + the sensor is broken. The sensor could have a + hard failure (disconnected wire), or a soft failure + such as out-of-range, jittery, or wildly fluctuating + readings. + " + SYNTAX INTEGER { + ok(1), + unavailable(2), + nonoperational(3) + } + +SensorValueUpdateRate ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "Indicates the interval in seconds between updates to the + sensor's value. + + The value zero indicates: + - the sensor value is updated on demand (when polled by the + agent for a get-request), + - or when the sensor value changes (event-driven), + - or the agent does not know the rate + + " + SYNTAX INTEGER (0..999999999) + +SensorThresholdSeverity ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "sensor threshold severity. Valid values are: + + other(1) : a severity other than those listed below. + minor(10) : Minor Problem threshold. + major(20) : Major Problem threshold. + critical(30): Critical problem threshold. A system might shut + down the sensor associated FRU automatically if + the sensor value reach the critical problem + threshold." + SYNTAX INTEGER { + other(1), + minor(10), + major(20), + critical(30) + } + +SensorThresholdRelation ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "sensor threshold relational operator types. valid values are: + + lessThan(1): if the sensor value is less than + the threshold value + lessOrEqual(2): if the sensor value is less than or equal to + the threshold value + greaterThan(3): if the sensor value is greater than + the threshold value + greaterOrEqual(4): if the sensor value is greater than or equal + to the threshold value + equalTo(5): if the sensor value is equal to + the threshold value + notEqualTo(6): if the sensor value is not equal to + the threshold value + " + SYNTAX INTEGER { + lessThan(1), + lessOrEqual(2), + greaterThan(3), + greaterOrEqual(4), + equalTo(5), + notEqualTo(6) + } + +-- +-- MIB variables +-- + +entSensorValues + OBJECT IDENTIFIER ::= { entitySensorMIBObjects 1 } + +entSensorThresholds + OBJECT IDENTIFIER ::= { entitySensorMIBObjects 2 } + +entSensorGlobalObjects + OBJECT IDENTIFIER ::= { entitySensorMIBObjects 3 } + +-- +-- entSensorValueTable +-- + +entSensorValueTable OBJECT-TYPE + SYNTAX SEQUENCE OF EntSensorValueEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This table lists the type, scale, and present value + of a sensor listed in the Entity-MIB entPhysicalTable." + ::= { entSensorValues 1 } + +entSensorValueEntry OBJECT-TYPE + SYNTAX EntSensorValueEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entSensorValueTable entry describes the + present reading of a sensor, the measurement units + and scale, and sensor operational status." + INDEX { entPhysicalIndex } + ::= { entSensorValueTable 1 } + +EntSensorValueEntry ::= SEQUENCE { + entSensorType SensorDataType, + entSensorScale SensorDataScale, + entSensorPrecision SensorPrecision, + entSensorValue SensorValue, + entSensorStatus SensorStatus, + entSensorValueTimeStamp TimeStamp, + entSensorValueUpdateRate SensorValueUpdateRate, + entSensorMeasuredEntity EntPhysicalIndexOrZero + } + +entSensorType OBJECT-TYPE + SYNTAX SensorDataType + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This variable indicates the type of data + reported by the entSensorValue. + + This variable is set by the agent at start-up + and the value does not change during operation." + ::= { entSensorValueEntry 1 } + +entSensorScale OBJECT-TYPE + SYNTAX SensorDataScale + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This variable indicates the exponent to apply + to sensor values reported by entSensorValue. + + This variable is set by the agent at start-up + and the value does not change during operation." + ::= { entSensorValueEntry 2 } + +entSensorPrecision OBJECT-TYPE + SYNTAX SensorPrecision + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This variable indicates the number of decimal + places of precision in fixed-point + sensor values reported by entSensorValue. + + This variable is set to 0 when entSensorType + is not a fixed-point type: voltsAC(1), voltsDC(2), + amperes(3), watts(4), hertz(5), celsius(6), or cmm(9). + + This variable is set by the agent at start-up + and the value does not change during operation." + ::= { entSensorValueEntry 3 } + +entSensorValue OBJECT-TYPE + SYNTAX SensorValue + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This variable reports the most recent measurement seen + by the sensor. + + To correctly display or interpret this variable's value, + you must also know entSensorType, entSensorScale, and + entSensorPrecision. + + However, you can compare entSensorValue with the threshold + values given in entSensorThresholdTable without any semantic + knowledge. + " + ::= { entSensorValueEntry 4 } + +entSensorStatus OBJECT-TYPE + SYNTAX SensorStatus + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This variable indicates the present operational status + of the sensor." + ::= { entSensorValueEntry 5 } + +entSensorValueTimeStamp OBJECT-TYPE + SYNTAX TimeStamp + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This variable indicates the age of the value reported by + entSensorValue" + ::= { entSensorValueEntry 6 } + +entSensorValueUpdateRate OBJECT-TYPE + SYNTAX SensorValueUpdateRate + UNITS "seconds" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This variable indicates the rate that the agent + updates entSensorValue." + ::= { entSensorValueEntry 7 } + +entSensorMeasuredEntity OBJECT-TYPE + SYNTAX EntPhysicalIndexOrZero + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This object identifies the physical entity for which the + sensor is taking measurements. For example, for a sensor + measuring the voltage output of a power-supply, this object + would be the entPhysicalIndex of that power-supply; for a sensor + measuring the temperature inside one chassis of a multi-chassis + system, this object would be the enPhysicalIndex of that + chassis. + + This object has a value of zero when the physical entity + for which the sensor is taking measurements can not be + represented by any one row in the entPhysicalTable, or that + there is no such physical entity." + ::= { entSensorValueEntry 8 } + + +-- +-- entSensorThresholdTable +-- + +entSensorThresholdTable OBJECT-TYPE + SYNTAX SEQUENCE OF EntSensorThresholdEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This table lists the threshold severity, relation, and + comparison value, for a sensor listed in the Entity-MIB + entPhysicalTable." + ::= { entSensorThresholds 1 } + +entSensorThresholdEntry OBJECT-TYPE + SYNTAX EntSensorThresholdEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entSensorThresholdTable entry describes the + thresholds for a sensor: the threshold severity, + the threshold value, the relation, and the + evaluation of the threshold. + + Only entities of type sensor(8) are listed in this table. + Only pre-configured thresholds are listed in this table. + + Users can create sensor-value monitoring instruments + in different ways, such as RMON alarms, Expression-MIB, etc. + + Entries are created by the agent at system startup and + FRU insertion. Entries are deleted by the agent at + FRU removal." + INDEX { entPhysicalIndex, entSensorThresholdIndex } + ::= { entSensorThresholdTable 1 } + +EntSensorThresholdEntry ::= SEQUENCE { + entSensorThresholdIndex Integer32, + entSensorThresholdSeverity SensorThresholdSeverity, + entSensorThresholdRelation SensorThresholdRelation, + entSensorThresholdValue SensorValue, + entSensorThresholdEvaluation TruthValue, + entSensorThresholdNotificationEnable TruthValue + } + +entSensorThresholdIndex OBJECT-TYPE + SYNTAX Integer32 (1..99999999) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An index that uniquely identifies an entry + in the entSensorThresholdTable. This index + permits the same sensor to have several + different thresholds." + ::= { entSensorThresholdEntry 1 } + +entSensorThresholdSeverity OBJECT-TYPE + SYNTAX SensorThresholdSeverity + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "This variable indicates the severity of this threshold." + ::= { entSensorThresholdEntry 2 } + +entSensorThresholdRelation OBJECT-TYPE + SYNTAX SensorThresholdRelation + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "This variable indicates the relation between sensor value + (entSensorValue) and threshold value (entSensorThresholdValue), + required to trigger the alarm. when evaluating the relation, + entSensorValue is on the left of entSensorThresholdRelation, + entSensorThresholdValue is on the right. + + in pseudo-code, the evaluation-alarm mechanism is: + + ... + if (entSensorStatus == ok) then + if (evaluate(entSensorValue, entSensorThresholdRelation, + entSensorThresholdValue)) + then + if (entSensorThresholdNotificationEnable == true)) + then + raise_alarm(sensor's entPhysicalIndex); + endif + endif + endif + ... + " + ::= { entSensorThresholdEntry 3 } + +entSensorThresholdValue OBJECT-TYPE + SYNTAX SensorValue + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "This variable indicates the value of the threshold. + + To correctly display or interpret this variable's value, + you must also know entSensorType, entSensorScale, and + entSensorPrecision. + + However, you can directly compare entSensorValue + with the threshold values given in entSensorThresholdTable + without any semantic knowledge. + " + ::= { entSensorThresholdEntry 4 } + +entSensorThresholdEvaluation OBJECT-TYPE + SYNTAX TruthValue + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This variable indicates the result of the most + recent evaluation of the threshold. If the threshold + condition is true, entSensorThresholdEvaluation + is true(1). If the threshold condition is false, + entSensorThresholdEvaluation is false(2). + + Thresholds are evaluated at the rate indicated by + entSensorValueUpdateRate. + " + ::= { entSensorThresholdEntry 5 } + +entSensorThresholdNotificationEnable OBJECT-TYPE + SYNTAX TruthValue + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "This variable controls generation of + entSensorThresholdNotification for this threshold. + + When this variable is 'true', generation of + entSensorThresholdNotification is enabled for this + threshold. When this variable is 'false', + generation of entSensorThresholdNotification is + disabled for this threshold. + " + ::= { entSensorThresholdEntry 6 } + +-- +-- Entity Sensor Global Objects +-- + + entSensorThreshNotifGlobalEnable OBJECT-TYPE + SYNTAX TruthValue + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "This variable enables the generation of + entSensorThresholdNotification globally + on the device. If this object value is + 'false', then no entSensorThresholdNotification + will be generated on this device. If this object + value is 'true', then whether a + entSensorThresholdNotification for a threshold will + be generated or not depends on the instance value of + entSensorThresholdNotificationEnable for that + threshold. + " + ::= { entSensorGlobalObjects 1} + +-- +-- notifications +-- + +entitySensorMIBNotifications + OBJECT IDENTIFIER ::= { entitySensorMIBNotificationPrefix 0 } + +entSensorThresholdNotification NOTIFICATION-TYPE + OBJECTS { entSensorThresholdValue, entSensorValue } + STATUS current + DESCRIPTION + "The sensor value crossed the threshold + listed in entSensorThresholdTable. + + This notification is generated once each time + the sensor value crosses the threshold. + + The agent implementation guarantees prompt, timely + evaluation of threshold and generation of this + notification. + " + ::= { entitySensorMIBNotifications 1 } + + +-- +-- conformance information +-- + +entitySensorMIBCompliances + OBJECT IDENTIFIER ::= { entitySensorMIBConformance 1 } + +entitySensorMIBGroups + OBJECT IDENTIFIER ::= { entitySensorMIBConformance 2 } + +-- +-- compliance statements +-- + +entitySensorMIBComplianceV01 MODULE-COMPLIANCE + STATUS deprecated + DESCRIPTION + "An Entity-MIB implementation that lists + sensors in its entPhysicalTable must implement + this group." + MODULE -- this module + MANDATORY-GROUPS { + entitySensorValueGroup, + entitySensorThresholdGroup, + entitySensorThresholdNotificationGroup + } + ::= { entitySensorMIBCompliances 1 } + + +entitySensorMIBComplianceV02 MODULE-COMPLIANCE + STATUS deprecated + DESCRIPTION + "An Entity-MIB implementation that lists + sensors in its entPhysicalTable must implement + this group." + MODULE -- this module + MANDATORY-GROUPS { + entitySensorThresholdGroup + } + GROUP entitySensorValueGroup + DESCRIPTION + "This group is mandatory for the systems which don't + support IETF version of ENTITY-SENSOR-MIB." + + GROUP entitySensorThresholdNotificationGroup + DESCRIPTION + "This group is mandatory for the systems which support + entitySensorValueGroup group." + + OBJECT entSensorThresholdSeverity + MIN-ACCESS read-only + DESCRIPTION + " Write access is not required." + + OBJECT entSensorThresholdRelation + MIN-ACCESS read-only + DESCRIPTION + " Write access is not required." + + OBJECT entSensorThresholdValue + MIN-ACCESS read-only + DESCRIPTION + " Write access is not required." + + ::= { entitySensorMIBCompliances 2 } + +entitySensorMIBComplianceV03 MODULE-COMPLIANCE + STATUS deprecated + DESCRIPTION + "An Entity-MIB implementation that lists + sensors in its entPhysicalTable must implement + this group." + MODULE -- this module + MANDATORY-GROUPS { + entitySensorThresholdGroup + } + GROUP entitySensorValueGroup + DESCRIPTION + "This group is mandatory for the systems which don't + support IETF version of ENTITY-SENSOR-MIB." + + GROUP entitySensorThresholdNotificationGroup + DESCRIPTION + "This group is mandatory for the systems which support + entitySensorValueGroup group." + + GROUP entitySensorValueGroupSup1 + DESCRIPTION + "This group is mandatory for the systems which support + the correlation between sensor and its measured + physical entity." + + OBJECT entSensorThresholdSeverity + MIN-ACCESS read-only + DESCRIPTION + " Write access is not required." + + OBJECT entSensorThresholdRelation + MIN-ACCESS read-only + DESCRIPTION + " Write access is not required." + + OBJECT entSensorThresholdValue + MIN-ACCESS read-only + DESCRIPTION + " Write access is not required." + + ::= { entitySensorMIBCompliances 3 } + +entitySensorMIBComplianceV04 MODULE-COMPLIANCE + STATUS current + DESCRIPTION + "An Entity-MIB implementation that lists + sensors in its entPhysicalTable must implement + this group." + MODULE -- this module + MANDATORY-GROUPS { + entitySensorThresholdGroup + } + GROUP entitySensorValueGroup + DESCRIPTION + "This group is mandatory for the systems which don't + support IETF version of ENTITY-SENSOR-MIB." + + GROUP entitySensorThresholdNotificationGroup + DESCRIPTION + "This group is mandatory for the systems which support + entitySensorValueGroup group." + + GROUP entitySensorValueGroupSup1 + DESCRIPTION + "This group is mandatory for the systems which support + the correlation between sensor and its measured + physical entity." + + OBJECT entSensorThresholdSeverity + MIN-ACCESS read-only + DESCRIPTION + " Write access is not required." + + OBJECT entSensorThresholdRelation + MIN-ACCESS read-only + DESCRIPTION + " Write access is not required." + + OBJECT entSensorThresholdValue + MIN-ACCESS read-only + DESCRIPTION + " Write access is not required." + + GROUP entitySensorNotifCtrlGlobalGroup + DESCRIPTION + "This group is mandatory for the platforms which support + global notification control on + entSensorThresholdNotification." + + ::= { entitySensorMIBCompliances 4 } + +-- +-- units of conformance +-- + +entitySensorValueGroup OBJECT-GROUP + OBJECTS { + entSensorType, + entSensorScale, + entSensorPrecision, + entSensorValue, + entSensorStatus, + entSensorValueTimeStamp, + entSensorValueUpdateRate + } + STATUS current + DESCRIPTION + "The collection of objects which are used + to describe and monitor values of Entity-MIB + entPhysicalTable entries of sensors. + " + ::= { entitySensorMIBGroups 1 } + +entitySensorThresholdGroup OBJECT-GROUP + OBJECTS { + entSensorThresholdSeverity, + entSensorThresholdRelation, + entSensorThresholdValue, + entSensorThresholdEvaluation, + entSensorThresholdNotificationEnable + } + STATUS current + DESCRIPTION + "The collection of objects which are used + to describe and monitor thresholds for + sensors." + ::= { entitySensorMIBGroups 2 } + + +entitySensorThresholdNotificationGroup NOTIFICATION-GROUP + NOTIFICATIONS { entSensorThresholdNotification } + STATUS current + DESCRIPTION + "the collection of notifications used for + monitoring sensor threshold activity." + ::= { entitySensorMIBGroups 3 } + +entitySensorValueGroupSup1 OBJECT-GROUP + OBJECTS { + entSensorMeasuredEntity + } + STATUS current + DESCRIPTION + "The collection of objects which are used to describe and track + the measured entities of ENTITY-MIB entPhysicalTable." + ::= { entitySensorMIBGroups 4 } + +entitySensorNotifCtrlGlobalGroup OBJECT-GROUP + OBJECTS { + entSensorThreshNotifGlobalEnable + } + STATUS current + DESCRIPTION + "The collection of objects which provide the global + notification control on entSensorThresholdNotification." + ::= { entitySensorMIBGroups 5 } + + +END diff --git a/process-syslog.php b/process-syslog.php index 7c74057c2..e44ff41cf 100755 --- a/process-syslog.php +++ b/process-syslog.php @@ -6,6 +6,8 @@ include("includes/functions.php"); mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `msg` LIKE '%last message repeated%'"); mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `msg` LIKE '%Connection from UDP: [%]:%'"); +mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `program` LIKE 'Traceback%'"); + if(!$config['enable_syslog']) { diff --git a/test-discovery.php b/test-discovery.php index 719573c67..61b3585e2 100755 --- a/test-discovery.php +++ b/test-discovery.php @@ -42,7 +42,7 @@ $devices_polled = 0; $device_query = mysql_query("SELECT * FROM `devices` WHERE status = '1' $where ORDER BY device_id DESC"); while ($device = mysql_fetch_array($device_query)) { - echo($device['hostname'] ."\n"); + echo("\n" . $device['hostname'] ."\n"); include("includes/discovery/".$type.".php"); # include("includes/discovery/ipv6-addresses.php"); diff --git a/test-poll.php b/test-poll.php new file mode 100755 index 000000000..3d0389e66 --- /dev/null +++ b/test-poll.php @@ -0,0 +1,58 @@ +#!/usr/bin/php + Poll single device\n"); + echo("--os