Yet Another NUT (Network UPS Tools) Status

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

liveder
Posts: 10
Joined: Mon Dec 10, 2007 6:16 am
Contact:

Post by liveder »

When executing script by myself:
[root@cacti /usr/local/www/data/scripts]# ./nut_ups_status.rb rizhskiy@192.168.241.6
./nut_ups_status.rb:28:in `readline': end of file reached (EOFError)
from ./nut_ups_status.rb:28

in nut_ups_status.rb the 28 line is(the bold one):
else
$s.write("USERNAME cacti\r\n"); $s.readline
[root@cacti /usr/local/www/data/scripts]# uname -a
FreeBSD 7.0-BETA2
[root@cacti /usr/local/www/data/scripts]# pkg_info|grep rub
ruby-1.8.6.111,1 An object-oriented interpreted scripting language

what is the problem?..
thavinci
Posts: 26
Joined: Tue Nov 06, 2007 12:14 pm
Location: JHB
Contact:

*bump*

Post by thavinci »

*bump*
User avatar
bsd
Posts: 3
Joined: Tue Jun 27, 2006 8:00 am
Location: Chandigarh, UT, India
Contact:

Post by bsd »

Hi, friends

I'm sorry for not visiting the cacti forums since long.

As for as remote UPS's are concerned, the script already handles that provided you give it a valid URI e.g. upsX@ups_host.fqdn

Next issue, the users might be facing like not getting the data via cron jobs is/can be due to permissions; please read the NUT documentation carefully and create, set and, or change the privileges accordingly.

Last but may not be the least issue can be the Cacti version itself, I have not upgraded Cacti as yet and even do not plan to do so in the near future, so I shall not be able to test the script and template for newer versions. I therefore, request users to try, adapt and, or modify the same and (re)release the newer and fully working set here.

Thank you,
Balwinder S "bsd" Dheeman
http://cto.homelinux.net/~bsd
matrix200
Posts: 1
Joined: Tue Dec 09, 2008 5:27 pm

Got it working with latest Cacti (FC8 , Cacti 0.8.7b

Post by matrix200 »

Hi all.
After installing the latest Cacti and the script I encountered the same problems as some other users in this thread.
I applied all the fixes suggested here and still no graphs were showing.
As it turns out the problem lies in xml template.
<input_string>ruby <path_cacti>/scripts/nut_ups_status.rb <ups></input_string>
This line is wrong.
First of all the command line arguments are not properly passed to the script (It always gets "ups" as the argument).
I didn't know how to fix this so I made a workaround by hard coding the host and ups name values in the script.

The path_cacti variable is not recognized so instead I made the script executable and changed the line into /usr/share/cacti/scripts/nut_ups_status.rb

Yet another problem lies with upsd.users path.
The line:
conf = Config::read "/etc/nut/upsd.users"
was changed into :
conf = Config::read "/etc/ups/upsd.users"

Then everything started working :)

I hope this helps some other poor users like me who can't figure out why no graph is being created.
mr.Scamp
Posts: 8
Joined: Wed Dec 27, 2006 10:53 am
Contact:

Post by mr.Scamp »

Thre is a strange problem with this graph template.
My cacti 0.8.7g monitors two UPS, Powerware 9120 on the local host, the other, APC 750 is connected to remote host.
Graphing the remote host's UPS is OK, but the graph for local UPS is empty.
I use IPs in arguments of data sources, apc750@172.16.0.16 and powerware9120@172.16.0.10. Tried powerware9120@127.0.0.1 but got no success.
When the script is run manually, the correct data is returned:

Code: Select all

%/usr/local/share/cacti/scripts/nut_ups_status.rb apc750@172.16.0.16 ; echo 
blvl:100 ivol:223.2 load:29.2 ovol:223.2 stat:1 temp:
%/usr/local/share/cacti/scripts/nut_ups_status.rb powerware9120@172.16.0.10 ; echo
blvl:100 ivol:223 load: 38.6 ovol:220 stat:1 temp:31
mr.Scamp
Posts: 8
Joined: Wed Dec 27, 2006 10:53 am
Contact:

Post by mr.Scamp »

The problem was in the leading whitespace before ups.load value. :o
hpma2012
Posts: 2
Joined: Wed Mar 09, 2011 7:32 pm

Re: Yet Another NUT (Network UPS Tools) Status

Post by hpma2012 »

:( This is my problem. Can anyone help one?
RRDTool Command:
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title='Smart-UPS RT-APC-14lou - NUT/UPS Status' \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-min \
--upper-limit=1000 \
--vertical-label='volts/level/load/temp' \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/var/lib/cacti/rra/smart-ups_rt-apc-14lou_blvl_201.rrd":ovol:AVERAGE \
DEF:b="/var/lib/cacti/rra/smart-ups_rt-apc-14lou_blvl_201.rrd":ivol:AVERAGE \
DEF:c="/var/lib/cacti/rra/smart-ups_rt-apc-14lou_blvl_201.rrd":blvl:AVERAGE \
DEF:d="/var/lib/cacti/rra/smart-ups_rt-apc-14lou_blvl_201.rrd":load:AVERAGE \
DEF:e="/var/lib/cacti/rra/smart-ups_rt-apc-14lou_blvl_201.rrd":temp:AVERAGE \
--watermark "hpma" \
AREA:a#FF99FFFF:"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#FFFF66FF:"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#666633FF:"Batteries" \
GPRINT:c:LAST:" Current\:%8.2lf %%" \
GPRINT:c:AVERAGE:"Average\:%8.2lf %%" \
GPRINT:c:AVERAGE:"Maximum\:%8.2lf %%\n" \
LINE2:d#0033FFFF:"Load" \
GPRINT:d:LAST:" Current\:%8.2lf %%" \
GPRINT:d:AVERAGE:"Average\:%8.2lf %%" \
GPRINT:d:MAX:"Maximum\:%8.2lf %%\n" \
LINE2:e#FF3300FF:"Temprature" \
GPRINT:e:LAST:"Current\:%8.2lfC" \
GPRINT:e:AVERAGE:"Average\:%8.2lfC" \
GPRINT:e:MAX:"Maximum\:%8.2lfC"
RRDTool Says:
ERROR: opening '/var/lib/cacti/rra/smart-ups_rt-apc-14lou_blvl_201.rrd': No such file or directory
hpma2012
Posts: 2
Joined: Wed Mar 09, 2011 7:32 pm

Re: Yet Another NUT (Network UPS Tools) Status

Post by hpma2012 »

It works.
I finally found the problem. :lol:
Because I forgot to select "Data Source Active".

Thanks anyway.
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests