|
|
| Author |
Message |
ehall Cacti User
Joined: 09 Dec 2005 Posts: 160
|
Posted: Wed Jan 25, 2006 12:32 pm Post subject: IPMI sensors -- update April 6, 2007 |
|
|
[Apr 6, 2007: new tarball uploaded, and fix for missing GPRINT Preset added to instructions below]
I have been working to get different kinds of hardware monitoring working in a consistent manner. This is the package for using ipmitool to query a system over the IPMI management interface.
Here is what the final result looks like for one of my systems, and shows the fan speeds, thermal probe temperatures, and voltage levels for all of the available sensors on that server:
This model uses a script query which uses ipmitool to ask the target for all known sensors of the requested type. Add the appropriate data query to a device that has an IPMI interface, and then create new graphs for each of the sensors that you want. Each selected sensor will be created as an individual data-source and graph, like with interfaces.
NOTE: If you encounter problems with an unmet dependency complaint from a missing "(GPRINT Preset) Exact Numbers", you will need to create the GPRINT Preset manually before importing the templates. To do so, click on the Graph Management cacti menu item, and then click on the (new) GPRINT Presets sub-menu underneath. Create a GPRINT Preset with the exact name of "Exact Numbers" and the GPRINT Text value of "%8.0lf". That should allow the graph templates to be imported successfully.
Graphs can be consolidated by editing and/or using one of the bundled "8x" graph templates, once the underlying data-sources and graphs have been created. If you have 8 items on a host, simply use the Graph Management menu to "add" a new graph, choose the target system, and then point to the data sources you created with the data query. If you have fewer or more than eight items, you can make a copy of the 8x template and add/delete however many more rows you want. Once the consolidated graphs are working, you can delete the sensor-specific one-off graphs, but DO NOT DELETE THE DATA SOURCES.
The screenie below uses a 5x template for fan probes, but as you can see in the large image above, the other sensor groups on this host use 2x and 6x graphs.
There are A LOT of caveats here. Obviously, you must have IPMI on your target system, and that interface must have an IP address that will respond to cacti probes (otherwise cacti will think it is down and won't run the script). Also note that if the target hostname is the local hostname, then the OpenIPMI (local) interface is used, instead of using the IPMI lan interface.
You must also have the ipmitool package installed on the cacti server so that it can be used to connect with the target system. If you need to use a specific IPMI username, you must provide it. Unfortunately there's no way to pass command-specific variables in cacti so this is passed as the SNMP v3 username and pasword, and this may cause problems with other cacti queries for that device (it shouldn't but it might). You can leave the username and password blank and it will use the ipmitool NULL equivalents ("").
One big caveat is that there's no easy way to only ask for a single sensor, so all queries have to process all sensors. IPMI queries can be slow, so if you are asking for a dozen sensors on a dozen hosts you could easily consume a couple of minutes of time (each query is executed in series and is fully blocking within cacti). At some point I hope to revisit this and implement a caching system that keeps sensor data on disk for a minute or two, so that queries for each sensor will only have to read the previous results, but for right now be aware that time delay will probably be an issue.
Frankly, I strongly suggest that you make use of other mechanisms (such as using the IPMI bmcsensors kernel module with the ucd/net-snmp lmsensors graphs, but for people with lots of IPMI systems that do not have system-specific SNMP interfaces, this is the only viable choice.
If there are any additional updates to this, I will replace the attachment below.
This was created on cacti 0.8.6i, and the script uses PHP 4. Other combinations may not work.
Other helpful links:
intro to IPMI v2
ipmitool home page
| Description: |
|
 Download |
| Filename: |
cacti-ipmi-sensors.tar.gz |
| Filesize: |
16.4 KB |
| Downloaded: |
1177 Time(s) |
Last edited by ehall on Fri May 02, 2008 8:17 pm; edited 6 times in total |
|
| Back to top |
|
 |
bsod
Joined: 11 Mar 2004 Posts: 22 Location: Paris, France
|
Posted: Tue Feb 14, 2006 8:05 am Post subject: |
|
|
| Thanks a lot for this ! I'll try it very soon ...
|
|
| Back to top |
|
 |
error27
Joined: 16 Feb 2006 Posts: 1
|
Posted: Thu Feb 16, 2006 8:51 pm Post subject: |
|
|
I'm trying to run the ipmi_sensors.php script manually like this:
php ipmi/ipmi_sensors.php VOLTAGE 192.168.98.131 "" "" query sensorreading
At first it was cutting off the last character of the hostname so it wasn't working so I had to patch it.
| Code: |
--- ipmi/ipmi_sensors.php.orig 2006-02-16 17:39:18.000000000 -0800
+++ ipmi/ipmi_sensors.php 2006-02-16 17:39:26.000000000 -0800
@@ -62,7 +62,7 @@
#
# 2nd parameter is always $hostname
#
-$hostname = substr($_SERVER['argv'][2],0,(strlen($_SERVER['argv'][2]) - 1));
+$hostname = substr($_SERVER['argv'][2],0,(strlen($_SERVER['argv'][2])));
if ($hostname == (exec ('hostname -f 2>/dev/null'))) {
|
I'm a newbie at using cacti so I'm not able to make it work as a plugin. Someone said that you just put the .php scripts in /usr/share/cacti/scripts/ but that doesn't seem to work.
I imported the .xml files. Those seem to be looking for files like:
/usr/share/cacti/rra/<hostname>_sensorreading_11.rrd
But no sensorreading files have been created so it's not working. :/
What am I doing wrong?
|
|
| Back to top |
|
 |
dgrossato
Joined: 22 Feb 2006 Posts: 2
|
Posted: Wed Feb 22, 2006 12:14 pm Post subject: I've tried in several manner but... |
|
|
I've corrected the script as above shown,
The script runs from console,
I've imported for now only the single (not 8x ) template without modifing them,
I've tried setup input method in several way but...
I haven't obtained nothig... only an empty graph
I spent several full day on it, I read most docs in this site but nothing...
I think that a single post is necessary to show how to setup it...
TNX
DvD
|
|
| Back to top |
|
 |
ehall Cacti User
Joined: 09 Dec 2005 Posts: 160
|
Posted: Thu Feb 23, 2006 9:06 am Post subject: |
|
|
| error27 wrote: | I'm trying to run the ipmi_sensors.php script manually like this:
php ipmi/ipmi_sensors.php VOLTAGE 192.168.98.131 "" "" query sensorreading
At first it was cutting off the last character of the hostname so it wasn't working so I had to patch it. |
Don't do that. The query definition XML uses comma-separated parameters, and the script chops the commas off. Since your patch is not doing that anymore, hostname lookups are now going to be for "hostname," (with the comma) and the subsequently fields will also be imbalanced.
| Quote: | I'm a newbie at using cacti so I'm not able to make it work as a plugin. Someone said that you just put the .php scripts in /usr/share/cacti/scripts/ but that doesn't seem to work.
I imported the .xml files. Those seem to be looking for files like:
/usr/share/cacti/rra/<hostname>_sensorreading_11.rrd
But no sensorreading files have been created so it's not working. :/
What am I doing wrong? |
First make sure that the script works with the commas using something simple like "php ipmi_sensors.php VOLTAGE, 192.168.98.131, ," (the empty parameters will be filled in by the script).
Second make sure the files are in the right place. The PHP script file should be in your $cacti/scripts/ directory (you seem to have it in an ipmi subdirectory), and the XML files should be imported (using the "Import Templates" menu option on the left side of the console screen).
Third make sure the IPMI device has an IP address, and that it responds to SNMP or ICMP ping (set community string to blank to bypass SNMP lookups). Cacti will not execute any lookups for the device if it does not respond to basic probes.
Once that's all working, add the data query to the device in the console screen, and then use the verbose option to display the discovered sensors. If there aren't any sensors and the error isn't obvious, copy and paste the verbose output here and I'll see if I can spot the problem.
|
|
| Back to top |
|
 |
dgrossato
Joined: 22 Feb 2006 Posts: 2
|
Posted: Mon Feb 27, 2006 11:04 am Post subject: My setup |
|
|
| ehall wrote: | | error27 wrote: | I'm trying to run the ipmi_sensors.php script manually like this:
php ipmi/ipmi_sensors.php VOLTAGE 192.168.98.131 "" "" query sensorreading
At first it was cutting off the last character of the hostname so it wasn't working so I had to patch it. |
Don't do that. The query definition XML uses comma-separated parameters, and the script chops the commas off. Since your patch is not doing that anymore, hostname lookups are now going to be for "hostname," (with the comma) and the subsequently fields will also be imbalanced. |
OK, fixes now script goes like this:
| Code: | /usr/bin/php ./scripts/ipmi_sensors.php TEMPERATURE "", "", "", query sensorname
1:Temp
2:Temp
3:Ambient Temp
4:Planar Temp
5:Riser Temp
6:Temp
7:Temp
8:Temp
9:Temp
10:Ambient Temp
11:Planar Temp
12:Riser Temp
13:Temp
14:Temp |
| Quote: | I'm a newbie at using cacti so I'm not able to make it work as a plugin. Someone said that you just put the .php scripts in /usr/share/cacti/scripts/ but that doesn't seem to work.
I imported the .xml files. Those seem to be looking for files like:
/usr/share/cacti/rra/<hostname>_sensorreading_11.rrd
But no sensorreading files have been created so it's not working. :/
What am I doing wrong? |
Attention permission for /var/lib/cacti/ where scripts and rras are stored. In fedora FC4 with SELinux enable the are also the context permission -> try with | Code: | chcon -R --reference=/var/www/html/ /var/lib/cacti/
| Link
| ehall wrote: |
First make sure that the script works with the commas using something simple like "php ipmi_sensors.php VOLTAGE, 192.168.98.131, ," (the empty parameters will be filled in by the script). |
I setup the scritps to "" - (empty) -> localhost now in "Data Inputs Method" I have
- IPMI - Tools - Temperature
- Script query
- /usr/bin/php <path_cacti>/scripts/ipmi_sensors.php TEMPERATURE "", "", "",
- Input - nothing
- Output - nothing
| ehall wrote: |
Second make sure the files are in the right place. The PHP script file should be in your $cacti/scripts/ directory (you seem to have it in an ipmi subdirectory), and the XML files should be imported (using the "Import Templates" menu option on the left side of the console screen).
|
OK Done.
| ehall wrote: |
Third make sure the IPMI device has an IP address, and that it responds to SNMP or ICMP ping (set community string to blank to bypass SNMP lookups). Cacti will not execute any lookups for the device if it does not respond to basic probes. |
I setup this to "" (empty) -> localhost (cacti is running on the same server to monitor)
| ehall wrote: |
Once that's all working, add the data query to the device in the console screen, and then use the verbose option to display the discovered sensors. If there aren't any sensors and the error isn't obvious, copy and paste the verbose output here and I'll see if I can spot the problem. |
Graph are empty
| Code: |
RRDTool Command:
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Localhost - Thermal Sensor - |query_sensorName|" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="Celsius" \
DEF:a="/usr/share/cacti/rra/localhost_sensorreading_14.rrd":sensorReading:AVERAGE \
LINE2:a#0000FF:"|query_sensorName|" \
GPRINT:a:LAST:"Current\:%8.2lf %s" \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:a:MIN:"Minimum\:%8.2lf %s" \
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n"
RRDTool Says:
OK |
thats all folks!!!
Bye Bye
DvD
|
|
| Back to top |
|
 |
ehall Cacti User
Joined: 09 Dec 2005 Posts: 160
|
Posted: Thu Mar 02, 2006 5:48 pm Post subject: Re: My setup |
|
|
| dgrossato wrote: | OK, fixes now script goes like this:
| Code: | | /usr/bin/php ./scripts/ipmi_sensors.php TEMPERATURE "", "", "", query sensorname |
|
You need to specify the hostname ("" will be treated as the hostname in the example above). You do not need to specify the "" pairs for username or password either, since they will be provided as empty strings if no SNMPv1/v2 username or password are provided.
Just use something like:
| Code: | | /usr/bin/php ./scripts/ipmi_sensors.php TEMPERATURE localhost, , , query sensorname |
That's all you need
|
|
| Back to top |
|
 |
koole
Joined: 28 Mar 2006 Posts: 1
|
Posted: Tue Mar 28, 2006 6:49 am Post subject: |
|
|
php ipmi_sensors.php TEMPERATURE ip_address, , , query sensorname
This returns nothing to me. It queries something, because it takes about 15 seconds to run over (normal ipmitool sdr query time...). I dont know anymore what kind of query to do!
But hey Ehall!
There is a feature to use local cache file for ipmitool sdr queries.
man ipmitool:
-S <sdr_cache_file>
Use local file for remote SDR cache. Using a local SDR cache can drasti-
cally increase performance for commands that require knowledge of the
entire SDR to perform their function. Local SDR cache from a remote sys-
tem can be created with the sdr dump command.
That increase performance of ipmitool dramatically indeed!
|
|
| Back to top |
|
 |
msubieta
Joined: 25 Oct 2006 Posts: 1
|
Posted: Wed Oct 25, 2006 12:57 pm Post subject: Data Query XML data definitions missing |
|
|
I just tried the scripts and I have followed the rather obscure directions on how to install this plugin. However, I still get an empty graph. I am able to get information using the ipmi_sensor.php script, but I cannot make the data available to rrdtool, or get stored in the cacti database for all that matters. I read that the data query must be entered, but I do not know what the xml data definitions file is, or how I will enter the username and password into the query so that it will work.
I have 64 servers I need to constantly monitor temperature-wise, and so far this is the best way I found. I also found something about lm_sensors, but again the documentation on how to implement this is very limited. I will be more than happy to write the steps necessary to get this thing up and running if I only had enough information to do it.
|
|
| Back to top |
|
 |
Blackblade
Joined: 01 Feb 2007 Posts: 4
|
Posted: Thu Feb 01, 2007 11:13 am Post subject: Re: Data Query XML data definitions missing |
|
|
Hi all,
I have similar problems. I've tried to use the script and xml-files, ehall has build, but I think, there are several additional steps to do, which I don't understand.
As far as I understood, the files from ehal provides data and graph templates and a script to collect the data.
The script is working without problems. So I tried to create the cacti graphs.
To do this, I need the "appropriate data query" for the host. This data query is not in the zip-file and i have no idea, how to create it manually.
Anybody here, who can give two beginners in cacti the needed help, to get this working?
Many thanks in advance,
Michael
|
|
| Back to top |
|
 |
ehall Cacti User
Joined: 09 Dec 2005 Posts: 160
|
Posted: Thu Feb 01, 2007 1:17 pm Post subject: |
|
|
It doesn't appear that the original tar file had all of the templates. Don't know how it went so long without being noticed, but all of the dependencies were supposed to have been included. Anyway, I uploaded a new one that should have everything.
All of the XML files are exported from cacti 0.8.6i. Import them all, starting with the data templates, then the data queries, then finally the graphs.
Copy the .php script to your cacti scripts directory.
IPMI uses authentication, but cacti does not provide any means to specify additional variables to the script-query interface, so you have to figure out some kind of way around this.
One option (what I use here) is to create a null IPMI operator account on your machines. You can do this with "ipmitool user enable" (with no username) and then use ipmitool to further tweak the privileges and whatnot. If the script does not receive any username parameters (see bottom of post) then it will use the special NULL username and password to perform the queries.
Another option is to change the script source code. By default, if no username is provided on the command line, then the script will use the special NULL username (referred to above) with a pair of empty quote marks. You can change this to use another username if you want, so that the absence of a username and password will cause the script to use the username and password that you want.
The username code block is here:
| Code: | #
# check for username and use NULL if not provided
#
if ($username != "") {
$cmdtool = $cmdtool . " -U $username";
}
else {
$cmdtool = $cmdtool . " -U \"\"";
} |
You'll need to do the same for password.
It is possible to pass a username and password on the command-line, but that comes from overloading the SNMPv3 fields in cacti, and that has very limited applicability in most cases. You would need to create a host definition that uses SNMPv3, make sure that the host responds to pings (and there may be some other cacti tweaks like not probing SNMP), etc. If your host uses IPMI on a different IP address than the operating system uses (pretty common) then this can be a feasible method, and I've used it here myself.
Generally speaking the absolute simplest thing to do is use the ipmisensors module for lm_sensors, and get the data from net-snmp lmsensors hooks. This script is really for people that need to use IPMI in particular. IPMI is hard and ugly, I know.
|
|
| Back to top |
|
 |
Blackblade
Joined: 01 Feb 2007 Posts: 4
|
Posted: Mon Feb 05, 2007 8:48 am Post subject: |
|
|
Hello,
thanks for the quick reply. The new archive takes me a step further, but there are the "<path_cacti>/resource/script_queries/ipmi_*.xml" files still missing. I think
Do i have to create them manually? If yes, can you give me a hint, how?
Bye, Michael
|
|
| Back to top |
|
 |
PowerSp00n
Joined: 22 Feb 2007 Posts: 1
|
Posted: Thu Feb 22, 2007 9:48 am Post subject: |
|
|
| Blackblade wrote: | Hello,
but there are the "<path_cacti>/resource/script_queries/ipmi_*.xml" files still missing. I think
Do i have to create them manually? If yes, can you give me a hint, how? |
Same here. Also the file cacti_graph_template_sensors_ipmi_fan_sensors_8x.xml returns an error after importing it:
| Code: | Cacti has imported the following items:
GPRINT Preset
[success] Exact Numbers [update]
Graph Template
[success] Sensors - IPMI - Fan Sensors (8x) [update]
+ Found Dependency: (GPRINT Preset) Exact Numbers
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
etc...
|
|
|
| Back to top |
|
 |
Blackblade
Joined: 01 Feb 2007 Posts: 4
|
Posted: Wed Apr 04, 2007 9:19 am Post subject: |
|
|
Hi,
long time no news . Perhaps anybody can give us a hint, how to handle the missing xml-files?
Bye, Michael
|
|
| Back to top |
|
 |
ehall Cacti User
Joined: 09 Dec 2005 Posts: 160
|
Posted: Fri Apr 06, 2007 5:26 pm Post subject: |
|
|
| A new tarball was uploaded that should have everything, and a note was added to describe the missing GPRINT Preset. I guess cacti doesn't include GPRINT definitions in the exports...
|
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|