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    


Yet Another NUT (Network UPS Tools) Status
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
bsd



Joined: 27 Jun 2006
Posts: 2
Location: Chandigarh, UT, India

PostPosted: Tue Jun 27, 2006 8:41 am    Post subject: Yet Another NUT (Network UPS Tools) Status Reply with quote

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!



cacti-nut-ups-status-0.0.1.tar.gz
 Description:
Contains Ruby scripts and graph template

Download
 Filename:  cacti-nut-ups-status-0.0.1.tar.gz
 Filesize:  6.23 KB
 Downloaded:  889 Time(s)

Back to top
Morpheus4you



Joined: 16 Sep 2006
Posts: 1
Location: Arnhem, Netherlands

PostPosted: Sat Sep 16, 2006 7:42 pm    Post subject: Reply with quote

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!
Back to top
bsd



Joined: 27 Jun 2006
Posts: 2
Location: Chandigarh, UT, India

PostPosted: Sat Sep 30, 2006 3:33 pm    Post subject: Reply with quote

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



Joined: 07 Mar 2007
Posts: 1

PostPosted: Wed Mar 07, 2007 12:42 pm    Post subject: Problem with no rrd graphs being displayed Reply with quote

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.
Back to top
mmcnamee



Joined: 09 May 2007
Posts: 1

PostPosted: Wed May 09, 2007 6:01 pm    Post subject: Fixing a few niggles Reply with quote

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



cacti-nut-ups-status-0.0.1-patch.zip
 Description:
Patched version with XML fix and a readme.txt instructions file

Download
 Filename:  cacti-nut-ups-status-0.0.1-patch.zip
 Filesize:  7.31 KB
 Downloaded:  385 Time(s)

Back to top
dblosvn



Joined: 23 Jun 2007
Posts: 1

PostPosted: Sat Jun 23, 2007 2:35 pm    Post subject: Reply with quote

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.
Back to top
thavinci



Joined: 06 Nov 2007
Posts: 15
Location: Port-Elizabeth

PostPosted: Tue Nov 06, 2007 12:23 pm    Post subject: Almost Working!!! Reply with quote

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



Joined: 06 Nov 2007
Posts: 15
Location: Port-Elizabeth

PostPosted: Tue Nov 06, 2007 3:26 pm    Post subject: Even Tried Replaceing Poller Reply with quote

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



Joined: 15 Nov 2007
Posts: 3

PostPosted: Thu Nov 15, 2007 5:15 pm    Post subject: Reply with quote

Any luck with this? I'm getting the exact same problem.

Thanks!
hanji
Back to top
hanji



Joined: 15 Nov 2007
Posts: 3

PostPosted: Thu Nov 15, 2007 5:44 pm    Post subject: Reply with quote

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



Joined: 15 Nov 2007
Posts: 3

PostPosted: Thu Nov 15, 2007 5:52 pm    Post subject: Reply with quote

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



Joined: 06 Nov 2007
Posts: 15
Location: Port-Elizabeth

PostPosted: Sat Nov 24, 2007 7:18 pm    Post subject: Still No Luck Here! Reply with quote

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:.
Back to top
thavinci



Joined: 06 Nov 2007
Posts: 15
Location: Port-Elizabeth

PostPosted: Mon Dec 03, 2007 10:32 am    Post subject: More issues Reply with quote

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..



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



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 :<
Back to top
tomines



Joined: 03 Dec 2007
Posts: 4

PostPosted: Mon Dec 03, 2007 8:19 pm    Post subject: Reply with quote

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.
Back to top
thavinci



Joined: 06 Nov 2007
Posts: 15
Location: Port-Elizabeth

PostPosted: Tue Dec 04, 2007 11:02 am    Post subject: At least im not alone! Reply with quote

At least im not the only one!

Hope someone can find a fix..
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  Next
Page 1 of 2

 



Powered by phpBB © 2001, 2005 phpBB Group