Yet Another NUT (Network UPS Tools) Status
Moderators: Developers, Moderators
Yet Another NUT (Network UPS Tools) Status
Hi all,
I have been using this one since long, but forget to share it with you
The tarball contains a Ruby script to collect NUT data and a graph template; put the config.rb somewhere in your /usr/local/lib/site_ruby/1.x/, and the other script in to your cacti/scripts directory, import the graph template in to your working cacti.
You will need to pass on the UPS name/id as parameter like ups0@example.com to monitor it.
Hope it is almost as useful to you as it is for me.
Cheers!
I have been using this one since long, but forget to share it with you
The tarball contains a Ruby script to collect NUT data and a graph template; put the config.rb somewhere in your /usr/local/lib/site_ruby/1.x/, and the other script in to your cacti/scripts directory, import the graph template in to your working cacti.
You will need to pass on the UPS name/id as parameter like ups0@example.com to monitor it.
Hope it is almost as useful to you as it is for me.
Cheers!
- Attachments
-
- cacti-nut-ups-status-0.0.1.tar.gz
- Contains Ruby scripts and graph template
- (6.23 KiB) Downloaded 3279 times
Balwinder S "bsd" Dheeman
http://cto.homelinux.net/~bsd
http://cto.homelinux.net/~bsd
-
- Posts: 1
- Joined: Sat Sep 16, 2006 7:37 pm
Thank you for sharing this, it works well.
I only had to change line 14 of the file "nut_ups_status.rb" to get it to work,
so it pointed to the correct config file:
It seems like it looks something from the config, but i couln't find the location where to set it from the cacti-web-interface, so i changed it manually in the file.
Thanks again!
I only had to change line 14 of the file "nut_ups_status.rb" to get it to work,
so it pointed to the correct config file:
Code: Select all
conf = Config::read "/etc/ups/upsd.users"
Thanks again!
You're welcome!Morpheus4you wrote:Thank you for sharing this, it works well.
It trys to read password for user cacti from /etc/nut/upsd.users file; will continue even if you have not defined one. The path to upsd.users file depends on distro and, or packaging.Morpheus4you wrote: I only had to change line 14 of the file "nut_ups_status.rb" to get it to work,
so it pointed to the correct config file:
It seems like it looks something from the config, but i couln't find the location where to set it from the cacti-web-interface, so i changed it manually in the file.Code: Select all
conf = Config::read "/etc/ups/upsd.users"
Welcome againMorpheus4you wrote:Thanks again!
Balwinder S "bsd" Dheeman
http://cto.homelinux.net/~bsd
http://cto.homelinux.net/~bsd
Problem with no rrd graphs being displayed
I had the problem that the graphs were not being generated. I simply deleted the statement "-y-grid=v" from the rrd template definition and everything worked.
Fixing a few niggles
Hi,
I was trying this using a Ubuntu 6.06 server with apache and cacti installed via apt (standard stuff)
I had a few little niggly issues: firstly I mis-read the original post and put the config.rb file in the wrong place (I got the config.rb and nut_ups_status.rb the wrong way around, doh!).
Importing the XML file caused some errors for me. I tracked this down the the degrees symbol not being a valid XML entity! I've removed the 2 symbols from the XML, and it imported successfully.
Once I got to the bottom of that, I still had some issues. I was getting errors in the /usr/share/cacti/site/log/poller-error.log file.
I added some configuration to my upsd.users file
---
[cacti]
password=password
allowfrom=local
upsmon slave
---
and this resolved part of the issue. The other problem was that the web server could not read the upsd.users file (not sure if this is strictly essential, but it logs an error).
Hacking slightly, I just ran this
chmod o+r /etc/nut/upsd.users
Which resolve the issue. I intend to sort out proper group permissions for this file later!
Hope this helps someone. I've attached a new zip, with the updated XML file, and a readme.txt file which details how I installed it.
Great script, really really useful, thanks for your hard work in writing this in the first place!!
Cheers,
Mark
I was trying this using a Ubuntu 6.06 server with apache and cacti installed via apt (standard stuff)
I had a few little niggly issues: firstly I mis-read the original post and put the config.rb file in the wrong place (I got the config.rb and nut_ups_status.rb the wrong way around, doh!).
Importing the XML file caused some errors for me. I tracked this down the the degrees symbol not being a valid XML entity! I've removed the 2 symbols from the XML, and it imported successfully.
Once I got to the bottom of that, I still had some issues. I was getting errors in the /usr/share/cacti/site/log/poller-error.log file.
I added some configuration to my upsd.users file
---
[cacti]
password=password
allowfrom=local
upsmon slave
---
and this resolved part of the issue. The other problem was that the web server could not read the upsd.users file (not sure if this is strictly essential, but it logs an error).
Hacking slightly, I just ran this
chmod o+r /etc/nut/upsd.users
Which resolve the issue. I intend to sort out proper group permissions for this file later!
Hope this helps someone. I've attached a new zip, with the updated XML file, and a readme.txt file which details how I installed it.
Great script, really really useful, thanks for your hard work in writing this in the first place!!
Cheers,
Mark
- Attachments
-
- cacti-nut-ups-status-0.0.1-patch.zip
- Patched version with XML fix and a readme.txt instructions file
- (7.31 KiB) Downloaded 1792 times
Almost Working!!!
Man ive spent days trying to get this working following every step.
First the xml issue happened to me aswell.
And other few glitches.
But eventually i was presented with emty graphs.
After much searching i checked the cacti.log
and was presented with a
"CMDPHP: Poller[0] Host[1] DS[19] WARNING: Result from CMD not valid. Partial Result:"
I have tried running the poller manually as root. This presents me with values and it starts graphing. Then i attempted to change to the user "cacti" to see if this is a permission issue. Running it as user "cacti" as per cron job also presented the graphs.
However it DOES not do so automatically from crontab.
I have the default crontab entry for cacti as follows:
*/5 * * * * cacti /usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null 2>&1
I have also tried to change the user to root in the crontab, this also does not work.
It seems it ONLY creates the graphs when the cacti poller is run manually.
This is really confusing me as i have no idea whats causing this.
YelP! ;p
First the xml issue happened to me aswell.
And other few glitches.
But eventually i was presented with emty graphs.
After much searching i checked the cacti.log
and was presented with a
"CMDPHP: Poller[0] Host[1] DS[19] WARNING: Result from CMD not valid. Partial Result:"
I have tried running the poller manually as root. This presents me with values and it starts graphing. Then i attempted to change to the user "cacti" to see if this is a permission issue. Running it as user "cacti" as per cron job also presented the graphs.
However it DOES not do so automatically from crontab.
I have the default crontab entry for cacti as follows:
*/5 * * * * cacti /usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null 2>&1
I have also tried to change the user to root in the crontab, this also does not work.
It seems it ONLY creates the graphs when the cacti poller is run manually.
This is really confusing me as i have no idea whats causing this.
YelP! ;p
Even Tried Replaceing Poller
Ive even tried replacing poller to cactid to see if i can get any additional info.
logs show following....
11/06/2007 10:20:01 PM - CACTID: Poller[0] Host[1] DS[19] WARNING: Result from SCRIPT not valid. Partial Result: ...
11/06/2007 10:20:01 PM - CACTID: Poller[0] Host[1] ERROR: Empty result [127.0.0.1]: 'ruby /usr/local/share/cacti/scripts/nut_ups_status.rb ups@localhost'
However running command directly as cacti user shows following....
blvl:97.5 ivol:226.9 load:24.0 ovol:226.9 stat:1 temp:25.0
logs show following....
11/06/2007 10:20:01 PM - CACTID: Poller[0] Host[1] DS[19] WARNING: Result from SCRIPT not valid. Partial Result: ...
11/06/2007 10:20:01 PM - CACTID: Poller[0] Host[1] ERROR: Empty result [127.0.0.1]: 'ruby /usr/local/share/cacti/scripts/nut_ups_status.rb ups@localhost'
However running command directly as cacti user shows following....
blvl:97.5 ivol:226.9 load:24.0 ovol:226.9 stat:1 temp:25.0
I actually got the poller thing worked out, it was related to the config.rb path, but I'm still getting a broken graph (not graphing at all). Checking the apache error logs, I see this:
I'm definitely getting data:
Here is the output from graph debug:
RRDTool Command:
Any ideas as to what the problem is?
Thanks
hanji
Code: Select all
ERROR: invalid y-grid format
Code: Select all
./nut_ups_status.rb server@localhost
blvl:100 ivol:121 load:022 ovol: stat:1 temp:45.0
RRDTool Command:
Code: Select all
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Backup Server - NUT/UPS Status" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--y-grid=v \
--vertical-label="volts/level/load/temp" \
--slope-mode \
DEF:a="/var/www/localhost/htdocs/cacti/rra/backup_server_temp_54.rrd":ovol:AVERAGE \
DEF:b="/var/www/localhost/htdocs/cacti/rra/backup_server_temp_54.rrd":ivol:AVERAGE \
DEF:c="/var/www/localhost/htdocs/cacti/rra/backup_server_temp_54.rrd":blvl:AVERAGE \
DEF:d="/var/www/localhost/htdocs/cacti/rra/backup_server_temp_54.rrd":load:AVERAGE \
DEF:e="/var/www/localhost/htdocs/cacti/rra/backup_server_temp_54.rrd":temp:AVERAGE \
AREA:a#FF99FF:"Output" \
GPRINT:a:LAST:" Current\:%8.2lf %s" \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n" \
AREA:b#FFFF66:"Input" \
GPRINT:b:LAST:" Current\:%8.2lf %s" \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" \
LINE2:c#666633:"Batteries" \
GPRINT:c:LAST:" Current\:%8.2lf %%" \
GPRINT:c:AVERAGE:"Average\:%8.2lf %%" \
GPRINT:c:AVERAGE:"Maximum\:%8.2lf %%\n" \
LINE2:d#0033FF:"Load" \
GPRINT:d:LAST:" Current\:%8.2lf %%" \
GPRINT:d:AVERAGE:"Average\:%8.2lf %%" \
GPRINT:d:MAX:"Maximum\:%8.2lf %%\n" \
LINE2:e#FF3300:"Temprature" \
GPRINT:e:LAST:"Current\:%8.2lf C" \
GPRINT:e:AVERAGE:"Average\:%8.2lf C" \
GPRINT:e:MAX:"Maximum\:%8.2lf C"
RRDTool Says:
ERROR: invalid y-grid format
Thanks
hanji
[url=http://www.uno-code.com]Server Admin Blog - Uno-Code.com[/url]
Still No Luck Here!
I had already removed the axis problem, so twas not the issue for me.
Mine "seems" to be some permission issue. The odest thing i tell you.
I will post a debug screen aswell from cacti soon. Just as soon as i switch that box back on. Pitty i can't get no advise on this one.
.:thavinci:.
Mine "seems" to be some permission issue. The odest thing i tell you.
I will post a debug screen aswell from cacti soon. Just as soon as i switch that box back on. Pitty i can't get no advise on this one.
.:thavinci:.
More issues
After waiting a while hopying to get a clear head and tackle this one again ive still come up emty.....
Whereass allowing cacti to do its thing on own presents emty graphs.
cacti shows the following error in cacti.log when running on own....
All good :<
Running poller manually presents with .....RRDTool Command:
/usr/local/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Localhost - NUT/UPS Status" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="volts/level/load/temp" \
--slope-mode \
DEF:a="/usr/local/share/cacti/rra/localhost_stat_19.rrd":ovol:AVERAGE \
DEF:b="/usr/local/share/cacti/rra/localhost_stat_19.rrd":ivol:AVERAGE \
DEF:c="/usr/local/share/cacti/rra/localhost_stat_19.rrd":blvl:AVERAGE \
DEF:d="/usr/local/share/cacti/rra/localhost_stat_19.rrd":load:AVERAGE \
DEF:e="/usr/local/share/cacti/rra/localhost_stat_19.rrd":temp:AVERAGE \
AREA:a#FF99FF:"Output" \
GPRINTLAST:" Current\:%8.2lf %s" \
GPRINTAVERAGE:"Average\:%8.2lf %s" \
GPRINTMAX:"Maximum\:%8.2lf %s\n" \
AREA:b#FFFF66:"Input" \
GPRINTLAST:" Current\:%8.2lf %s" \
GPRINTAVERAGE:"Average\:%8.2lf %s" \
GPRINTMAX:"Maximum\:%8.2lf %s\n" \
LINE2:c#666633:"Batteries" \
GPRINT:c:LAST:" Current\:%8.2lf %%" \
GPRINT:c:AVERAGE:"Average\:%8.2lf %%" \
GPRINT:c:AVERAGE:"Maximum\:%8.2lf %%\n" \
LINE2:d#0033FF:"Load" \
GPRINT:d:LAST:" Current\:%8.2lf %%" \
GPRINT:d:AVERAGE:"Average\:%8.2lf %%" \
GPRINT:d:MAX:"Maximum\:%8.2lf %%\n" \
LINE2:e#FF3300:"Temprature" \
GPRINT:e:LAST:"Current\:%8.2lfC" \
GPRINT:e:AVERAGE:"Average\:%8.2lfC" \
GPRINT:e:MAX:"Maximum\:%8.2lfC"
RRDTool Says:
OK
Running poller manually presents still with possitive result and fully operational..[root@???? /home/thavinci]# /usr/local/bin/php /usr/local/share/cacti/poller.php
OK u:0.00 s:0.00 r:0.04
OK u:0.00 s:0.00 r:0.05
OK u:0.00 s:0.00 r:0.05
OK u:0.00 s:0.00 r:0.05
OK u:0.00 s:0.00 r:0.05
OK u:0.00 s:0.00 r:0.05
OK u:0.00 s:0.00 r:0.05
OK u:0.00 s:0.00 r:0.05
OK u:0.00 s:0.00 r:0.05
OK u:0.00 s:0.00 r:0.05
OK u:0.00 s:0.00 r:0.06
OK u:0.00 s:0.00 r:0.06
OK u:0.00 s:0.00 r:0.06
OK u:0.00 s:0.00 r:0.06
OK u:0.00 s:0.00 r:0.06
OK u:0.00 s:0.00 r:6.12
OK u:0.00 s:0.00 r:6.12
OK u:0.00 s:0.00 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
OK u:0.00 s:0.01 r:6.12
12/03/2007 03:27:03 PM - SYSTEM STATS: Time:7.1529 Method:cactid Processes:1 Threads:1 Hosts:3 HostsPerProcess:3 DataSources:46 RRDsProcessed:39
Segmentation fault: 11 (core dumped)
Whereass allowing cacti to do its thing on own presents emty graphs.
cacti shows the following error in cacti.log when running on own....
Yet when poller is run manually....12/03/2007 03:30:09 PM - SYSTEM STATS: Time:8.1736 Method:cactid Processes:1 Threads:1 Hosts:3 HostsPerProcess:3 DataSources:46 RRDsProcessed:39
12/03/2007 03:30:02 PM - CACTID: Poller[0] Host[1] DS[19] WARNING: Result from SCRIPT not valid. Partial Result: ...
12/03/2007 03:30:02 PM - CACTID: Poller[0] Host[1] ERROR: Empty result [127.0.0.1]: 'ruby /usr/local/share/cacti/scripts/nut_ups_status.rb ups@localhost'
12/03/2007 03:27:03 PM - SYSTEM STATS: Time:7.1529 Method:cactid Processes:1 Threads:1 Hosts:3 HostsPerProcess:3 DataSources:46 RRDsProcessed:39
12/03/2007 03:26:35 PM - SYSTEM STATS: Time:7.1543 Method:cactid Processes:1 Threads:1 Hosts:3 HostsPerProcess:3 DataSources:46 RRDsProcessed:39
12/03/2007 03:25:17 PM - SYSTEM STATS: Time:7.1501 Method:cactid Processes:1 Threads:1 Hosts:3 HostsPerProcess:3 DataSources:46 RRDsProcessed:39
12/03/2007 03:25:08 PM - SYSTEM STATS: Time:7.1503 Method:cactid Processes:1 Threads:1 Hosts:3 HostsPerProcess:3 DataSources:46 RRDsProcessed:39
12/03/2007 03:25:01 PM - CACTID: Poller[0] Host[1] DS[19] WARNING: Result from SCRIPT not valid. Partial Result: ...
12/03/2007 03:25:01 PM - CACTID: Poller[0] Host[1] ERROR: Empty result [127.0.0.1]: 'ruby /usr/local/share/cacti/scripts/nut_ups_status.rb ups@localhost'
12/03/2007 03:34:23 PM - SYSTEM STATS: Time:7.2649 Method:cactid Processes:1 Threads:1 Hosts:3 HostsPerProcess:3 DataSources:47 RRDsProcessed:40
All good :<
At least im not alone!
At least im not the only one!
Hope someone can find a fix..
Hope someone can find a fix..
Who is online
Users browsing this forum: No registered users and 2 guests