From b546061d8c4af2a9a2d09a246aa4ec8d8c565daf Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Tue, 29 Dec 2009 15:19:46 +0000 Subject: [PATCH] more fixes (thanks sid3windr) git-svn-id: http://www.observium.org/svn/observer/trunk@571 61d68cd4-352d-0410-923a-c4978735b2b8 --- includes/discovery/temperatures.php | 30 +++- includes/static-config.php | 9 +- mibs/SUPERMICRO-HEALTH-MIB.mib | 246 ++++++++++++++++++++++++++++ mibs/SUPERMICRO-SMI.mib | 55 +++++++ 4 files changed, 333 insertions(+), 7 deletions(-) create mode 100644 mibs/SUPERMICRO-HEALTH-MIB.mib create mode 100644 mibs/SUPERMICRO-SMI.mib diff --git a/includes/discovery/temperatures.php b/includes/discovery/temperatures.php index 69c50194dd..93f6ad28df 100755 --- a/includes/discovery/temperatures.php +++ b/includes/discovery/temperatures.php @@ -90,6 +90,33 @@ } }## End Dell Sensors + ## Supermicro Temperatures + if($device['os'] == "linux") { + echo("Supermicro "); + $oids = shell_exec($config['snmpwalk'] . " -m SUPERMICRO-HEALTH-MIB -$snmpver -CI -Osqn -c $community $hostname:$port 1.3.6.1.4.1.10876.2.1.1.1.1.3 | sed s/1.3.6.1.4.1.10876.2.1.1.1.1.3.//g"); + $oids = trim($oids); + foreach(explode("\n", $oids) as $data) { + $data = trim($data); + if($data) { + list($oid,$type) = explode(" ", $data); + if ($type == 2) + { + $temp_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.4$oid"; + $descr_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.2$oid"; + $descr = shell_exec($config['snmpget'] . " -m SUPERMICRO-HEALTH-MIB -O qv -$snmpver -c $community $hostname:$port $descr_oid"); + $temp = shell_exec($config['snmpget'] . " -m SUPERMICRO-HEALTH-MIB -O qv -$snmpver -c $community $hostname:$port $temp_oid"); + $descr = str_ireplace("temperature", "", $descr); + $descr = trim($descr); + if(mysql_result(mysql_query("SELECT count(temp_id) FROM `temperature` WHERE temp_oid = '$temp_oid' AND temp_host = '$id'"),0) == '0') { + $query = "INSERT INTO temperature (`temp_host`, `temp_oid`, `temp_descr`) values ('$id', '$temp_oid', '$descr')"; + mysql_query($query); + echo("+"); + } else { echo("."); } + $temp_exists[] = "$id $temp_oid"; + } + } + } + } ## End Supermicro Temperatures ## Cisco Temperatures if($device['os_type'] == "ios") { @@ -105,12 +132,11 @@ $descr = shell_exec($config['snmpget'] . " -m CISCO-ENVMON-MIB -O qv -$snmpver -c $community $hostname:$port $descr_oid"); $temp = shell_exec($config['snmpget'] . " -m CISCO-ENVMON-MIB -O qv -$snmpver -c $community $hostname:$port $temp_oid"); if(!strstr($descr, "No") && !strstr($temp, "No") && $descr != "" ) { - $descr = shell_exec($config['snmpget'] . " -m CISCO-ENVMON-MIB -O qv -$snmpver -c $community $hostname:$port $descr_oid"); $descr = str_replace("\"", "", $descr); $descr = str_replace("temperature", "", $descr); $descr = str_replace("temp", "", $descr); $descr = trim($descr); - if(mysql_result(mysql_query("SELECT count(temp_id) FROM `temperature` WHERE temp_oid = '.1.3.6.1.4.1.9.9.13.1.3.1.3.$oid' AND temp_host = '$id'"),0) == '0') { + if(mysql_result(mysql_query("SELECT count(temp_id) FROM `temperature` WHERE temp_oid = '$temp_oid' AND temp_host = '$id'"),0) == '0') { $query = "INSERT INTO temperature (`temp_host`, `temp_oid`, `temp_descr`) values ('$id', '$temp_oid', '$descr')"; mysql_query($query); echo("+"); diff --git a/includes/static-config.php b/includes/static-config.php index 814ecfe758..5500be472c 100644 --- a/includes/static-config.php +++ b/includes/static-config.php @@ -77,11 +77,10 @@ $config['rrd_opts_array'] = explode(" ", trim($config['rrdgraph_def_text'])); # print_r($config['rrd_opts_array']); if($config['enable_nagios']) { - -$nagios_link = mysql_connect($config['nagios_db_host'], $config['nagios_db_user'], $config['nagios_db_pass']); -if (!$nagios_link) { - echo "

Nagios MySQL Error

"; - die; + $nagios_link = mysql_connect($config['nagios_db_host'], $config['nagios_db_user'], $config['nagios_db_pass']); + if (!$nagios_link) { + echo "

Nagios MySQL Error

"; + die; } $nagios_db = mysql_select_db($config['nagios_db_name'], $nagios_link); diff --git a/mibs/SUPERMICRO-HEALTH-MIB.mib b/mibs/SUPERMICRO-HEALTH-MIB.mib new file mode 100644 index 0000000000..787921d3bb --- /dev/null +++ b/mibs/SUPERMICRO-HEALTH-MIB.mib @@ -0,0 +1,246 @@ +-- ***************************************************************** +-- SUPERMICRO-SMI.mib: Super Micro Enterprise Structure of Management Information +-- +-- October 26 2001, Software LAB +-- +-- Copyright (c) 1993-2001 by Super Micro Computer Inc. +-- All rights reserved. +-- +-- ***************************************************************** + +SUPERMICRO-HEALTH-MIB DEFINITIONS ::= BEGIN + +IMPORTS + MODULE-IDENTITY, + OBJECT-TYPE, + Integer32, + Gauge32 + FROM SNMPv2-SMI + TEXTUAL-CONVENTION, + DisplayString, + TruthValue + FROM SNMPv2-TC + MODULE-COMPLIANCE, + OBJECT-GROUP + FROM SNMPv2-CONF + smHealth + FROM SUPERMICRO-SMI; + +smHealthMIB MODULE-IDENTITY + LAST-UPDATED "200110260000Z" + ORGANIZATION "Super Micro Computer Inc." + CONTACT-INFO + " Software Lab + + Postal: 980 Rock Avenue + San Jose, CA 95131 + USA + + Tel: +1 408 503 8000 + + E-mail: SoftLab@supermicro.com" + DESCRIPTION + "MIB module for monitoring health information" + ::= { smHealth 1 } + +SMHealthInfoTypes ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "Represents the different types of health information that + may be present in a managed device. The following health + information types are currently predefined: + 0: fan speed + 1: voltage + 2: temperature + " + SYNTAX Integer32 (0..64) + +smHealthObjects OBJECT IDENTIFIER ::= { smHealthMIB 1 } + +smHealthMonitorTable OBJECT-TYPE + SYNTAX SEQUENCE OF SMHealthMonitorEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A table of health monitoring entries." + ::= { smHealthObjects 1 } + +-- ================ +smHealthMonitorEntry OBJECT-TYPE + SYNTAX SMHealthMonitorEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry in the health monitoring table. + Entries cannot be created or deleted via SNMP operations." + INDEX { smHealthMonitorIndex } + ::= { smHealthMonitorTable 1 } + +SMHealthMonitorEntry ::= + SEQUENCE { + smHealthMonitorIndex Integer32, + smHealthMonitorName DisplayString, + smHealthMonitorType SMHealthInfoTypes, + smHealthMonitorReading Integer32, + smHealthMonitorHighLimit Integer32, + smHealthMonitorLowLimit Integer32, + smHealthMonitorMaxReading Integer32, + smHealthMonitorMinReading Integer32, + smHealthMonitorDivisor Integer32, + smHealthMonitorMonitor TruthValue + } + +smHealthMonitorIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The unique value which identifies this Monitor device." + ::= { smHealthMonitorEntry 1 } + +smHealthMonitorName OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A textual full name assigned to the Monitor device. + This object is suitable for output to a human operator." + ::= { smHealthMonitorEntry 2 } + +smHealthMonitorType OBJECT-TYPE + SYNTAX SMHealthInfoTypes + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Identifies this Monitor device type." + ::= { smHealthMonitorEntry 3 } + +smHealthMonitorReading OBJECT-TYPE + SYNTAX Integer32 (0..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Indicates the value from the Monitor device that are + currently in use on the managed device. + FAN reading is in unit of RPM, + Voltage reading is in unit of mV, + Temperture reading is in unit of degree C" + ::= { smHealthMonitorEntry 4 } + +smHealthMonitorHighLimit OBJECT-TYPE + SYNTAX Integer32 (0..65535) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Indicates the value for the High limitation + for the Monitor device that are currently in use on the + managed device. + Apply to Temperature and Voltage deivces only. + Voltage limit is in unit of mV, + Temperture limit is in unit of degree C" + ::= { smHealthMonitorEntry 5 } + +smHealthMonitorLowLimit OBJECT-TYPE + SYNTAX Integer32 (0..65535) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Indicates the value for the Low limitation + for the Monitor device that are currently in use on the + managed device. + FAN limit is in unit of RPM, + Voltage limit is in unit of mV, + Temperture limit is in unit of degree C" + ::= { smHealthMonitorEntry 6 } + +smHealthMonitorMaxReading OBJECT-TYPE + SYNTAX Integer32 (0..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Indicates the value for the possible Maximum reading value + for the Monitor device that are currently in use on the + managed device. + FAN reading is in unit of RPM, + Voltage reading is in unit of mV, + Temperture reading is in unit of degree C" + ::= { smHealthMonitorEntry 7 } + +smHealthMonitorMinReading OBJECT-TYPE + SYNTAX Integer32 (0..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Indicates the value for the possible Minimum reading value + for the Monitor device that are currently in use on the + managed device. + FAN reading is in unit of RPM, + Voltage reading is in unit of mV, + Temperture reading is in unit of degree C" + ::= { smHealthMonitorEntry 8 } + +smHealthMonitorDivisor OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Indicates the value for the Divisor for the Fan + device that are currently in use on the managed device. + Apply to Fan devices only." + ::= { smHealthMonitorEntry 9 } + +smHealthMonitorMonitor OBJECT-TYPE + SYNTAX TruthValue + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Indicates the monitoring status for the Fan device + that are currently in use on the managed device. + 1 = monitor, 2=do not monitor" + ::= { smHealthMonitorEntry 10 } + +-- notifications + +smHealthNotifications OBJECT IDENTIFIER ::= { smHealthMIB 2 } + +-- (no notifications are currently defined) + + +-- conformance information + +smHealthConformance OBJECT IDENTIFIER ::= { smHealthMIB 3 } +smHealthCompliances OBJECT IDENTIFIER ::= { smHealthConformance 1 } +smHealthGroups OBJECT IDENTIFIER ::= { smHealthConformance 2 } + + +-- compliance statements + +smHealthCompliance MODULE-COMPLIANCE + STATUS current + DESCRIPTION + "The compliance statement for entities which implement + the Supermicro Health Monitoring MIB" + MODULE -- this module + MANDATORY-GROUPS { smHealthMonitorGroup} + ::= { smHealthCompliances 1 } + + +-- units of conformance + +smHealthMonitorGroup OBJECT-GROUP + OBJECTS { + smHealthMonitorType, + smHealthMonitorName, + smHealthMonitorReading, + smHealthMonitorHighLimit, + smHealthMonitorLowLimit, + smHealthMonitorMaxReading, + smHealthMonitorMinReading, + smHealthMonitorMonitor + } + STATUS current + DESCRIPTION + "A collection of objects providing Monitor devices." + ::= { smHealthGroups 1 } + +END diff --git a/mibs/SUPERMICRO-SMI.mib b/mibs/SUPERMICRO-SMI.mib new file mode 100644 index 0000000000..875107a831 --- /dev/null +++ b/mibs/SUPERMICRO-SMI.mib @@ -0,0 +1,55 @@ +-- SUPERMICRO-SMI.mib: Super Micro Enterprise Structure of Management Information +-- +-- October 1995, Software LAB +-- +-- Copyright (c) 1993-2001 by Super Micro Computer Inc. +-- All rights reserved. +-- +-- ***************************************************************** +-- + +SUPERMICRO-SMI DEFINITIONS ::= BEGIN + +IMPORTS + MODULE-IDENTITY, + OBJECT-IDENTITY, + enterprises + FROM SNMPv2-SMI; + +supermicro MODULE-IDENTITY + LAST-UPDATED "200110260000Z" + ORGANIZATION "Super Micro Computer Inc." + CONTACT-INFO + " Software Lab + + Postal: 980 Rock Avenue + San Jose, CA 95131 + USA + + Tel: +1 408 503 8000 + + E-mail: SoftLab@supermicro.com" + DESCRIPTION + "The Structure of Management Information for the + Super Micro enterprise." + REVISION "200110260000Z" + DESCRIPTION + "Initial version of this MIB module." + ::= { enterprises 10876 } -- assigned by IANA + + +smProducts OBJECT-IDENTITY + STATUS current + DESCRIPTION + "smProducts is the root OBJECT IDENTIFIER from + which sysObjectID values are assigned. Actual + values are defined in SUPERMICRO-PRODUCTS-MIB." + ::= { supermicro 1 } + +smHealth OBJECT-IDENTITY + STATUS current + DESCRIPTION + "smHealth is the main subtree for new mib development." + ::= { supermicro 2 } + +END