Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Thu Jun 27, 2019 5:50 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 51 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: IPMI sensors -- update June 21, 2009
PostPosted: Wed Jan 25, 2006 12:32 pm 
Offline
Cacti User

Joined: Fri Dec 09, 2005 3:42 pm
Posts: 246
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:

Image

This model 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.

--> see this page for the tarball and instructions <--


Last edited by ehall on Tue Jun 23, 2009 11:26 am, edited 11 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 14, 2006 8:05 am 
Offline

Joined: Thu Mar 11, 2004 11:49 am
Posts: 23
Location: Paris, France
Thanks a lot for this ! I'll try it very soon ...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 16, 2006 8:51 pm 
Offline

Joined: Thu Feb 16, 2006 8:37 pm
Posts: 1
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?


Top
 Profile  
 
 Post subject: I've tried in several manner but...
PostPosted: Wed Feb 22, 2006 12:14 pm 
Offline

Joined: Wed Feb 22, 2006 11:56 am
Posts: 2
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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 23, 2006 9:06 am 
Offline
Cacti User

Joined: Fri Dec 09, 2005 3:42 pm
Posts: 246
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.


Top
 Profile  
 
 Post subject: My setup
PostPosted: Mon Feb 27, 2006 11:04 am 
Offline

Joined: Wed Feb 22, 2006 11:56 am
Posts: 2
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


Top
 Profile  
 
 Post subject: Re: My setup
PostPosted: Thu Mar 02, 2006 5:48 pm 
Offline
Cacti User

Joined: Fri Dec 09, 2005 3:42 pm
Posts: 246
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 28, 2006 6:49 am 
Offline

Joined: Tue Mar 28, 2006 6:37 am
Posts: 1
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!


Top
 Profile  
 
 Post subject: Data Query XML data definitions missing
PostPosted: Wed Oct 25, 2006 12:57 pm 
Offline

Joined: Wed Oct 25, 2006 10:49 am
Posts: 1
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.


Top
 Profile  
 
 Post subject: Re: Data Query XML data definitions missing
PostPosted: Thu Feb 01, 2007 11:13 am 
Offline

Joined: Thu Feb 01, 2007 8:09 am
Posts: 4
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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 01, 2007 1:17 pm 
Offline
Cacti User

Joined: Fri Dec 09, 2005 3:42 pm
Posts: 246
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.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 05, 2007 8:48 am 
Offline

Joined: Thu Feb 01, 2007 8:09 am
Posts: 4
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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 22, 2007 9:48 am 
Offline

Joined: Thu Feb 22, 2007 9:42 am
Posts: 1
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...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 04, 2007 9:19 am 
Offline

Joined: Thu Feb 01, 2007 8:09 am
Posts: 4
Hi,

long time no news :). Perhaps anybody can give us a hint, how to handle the missing xml-files?

Bye, Michael


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 06, 2007 5:26 pm 
Offline
Cacti User

Joined: Fri Dec 09, 2005 3:42 pm
Posts: 246
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...


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 51 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group