Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Wed Mar 29, 2017 7:58 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Yet Another NUT (Network UPS Tools) Status
PostPosted: Tue Jun 27, 2006 8:41 am 
Offline
User avatar

Joined: Tue Jun 27, 2006 8:00 am
Posts: 3
Location: Chandigarh, UT, India
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.

Image

Hope it is almost as useful to you as it is for me.

Cheers!


Attachments:
File comment: Contains Ruby scripts and graph template
cacti-nut-ups-status-0.0.1.tar.gz [6.23 KiB]
Downloaded 2820 times

_________________
Balwinder S "bsd" Dheeman
http://cto.homelinux.net/~bsd
Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 16, 2006 7:42 pm 
Offline

Joined: Sat Sep 16, 2006 7:37 pm
Posts: 1
Location: Arnhem, Netherlands
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:

Code:
conf = Config::read "/etc/ups/upsd.users"


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!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 30, 2006 3:33 pm 
Offline
User avatar

Joined: Tue Jun 27, 2006 8:00 am
Posts: 3
Location: Chandigarh, UT, India
Morpheus4you wrote:
Thank you for sharing this, it works well.


You're welcome!

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:

Code:
conf = Config::read "/etc/ups/upsd.users"


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.


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:
Thanks again!


Welcome again ;)

_________________
Balwinder S "bsd" Dheeman
http://cto.homelinux.net/~bsd


Top
 Profile  
 
 Post subject: Problem with no rrd graphs being displayed
PostPosted: Wed Mar 07, 2007 12:42 pm 
Offline

Joined: Wed Mar 07, 2007 12:28 pm
Posts: 1
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.


Top
 Profile  
 
 Post subject: Fixing a few niggles
PostPosted: Wed May 09, 2007 6:01 pm 
Offline

Joined: Wed May 09, 2007 5:41 pm
Posts: 1
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


Attachments:
File comment: Patched version with XML fix and a readme.txt instructions file
cacti-nut-ups-status-0.0.1-patch.zip [7.31 KiB]
Downloaded 1494 times
Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 23, 2007 2:35 pm 
Offline

Joined: Sat Jun 23, 2007 2:34 pm
Posts: 1
Has anyone been able to make this work for remote UPS's

I have a number of them that I would like to graph over time.


Top
 Profile  
 
 Post subject: Almost Working!!!
PostPosted: Tue Nov 06, 2007 12:23 pm 
Offline

Joined: Tue Nov 06, 2007 12:14 pm
Posts: 26
Location: JHB
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.

Image

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


Top
 Profile  
 
 Post subject: Even Tried Replaceing Poller
PostPosted: Tue Nov 06, 2007 3:26 pm 
Offline

Joined: Tue Nov 06, 2007 12:14 pm
Posts: 26
Location: JHB
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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 15, 2007 5:15 pm 
Offline

Joined: Thu Nov 15, 2007 5:14 pm
Posts: 3
Any luck with this? I'm getting the exact same problem.

Thanks!
hanji


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 15, 2007 5:44 pm 
Offline

Joined: Thu Nov 15, 2007 5:14 pm
Posts: 3
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:

Code:
ERROR: invalid y-grid format


I'm definitely getting data:
Code:
./nut_ups_status.rb server@localhost
blvl:100 ivol:121 load:022 ovol: stat:1 temp:45.0


Here is the output from graph debug:
RRDTool Command:

Code:
/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


Any ideas as to what the problem is?

Thanks
hanji

_________________
Server Admin Blog - Uno-Code.com


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 15, 2007 5:52 pm 
Offline

Joined: Thu Nov 15, 2007 5:14 pm
Posts: 3
I'm getting a graph now. I edit'd the graph template and removed the 'v' from 'Unit Grid Value'. Curious if this is normal, or do I need v for useful graphs.. I guess I'll wait and see.

Thanks!
hanji

_________________
Server Admin Blog - Uno-Code.com


Top
 Profile  
 
 Post subject: Still No Luck Here!
PostPosted: Sat Nov 24, 2007 7:18 pm 
Offline

Joined: Tue Nov 06, 2007 12:14 pm
Posts: 26
Location: JHB
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:.


Top
 Profile  
 
 Post subject: More issues
PostPosted: Mon Dec 03, 2007 10:32 am 
Offline

Joined: Tue Nov 06, 2007 12:14 pm
Posts: 26
Location: JHB
After waiting a while hopying to get a clear head and tackle this one again ive still come up emty.....


Quote:
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" \
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.2lfC" \
GPRINT:e:AVERAGE:"Average\:%8.2lfC" \
GPRINT:e:MAX:"Maximum\:%8.2lfC"

RRDTool Says:

OK


Running poller manually presents with .....

Quote:
[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)


Running poller manually presents still with possitive result and fully operational..

Image

Whereass allowing cacti to do its thing on own presents emty graphs.

Image

cacti shows the following error in cacti.log when running on own....

Quote:
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'


Yet when poller is run manually....
Quote:
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 :<

_________________
http://www.thavinci.za.net
http://ddns.thavinci.za.net


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 03, 2007 8:19 pm 
Offline

Joined: Mon Dec 03, 2007 4:21 pm
Posts: 4
I'm having this same issue. I posted my problem in the Help Linux/Unix forums. When I run poller.php manually as the cacti user I have no issues however when I let it run out of cron it just doesn't work.


Top
 Profile  
 
 Post subject: At least im not alone!
PostPosted: Tue Dec 04, 2007 11:02 am 
Offline

Joined: Tue Nov 06, 2007 12:14 pm
Posts: 26
Location: JHB
At least im not the only one!

Hope someone can find a fix..

_________________
http://www.thavinci.za.net
http://ddns.thavinci.za.net


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

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 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