|
|
| Author |
Message |
Blackblade
Joined: 01 Feb 2007 Posts: 4
|
Posted: Tue Apr 10, 2007 9:54 am Post subject: |
|
|
| ehall wrote: | | 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... |
Thank you.... now everything works, as described. Great work. |
|
| Back to top |
|
 |
NuBreed
Joined: 13 Apr 2007 Posts: 0
|
Posted: Fri Apr 13, 2007 6:10 pm Post subject: |
|
|
| Now i have tried everything i get data when i run the script manually but i dont get any graphs. When i |
|
| Back to top |
|
 |
NuBreed
Joined: 13 Apr 2007 Posts: 0
|
Posted: Fri Apr 13, 2007 6:10 pm Post subject: |
|
|
Now i have tried everything i get data when i run the script manually but i dont get any graphs. I have imported all the xml files without any problems. I think the problem is somewhere with "Data Inputs Method" but i dont know how that should be configured.
When i read this thread there is many different opinions on how to get this working most of them belong to the old archive etc. So if someone could write a step by step howto i think this is going to be a lot easier.
Last edited by NuBreed on Sun Apr 15, 2007 12:51 pm; edited 1 time in total |
|
| Back to top |
|
 |
Skruu
Joined: 14 Apr 2007 Posts: 1
|
Posted: Sat Apr 14, 2007 5:36 pm Post subject: |
|
|
I still have a similar problem importing cacti_graph_template_sensors_ipmi_fan_sensors_8x.xml.
All other xml-files imported fine. Any idea what's still missing?
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)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item) |
|
| Back to top |
|
 |
lordzero
Joined: 02 Jul 2007 Posts: 1 Location: Munich, Germany
|
Posted: Mon Jul 02, 2007 6:52 am Post subject: |
|
|
I also get the same problem when importing the cacti_graph_template_sensors_ipmi_fan_sensors_8x.xml template in cacti 0.8.6i-3 (debian etch). All other templates get importeted successfully. So I tried to create a graph for temperature data. Doing this by creating a host with no host template and then creating a graph (thermal sensor) for that device. All of this works fine, but I doesn't get any graph.
When I select the created graph in the Graph Management and turn on "Graph Debug Mode" I see the following output:
RRDTool Command:
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="IPMI Test - Thermal Sensors" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="Celsius" \
--slope-mode \
LINE1:#00FF00:"|query_sensorName|" \
GPRINT::LAST:"Current\:%8.2lf%s" \
GPRINT::AVERAGE:"Average\:%8.2lf%s" \
GPRINT::MIN:"Minimum\:%8.2lf%s" \
GPRINT::MAX:"Maximum\:%8.2lf%s\n" \
LINE1:#0000FF:"|query_sensorName|" \
GPRINT::LAST:"Current\:%8.2lf%s" \
GPRINT::AVERAGE:"Average\:%8.2lf%s" \
GPRINT::MIN:"Minimum\:%8.2lf%s" \
GPRINT::MAX:"Maximum\:%8.2lf%s\n" \
LINE1:#EA8F00:"|query_sensorName|" \
GPRINT::LAST:"Current\:%8.2lf%s" \
GPRINT::AVERAGE:"Average\:%8.2lf%s" \
GPRINT::MIN:"Minimum\:%8.2lf%s" \
GPRINT::MAX:"Maximum\:%8.2lf%s\n" \
LINE1:#A150AA:"|query_sensorName|" \
GPRINT::LAST:"Current\:%8.2lf%s" \
GPRINT::AVERAGE:"Average\:%8.2lf%s" \
GPRINT::MIN:"Minimum\:%8.2lf%s" \
GPRINT::MAX:"Maximum\:%8.2lf%s\n" \
LINE1:#74C366:"|query_sensorName|" \
GPRINT::LAST:"Current\:%8.2lf%s" \
GPRINT::AVERAGE:"Average\:%8.2lf%s" \
GPRINT::MIN:"Minimum\:%8.2lf%s" \
GPRINT::MAX:"Maximum\:%8.2lf%s\n" \
LINE1:#9FA4EE:"|query_sensorName|" \
GPRINT::LAST:"Current\:%8.2lf%s" \
GPRINT::AVERAGE:"Average\:%8.2lf%s" \
GPRINT::MIN:"Minimum\:%8.2lf%s" \
GPRINT::MAX:"Maximum\:%8.2lf%s\n" \
LINE1:#CCBB00:"|query_sensorName|" \
GPRINT::LAST:"Current\:%8.2lf%s" \
GPRINT::AVERAGE:"Average\:%8.2lf%s" \
GPRINT::MIN:"Minimum\:%8.2lf%s" \
GPRINT::MAX:"Maximum\:%8.2lf%s\n" \
LINE1:#DA4725:"|query_sensorName|" \
GPRINT::LAST:"Current\:%8.2lf%s" \
GPRINT::AVERAGE:"Average\:%8.2lf%s" \
GPRINT::MIN:"Minimum\:%8.2lf%s" \
GPRINT::MAX:"Maximum\:%8.2lf%s\n"
RRDTool Says:
ERROR: parameter '#00FF00' does not represent a number in line LINE1:#00FF00:|query_sensorName|
I will go on looking for the error...
P.S. 1:
Oh, once more - just found:
When I execute the php script manually on the console with
| Quote: |
php -q /usr/share/cacti/site/scripts/ipmi_sensors.php TEMPERATURE 10.11.250.101 user pass query sensorreading
|
I get the following output:
failed: no results returned from /usr/bin/ipmitool sdr type temperature -I lan -H 10.11.250.10 -U use -P pas 2> /dev/null
As you can see the php script eliminates the last character of the hostname, the username and the password.
After Changing the php script in line 65, 79 and 84 (removed "-1" from "strlen($_SERVER['argv'][4]) )") I get the following output:
1:-61
2:50
3:40
4:40
5:16
These are the correct Temperature values from the IPMI sensors... But no graph anyway...
P.S. 2:
Now I tested the "Associated Data Query" for the test host and in debugging mode (verbose query) I got the following output:
| Quote: |
+ Running data query [14].
+ Found type = '4 '[script query].
+ Found data query XML file at '/usr/share/cacti/site/resource/script_queries/ipmi_temp.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/bin/php -q /usr/share/cacti/site/scripts/ipmi_sensors.php temperature 10.11.250.101, user, pass, index'
+ Executing script query '/usr/bin/php -q /usr/share/cacti/site/scripts/ipmi_sensors.php temperature 10.11.250.101, user, pass, query sensorDevice'
+ Found item [sensorDevice=' no results returned from /usr/bin/ipmitool sdr type temperature -I lan -H 10.11.250.101, -U user, -P pass, 2> /dev/null'] index: failed
+ Executing script query '/usr/bin/php -q /usr/share/cacti/site/scripts/ipmi_sensors.php temperature 10.11.250.101, user, pass, query sensorName'
+ Found item [sensorName=' no results returned from /usr/bin/ipmitool sdr type temperature -I lan -H 10.11.250.101, -U user, -P pass, 2> /dev/null'] index: failed
+ Found data query XML file at '/usr/share/cacti/site/resource/script_queries/ipmi_temp.xml'
+ Found data query XML file at '/usr/share/cacti/site/resource/script_queries/ipmi_temp.xml'
+ Found data query XML file at '/usr/share/cacti/site/resource/script_queries/ipmi_temp.xml'
|
The errror is here in the script_querys xml files. The "<arg_prepend>" element specifies "|host_hostname|, |host_snmp_username|, |host_snmp_password|," which is wrong because ipmitool expects the parameters without comma seperation (ipmitool version 1.8.8).
Removing all commas and leaving only spaces fixes this an I get this output:
| Quote: |
+ Running data query [14].
+ Found type = '4 '[script query].
+ Found data query XML file at '/usr/share/cacti/site/resource/script_queries/ipmi_temp.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/bin/php -q /usr/share/cacti/site/scripts/ipmi_sensors.php temperature 10.11.250.101 user pass index'
+ Executing script query '/usr/bin/php -q /usr/share/cacti/site/scripts/ipmi_sensors.php temperature 10.11.250.101 user pass query sensorDevice'
+ Found item [sensorDevice='1'] index: 1
+ Found item [sensorDevice='2'] index: 2
+ Found item [sensorDevice='3'] index: 3
+ Found item [sensorDevice='4'] index: 4
+ Found item [sensorDevice='5'] index: 5
+ Executing script query '/usr/bin/php -q /usr/share/cacti/site/scripts/ipmi_sensors.php temperature 10.11.250.101 user pass query sensorName'
+ Found item [sensorName='Temp'] index: 1
+ Found item [sensorName='Temp'] index: 2
+ Found item [sensorName='Temp'] index: 3
+ Found item [sensorName='Temp'] index: 4
+ Found item [sensorName='Ambient Temp'] index: 5
+ Found data query XML file at '/usr/share/cacti/site/resource/script_queries/ipmi_temp.xml'
+ Found data query XML file at '/usr/share/cacti/site/resource/script_queries/ipmi_temp.xml'
+ Found data query XML file at '/usr/share/cacti/site/resource/script_queries/ipmi_temp.xml'
|
P.S. 3:
And after fixing all this and recreating of the graph all things work fine... ;-)
So please correct the script_querie xml files and the ipmi_sensors.php...
Thanks and best regards...
Werner |
|
| Back to top |
|
 |
ehall Cacti User
Joined: 09 Dec 2005 Posts: 237
|
Posted: Sat Oct 20, 2007 9:12 pm Post subject: |
|
|
| The commas are there to allow for empty parameters, and the script strips the last character off to remove the comma. |
|
| Back to top |
|
 |
peppermint Cacti User
Joined: 11 May 2007 Posts: 58 Location: NY
|
|
| Back to top |
|
 |
loganville
Joined: 15 Jul 2008 Posts: 5 Location: Shippensburg University
|
Posted: Wed Jul 16, 2008 9:11 am Post subject: |
|
|
Has anyone successfully run these templates with cacti 0.8.7b?
Logan |
|
| Back to top |
|
 |
ehall Cacti User
Joined: 09 Dec 2005 Posts: 237
|
Posted: Sat Apr 25, 2009 8:09 pm Post subject: |
|
|
Uploaded a new kit that does not really address any problems but is cleaner and should work with more stuff
I am running it on 0.8.7c right now, but using the CMD.PHP poller because of separate problems with cactid |
|
| Back to top |
|
 |
techn0mad
Joined: 20 May 2009 Posts: 3
|
Posted: Wed May 20, 2009 10:56 am Post subject: |
|
|
| 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).
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. |
I'm also a cacti noob, but your instructions have been quite straightforward (Thanks!). However, I am seeing two problems:
- The data queries do not return any data when I try to create the graphs
- When I test by running the PHP scripts by hand, it seems to matter who runs the script (i.e. cacti user versus superuser)
Here are the results of a verbose query of the IPMI Fan, Thermal and Voltage sensors:
| Code: | + Running data query [10].
+ Found type = '4 '[script query].
+ Found data query XML file at '/usr/local/share/cacti/resource/script_queries/ipmi_sensors_fan.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/local/bin/php -q /usr/local/share/cacti/scripts/ipmi_sensors.php fan 127.0.0.1, , , index'
+ Executing script query '/usr/local/bin/php -q /usr/local/share/cacti/scripts/ipmi_sensors.php fan 127.0.0.1, , , query sensorDevice'
+ Found item [sensorDevice='1'] index: 1
+ Found item [sensorDevice='2'] index: 2
+ Found item [sensorDevice='3'] index: 3
+ Found item [sensorDevice='4'] index: 4
+ Found item [sensorDevice='5'] index: 5
+ Found item [sensorDevice='6'] index: 6
+ Found item [sensorDevice='7'] index: 7
+ Found item [sensorDevice='8'] index: 8
+ Found item [sensorDevice='9'] index: 9
+ Found item [sensorDevice='10'] index: 10
+ Found item [sensorDevice='11'] index: 11
+ Found item [sensorDevice='12'] index: 12
+ Found item [sensorDevice='13'] index: 13
+ Found item [sensorDevice='14'] index: 14
+ Executing script query '/usr/local/bin/php -q /usr/local/share/cacti/scripts/ipmi_sensors.php fan 127.0.0.1, , , query sensorName'
+ Found item [sensorName='FAN 1 RPM'] index: 1
+ Found item [sensorName='FAN 2 RPM'] index: 2
+ Found item [sensorName='FAN 3 RPM'] index: 3
+ Found item [sensorName='FAN 4 RPM'] index: 4
+ Found item [sensorName='FAN 5 RPM'] index: 5
+ Found item [sensorName='FAN 6 RPM'] index: 6
+ Found item [sensorName='FAN 1 RPM'] index: 7
+ Found item [sensorName='FAN 2 RPM'] index: 8
+ Found item [sensorName='FAN 3 RPM'] index: 9
+ Found item [sensorName='FAN 4 RPM'] index: 10
+ Found item [sensorName='FAN 5 RPM'] index: 11
+ Found item [sensorName='FAN 6 RPM'] index: 12
+ Found item [sensorName='FAN 7 RPM'] index: 13
+ Found item [sensorName='FAN 8 RPM'] index: 14
+ Found data query XML file at '/usr/local/share/cacti/resource/script_queries/ipmi_sensors_fan.xml'
+ Found data query XML file at '/usr/local/share/cacti/resource/script_queries/ipmi_sensors_fan.xml'
+ Found data query XML file at '/usr/local/share/cacti/resource/script_queries/ipmi_sensors_fan.xml'
+ Found data query XML file at '/usr/local/share/cacti/resource/script_queries/ipmi_sensors_fan.xml'
|
| Code: | + Running data query [11].
+ Found type = '4 '[script query].
+ Found data query XML file at '/usr/local/share/cacti/resource/script_queries/ipmi_sensors_thermal.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/local/bin/php -q /usr/local/share/cacti/scripts/ipmi_sensors.php temperature 127.0.0.1, , , index'
+ Executing script query '/usr/local/bin/php -q /usr/local/share/cacti/scripts/ipmi_sensors.php temperature 127.0.0.1, , , query sensorDevice'
+ Found item [sensorDevice='1'] index: 1
+ Found item [sensorDevice='2'] index: 2
+ Found item [sensorDevice='3'] index: 3
+ Found item [sensorDevice='4'] index: 4
+ Found item [sensorDevice='5'] index: 5
+ Found item [sensorDevice='6'] index: 6
+ Found item [sensorDevice='7'] index: 7
+ Found item [sensorDevice='8'] index: 8
+ Found item [sensorDevice='9'] index: 9
+ Found item [sensorDevice='10'] index: 10
+ Found item [sensorDevice='11'] index: 11
+ Found item [sensorDevice='12'] index: 12
+ Found item [sensorDevice='13'] index: 13
+ Found item [sensorDevice='14'] index: 14
+ Executing script query '/usr/local/bin/php -q /usr/local/share/cacti/scripts/ipmi_sensors.php temperature 127.0.0.1, , , query sensorName'
+ Found item [sensorName='Temp'] index: 1
+ Found item [sensorName='Temp'] index: 2
+ Found item [sensorName='Ambient Temp'] index: 3
+ Found item [sensorName='Planar Temp'] index: 4
+ Found item [sensorName='Riser Temp'] index: 5
+ Found item [sensorName='Temp'] index: 6
+ Found item [sensorName='Temp'] index: 7
+ Found item [sensorName='Temp'] index: 8
+ Found item [sensorName='Temp'] index: 9
+ Found item [sensorName='Ambient Temp'] index: 10
+ Found item [sensorName='Planar Temp'] index: 11
+ Found item [sensorName='Riser Temp'] index: 12
+ Found item [sensorName='Temp'] index: 13
+ Found item [sensorName='Temp'] index: 14
+ Found data query XML file at '/usr/local/share/cacti/resource/script_queries/ipmi_sensors_thermal.xml'
+ Found data query XML file at '/usr/local/share/cacti/resource/script_queries/ipmi_sensors_thermal.xml'
+ Found data query XML file at '/usr/local/share/cacti/resource/script_queries/ipmi_sensors_thermal.xml'
+ Found data query XML file at '/usr/local/share/cacti/resource/script_queries/ipmi_sensors_thermal.xml'
|
| Code: | + Running data query [12].
+ Found type = '4 '[script query].
+ Found data query XML file at '/usr/local/share/cacti/resource/script_queries/ipmi_sensors_voltage.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/local/bin/php -q /usr/local/share/cacti/scripts/ipmi_sensors.php voltage 127.0.0.1, , , index'
+ Executing script query '/usr/local/bin/php -q /usr/local/share/cacti/scripts/ipmi_sensors.php voltage 127.0.0.1, , , query sensorDevice'
+ Found item [sensorDevice='1'] index: 1
+ Executing script query '/usr/local/bin/php -q /usr/local/share/cacti/scripts/ipmi_sensors.php voltage 127.0.0.1, , , query sensorName'
+ Found item [sensorName='CMOS Battery'] index: 1
+ Found data query XML file at '/usr/local/share/cacti/resource/script_queries/ipmi_sensors_voltage.xml'
+ Found data query XML file at '/usr/local/share/cacti/resource/script_queries/ipmi_sensors_voltage.xml'
+ Found data query XML file at '/usr/local/share/cacti/resource/script_queries/ipmi_sensors_voltage.xml'
+ Found data query XML file at '/usr/local/share/cacti/resource/script_queries/ipmi_sensors_voltage.xml'
|
However, when I try to create the graphs, the results look like this:
| Code: | Notice: Undefined index: local_data_id in /usr/local/share/cacti/graphs_new.php on line 202
Warning: Invalid argument supplied for foreach() in /usr/local/share/cacti/graphs_new.php on line 202
Warning: Cannot modify header information - headers already sent by (output started at /usr/local/share/cacti/graphs_new.php:202) in /usr/local/share/cacti/graphs_new.php on line 86
|
When I try to run the scripts by hand, using my own userid, I get these results (I also got the same error in cacti the first time I tried to create the graphs):
| Code: | 103% php scripts/ipmi_sensors.php VOLTAGE 127.0.0.1 "" "" query sensorreading
failed: no results returned from /usr/local/bin/ipmitool sdr type voltage -I lan -H 127.0.0. -U "" -P "" 2> /dev/null
104% php scripts/ipmi_sensors.php VOLTAGE 127.0.0.1 "" "" index
failed: no results returned from /usr/local/bin/ipmitool sdr type voltage -I lan -H 127.0.0. -U "" -P "" 2> /dev/null
|
If I do this as superuser, I get different results:
| Code: | 106% sudo php scripts/ipmi_sensors.php FAN 127.0.0.1 "" "" query sensorreading
1:4875
2:4800
3:4950
4:4800
5:4800
6:4875
7:1800
8:1800
9:1800
10:1800
11:1800
12:1800
13:1800
14:1800
107% sudo php scripts/ipmi_sensors.php FAN 127.0.0.1 "" "" index
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| If I do it as the cacti user, I get no response:
| Code: | | 101% su cacti -c php scripts/ipmi_sensors.php TEMPERATURE 127.0.0.1 "" "" query sensorreading |
(hangs until interrupted)
Anyone have any idea what kind of permissions problem this is? |
|
| Back to top |
|
 |
ehall Cacti User
Joined: 09 Dec 2005 Posts: 237
|
Posted: Wed May 20, 2009 5:22 pm Post subject: |
|
|
the first three debug snippets show that the cacti server is able to execute the script and get the data. however there are other problems here.
for exmple, you are getting inconsistent results among your different accounts because you are passing different commands, and they are being processed differently. the working debug example uses "php -q /usr/local/share/cacti/scripts/ipmi_sensors.php fan 127.0.0.1, , , index" with commas separating the parameters, while the commands you are using from your own userid and sudo lack the commas
meanwhile, the graph errors look like permission problems with the account that the Cacti scripts are running under (apache has insufficient privs to the cacti directory maybe?) also the poller runs under whatever account you set in cron, which is probably different from the account that is used for the debug results.
so basically use the same command everywhere, and make sure that the apache and cron accounts have sufficient privileges |
|
| Back to top |
|
 |
techn0mad
Joined: 20 May 2009 Posts: 3
|
Posted: Wed May 20, 2009 8:26 pm Post subject: Permissions |
|
|
| ehall wrote: | the first three debug snippets show that the cacti server is able to execute the script and get the data. however there are other problems here.
for example, you are getting inconsistent results among your different accounts because you are passing different commands, and they are being processed differently. the working debug example uses "php -q /usr/local/share/cacti/scripts/ipmi_sensors.php fan 127.0.0.1, , , index" with commas separating the parameters, while the commands you are using from your own userid and sudo lack the commas
meanwhile, the graph errors look like permission problems with the account that the Cacti scripts are running under (apache has insufficient privs to the cacti directory maybe?) also the poller runs under whatever account you set in cron, which is probably different from the account that is used for the debug results.
so basically use the same command everywhere, and make sure that the apache and cron accounts have sufficient privileges |
After reading the earlier posts in the thread, it seems like many people forgot the commas. However, what I am currently seeing is that only root can successfully execute the PHP script and get the data:
| Code: | 191% /usr/local/bin/php scripts/ipmi_sensors.php FAN 127.0.0.1, , , query sensorreading
1:4800
2:4875
3:4950
4:4800
5:4800
6:4875
7:1800
8:1800
9:1800
10:1800
11:1800
12:1800
13:1800
14:1800
192% su cacti -c /usr/local/bin/php scripts/ipmi_sensors.php FAN 127.0.0.1, , , query sensorreading
^C |
My crontab job for the poller runs as the Cacti user (cacti), and Apache runs as the user "www", so from your comments, I wonder what permissions need to be set? I've added "www" to the "cacti" group, but I wonder if that's sufficient? Is there a reference somewhere that explains the permission relations between Apache, cron and Cacti in detail?
Thanks for your quick response. |
|
| Back to top |
|
 |
ehall Cacti User
Joined: 09 Dec 2005 Posts: 237
|
Posted: Thu May 21, 2009 7:01 am Post subject: Re: Permissions |
|
|
| techn0mad wrote: | | what I am currently seeing is that only root can successfully execute the PHP script and get the data: |
check the permissions on /dev/ipmi*
| Quote: | | My crontab job for the poller runs as the Cacti user (cacti), and Apache runs as the user "www", so from your comments, I wonder what permissions need to be set? I've added "www" to the "cacti" group, but I wonder if that's sufficient? Is there a reference somewhere that explains the permission relations between Apache, cron and Cacti in detail? |
I don't know. It looks to me like data isn't getting passed to graph_new.php so I suspect that some process is having a problem with writing or reading the sample data, but that's just a guess. |
|
| Back to top |
|
 |
techn0mad
Joined: 20 May 2009 Posts: 3
|
Posted: Thu May 21, 2009 3:21 pm Post subject: Locating ipmitool |
|
|
| ehall wrote: | meanwhile, the graph errors look like permission problems with the account that the Cacti scripts are running under (apache has insufficient privs to the cacti directory maybe?) also the poller runs under whatever account you set in cron, which is probably different from the account that is used for the debug results.
so basically use the same command everywhere, and make sure that the apache and cron accounts have sufficient privileges |
After a modest amount of hair-pulling and teeth-gnashing, I found that the permissions problem has to do with locating ipmitool. At line 171 of ipmi_sensors.php, the following code uses which(1) to find ipmitools:
| Code: | #
# look for ipmitool
#
$cmdtool = exec ('which ipmitool 2>/dev/null');
if ($cmdtool == "") {
echo ("failed: ipmitool cannot be found. Install it in the path with appropriate permissions.\n");
exit(1);
}
|
What I find is that if this is run from any account that actually has a shell, ipmitool is located correctly. However, on my system (FreeBSD 7), the relevant accounts (www, cacti, nobody) all have a shell of /sbin/nologin, which presumably has no environment variables, no $PATH, and hence which does not find any executable for which(1).
I was able to make a quick workaround for this problem by hard-coding the location of ipmitool:
| Code: | # look for ipmitool
#
$cmdtool = exec ('which ipmitool 2>/dev/null');
$cmdtool = "/usr/local/bin/ipmitool";
if ($cmdtool == "") {
echo ("failed: ipmitool cannot be found. Install it in the path with appropriate permissions.\n");
exit(1);
}
|
Now the graphs are getting data correctly, but I imagine that there's a cleaner fix for this.
Cheers, |
|
| Back to top |
|
 |
ehall Cacti User
Joined: 09 Dec 2005 Posts: 237
|
Posted: Thu May 21, 2009 11:50 pm Post subject: |
|
|
cron also uses a very limited path by default, which can also cause all kinds of problems. the usual fix is to put those tools in the path or to put a symlink in the path. alternatively you can make an app-specific profile and add a command to source it when cron runs, something like (off the top of my head):
| Code: | | */5 * * * * wwwrun . /var/cacti/poller.profile; php /var/cacti/poller.php > /dev/null 2>&1 |
Then you could extend the path, add your IPMI username, whatever |
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|