Supermicro SuperoDoctor Sensor Readings
I try to monitor as many of the motherboard sensors as possible, since they often reveal a variety of hidden problems. Unfortunately, there is not a single universal source of motherboard sensor data available, so I have had to write multiple script templates that each pull sensor readings from device-specific sources, and then make them look and feel the same inside Cacti. This specific script template is for the SuperoDoctor package that is typically included with Supermicro motherboards, as exposed through an SNMP agent on the host operating system (either Net-SNMP on Linux, or Microsoft SNMP on Windows). I have tested this with SuperoDoctor III running on Windows Server 2003 and SuperoDoctor II on Linux, and both seem to work correctly.
Specifically, the Supermicro sensors are stored in a single shared SNMP table, with each sensor having a "type" code that indicates the kind of sensor it represents (ie, a Fan, or a temperature probe, or a voltage sensor). In order to integrate these sensors into Cacti in a meaningful way, this script template uses a script that separates the sensors according to their type, and then presents those sensors to the user separately.
For illustration purposes, the graph in the figure at right shows six active fan sensors on a Supermicro PDSME+ motherboard running openSUSE with the SuperoDoctor II extensions. Additional graphs show two temperature sensors and eight voltage sensors.
To use this script template, perform the following steps:
- Download the appropriate edition of SuperoDoctor from the Supermicro FTP site (Linux systems need to use SuperoDoctor II, while Windows systems need to use SuperoDoctor III). Enable the SNMP extensions per the instructions, and verify that the agent is listening by using the snmpwalk utility on the Cacti server to search for all MIBs under the 126.96.36.199.4.1.108188.8.131.52.1.1 branch on the target device.
- Download cacti-supermicro-sensors.0.7.tar.gz to a temporary directory on the Cacti server machine.
- Expand the archive with the command
tar -xvzf cacti-supermicro-sensors.0.7.tar.gz, and change to the cacti-supermicro-sensors directory that is created.
- Copy scripts/ss_supermicro_sensors.php to the <cacti>/scripts/ directory.
- If the server is running Cacti 0.8.6, copy the XML files in resource/0.8.6/ to the <cacti>/resource/script_server/ directory, or if the server is running Cacti 0.8.7, copy the XML files in resource/0.8.7/ to the <cacti>/resource/script_server/ directory.
- Access the Cacti installation in a web browser, click on the "Import Templates" menu item on the left side of the Console screen, open the templates folder, and import the three data query templates. Cacti should automatically create the required data templates, data input methods, graph templates, and data queries.
- Click on the "Data Queries" menu item on the left side of the Console screen and verify that a "Supermicro - Fan Sensors" data query is present. Click the name of the object and verify that Cacti was able to locate and read the XML resource file. Repeat this process for the Thermal and Voltage data queries.
- Click on the Devices menu item on the left side of the Console screen, select a device that is running the SuperoDoctor extension, and scroll down to the "Associated Data Queries" table at the bottom of the screen. Select "Supermicro - Fan Sensors" in the "Add Data Query" drop-down box, and click the "Add" button. Repeat this step for the Thermal and Voltage data queries.
- After the Device screen reloads, verify that the data queries added in step 8 above are present, and then click the "Create Graphs for this Host" link at the top of the page.
- Once the screen finishes loading, locate the "Supermicro - Fan Sensors" data query, which should be similar to the figure at right. Select the sensors that you want to monitor, and click the "Create" button at the bottom of the screen to include them in the polling process. Repeat this process for the Thermal and Voltage data queries as desired.
Note: these files are intended to be used with Cacti 0.8.6 and 0.8.7 and PHP 5.2, and may not operate as expected with other versions.
The process described above will result in each sensor device having its own graph. If you would like to consolidate multiple sensors of a specific type into a single graph, the tarfile includes graph templates that can be used to pull readings from each of the individual data sources simultaneously, although some editing will likely be required. To use these graph templates, perform the following steps:
- Access the Cacti installation in a web browser, click on the "Import Templates" menu item on the left side of the Console screen, open the templates folder, and import the three "8x" graph templates. If you encounter the error "(GPRINT Preset) Exact Numbers" during the import process, you will need to take the following corrective action:
- If you are running an older version of Cacti 0.8.6, you may need to create the Exact Numbers GPRINT manually. To do so, click on the Graph Management menu item on the left side of the Console screen, and then click on the GPRINT Presets sub-menu item. Create a GPRINT Preset with the name of "Exact Numbers" and the Text value of "%8.0lf". After the GPRINT has been created, you can try to import the 8x graph templates again.
- Sometimes the graph items can become disassociated from the data source placeholders during the import process. To investigate if this is the problem, click on the "Graph Templates" menu item on the left side of the Console screen, open the 8x templates that caused the error to be reported, scroll down to the "Graph Item Inputs" section, and click on the top entry. The screen should reload with all of the graph items enumerated, and the top five graph items should have their selection boxes enabled (thereby indicating that they are associated with this entry). If the selection boxes for the top five items are not enabled, manually enable them and save the changes. Repeat this process for all of the graph items to ensure that all of the graph items are correctly associated with a data source.
- If you have exactly eight sensors of a specific type, you do not need to edit the associated graph template. However, if you have less than eight sensors of a specific type, you will need to create a copy of the associated graph template that refers to the exact number of sensors available. Similarly, if you have more than eight sensors of a specfic type, you will need to spread them across two or more consolidated graphs, and would need to create copies of the associated graph template that contain the necessary number of data sources that total the cumulative number of sensors available. To create copies of the graph template(s), click the "Graph Templates" menu item on the left side of the Console screen. For each copy, select the appropriate 8x graph template in the list, choose "Duplicate" in the drop-down list at the bottom of the screen, and then click the "Go" button. You will then need to edit each copy, delete any individual graph items that reference unused data sources, and assign a new name to the graph template.
- Once the appropriate-sized graph templates have been created, click the "Graph Management" menu item on the left side of the Console screen. Once the resulting screen finishes loading, click the "Add" button in the upper right corner to create a new consolidated graph.
- Locate the appropriate graph template from the "Selected Graph Template" drop-down list, then choose the target device from the "Host" drop-down list, and then click the "Create" button to proceed.
- In the resulting screen, you will be presented with a list of the data source entries in the graph template, and given the opportunity to match each data source entry with a data source from the device. Each of the device-specific data sources were created when the individual sensors were selected for monitoring, so each sensor that is currently being monitored has its own discrete data source that can be incorporated into the consolidated graph. Choose the data sources that you would like to incorporate, and then click the "Save" button when finished.
- After the graph has been created, click on the "Graph Management" menu item on the left side of the Console screen, and verify that the graph you have just created is shown in the list. If you would like to use only the consolidated graph, you may also delete the individual sensor-specific graphs from this screen. If you do this, however, do not delete the data sources associated with the individual graphs, as those will still be needed for the consolidated graph.
Script Input and Output
In some cases you may want to execute the script file manually for debugging purposes. The parameters to the script use a fixed structure that is optimized for use with the Cacti poller, but also allows for human interaction. In particular, the script uses three parameter groups, with the exact structure depending on the SNMP version in use and the output that is desired.
The first parameter group provides an SNMP protocol "bundle" of the following values, separated by colon characters: In those cases where a value is unneeded (such as SNMP v3 authentication credentials for an SNMP v2 query), or where a default value is adequate (such as the SNMP port number), the value can be omitted.
- hostname: The domain name or IP address of the target device. This value is mandatory.
- version: The version of SNMP to use. The remaining parameter values will be verified against this value, and is mandatory.
- community: The SNMP community string to use. If version 1 or 2 was specified, the community string must be provided. If version 3 was specified, this value will be ignored.
- v3 username: Part of the credentials for SNMP v3 queries. If version 1 or 2 was specified, this value will be ignored.
- v3 password : Part of the credentials for SNMP v3 queries. If version 1 or 2 was specified, this value will be ignored.
- v3 authentication protocol : Part of the credentials for SNMP v3 queries. If version 1 or 2 was specified, this value will be ignored.
- v3 privilege password : Part of the credentials for SNMP v3 queries. If version 1 or 2 was specified, this value will be ignored.
- v3 privilige protocol : Part of the credentials for SNMP v3 queries. If version 1 or 2 was specified, this value will be ignored.
- v3 authentication context : Part of the credentials for SNMP v3 queries. If version 1 or 2 was specified, this value will be ignored.
- port number: The UDP port number for the SNMP daemon on the target device. If a value is not specified, the default value of "161" will be used.
- timeout: The number of seconds to wait for the SNMP query to be executed. If a value is not specified, the Cacti configuration will be read for a locally-defined default value.
Taken as a whole, a valid SNMP bundle for the localhost device using SNMP v2 with the community string of "public" on the default port number and a default timeout would be "localhost:2:public::::::::".
The next parameter identifies the sensor type for the queries. The sensor type must be specified as either "fan", "temperature" or "voltage". The sensor type is needed in order to locate the correct data, and is also used to normalize some types of response strings, and as such must always be specified.
The next parameter identifies the type of Cacti data that is being requested. Cacti uses "index" queries to enumerate all of the entries for a data query template, and then uses various kinds of "query" queries to obtain extended information about those entries (such as the full name of each indexed entry). Separately, the Cacti poller uses "get" queries to fetch the readings for each specific entry (again, keyed by index value). Note that he index and query operations are typically only performed when the device entry is being created or modified, and the get operations provide the actual readings to the poller. This script parameter must be one of those query types, with any remaining parameters providing any necessary supplemental data. Specifically the request parameters are one of the following:
- index: This request asks for a list of sensor device identifiers. No additional input data is needed. The response data is provided as a series of index values, with each sensor being enumerated on a separate response line.
- query <fieldname>: This request asks for the specified field data associated with each sensor device. The response data is provided as "index:data" pairs, where the index value is the primary device identifier, and the data value is the requested field data as available.
- get <fieldname> <sensor>: This request asks for the specified field data associated with the specified sensor device. The requested data is provided by itself with no other accompanying information.
The field names that can be used in "query" or "get" requests are as follows:
- sensordevice: The index value for the sensor(s).
- sensorname: The human-friendly name for the sensor(s).
- sensorreading: The current reading for the sensor(s). For example, "12" volts, or "2300" RPMs.
You must know the index value that has been assigned to a device before you can query for information about that device. If you want to obtain the readings for a specific sensor, you can use the "query sensorname" request to get a list of sensors and their descriptions, and then use the "get sensorreading <sensor>" request to get the reading for the desired sensor. The full command lines for these requests, using example data from above, are shown below:
$ php ss_supermicro_sensors.php hostname:2:public:::::::: voltage query sensorname 7:CPU Core Voltage 8:-12V Voltage 9:DIMM Voltage 10:+3.3V Voltage 11:+12V Voltage 12:+5V Voltage 13:+5Vsb Voltage 14:VBAT Voltage $ php ss_supermicro_sensors.php hostname:2:public:::::::: voltage get sensorreading 7 1.152