Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


IPMI sensors -- update June 21, 2009
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
ehall
Cacti User


Joined: 09 Dec 2005
Posts: 237

PostPosted: Wed Jan 25, 2006 12:32 pm    Post subject: IPMI sensors -- update June 21, 2009 Reply with quote

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 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
Back to top
bsod



Joined: 11 Mar 2004
Posts: 23
Location: Paris, France

PostPosted: Tue Feb 14, 2006 8:05 am    Post subject: Reply with quote

Thanks a lot for this ! I'll try it very soon ...
Back to top
error27



Joined: 16 Feb 2006
Posts: 1

PostPosted: Thu Feb 16, 2006 8:51 pm    Post subject: Reply with quote

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

PostPosted: Wed Feb 22, 2006 12:14 pm    Post subject: I've tried in several manner but... Reply with quote

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: 237

PostPosted: Thu Feb 23, 2006 9:06 am    Post subject: Reply with quote

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

PostPosted: Mon Feb 27, 2006 11:04 am    Post subject: My setup Reply with quote

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: 237

PostPosted: Thu Mar 02, 2006 5:48 pm    Post subject: Re: My setup Reply with quote

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

PostPosted: Tue Mar 28, 2006 6:49 am    Post subject: Reply with quote

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

PostPosted: Wed Oct 25, 2006 12:57 pm    Post subject: Data Query XML data definitions missing Reply with quote

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

PostPosted: Thu Feb 01, 2007 11:13 am    Post subject: Re: Data Query XML data definitions missing Reply with quote

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: 237

PostPosted: Thu Feb 01, 2007 1:17 pm    Post subject: Reply with quote

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

PostPosted: Mon Feb 05, 2007 8:48 am    Post subject: Reply with quote

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

PostPosted: Thu Feb 22, 2007 9:48 am    Post subject: Reply with quote

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

PostPosted: Wed Apr 04, 2007 9:19 am    Post subject: Reply with quote

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: 237

PostPosted: Fri Apr 06, 2007 5:26 pm    Post subject: Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 



Powered by phpBB © 2001, 2005 phpBB Group