LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   UPS Monitoring without SNMP (apcupsd > zabbix) - Need some help (https://www.linuxquestions.org/questions/linux-server-73/ups-monitoring-without-snmp-apcupsd-zabbix-need-some-help-831752/)

fruitwerks 09-12-2010 04:11 PM

[SOLVED!] UPS Monitoring without SNMP (apcupsd > zabbix) - Need some help
 
So I looked around and I haven't found an answer, but I did see some advanced applications for unsupported methods. They all involve putting the data into a file that Zabbix can read.

Here is the data as dumped by apcupsd every 5 seconds:

Code:

APC      : 001,038,0994
DATE    : Sun Sep 12 14:52:34 MDT 2010
HOSTNAME : atom
VERSION  : 3.14.6 (16 May 2009) debian
UPSNAME  : xs1300a
CABLE    : USB Cable
MODEL    : Back-UPS XS 1300 LCD
UPSMODE  : Stand Alone
STARTTIME: Sun Sep 12 14:49:42 MDT 2010
STATUS  : BOOST MODE
LINEV    : 91.0 Volts
LOADPCT  :  22.0 Percent Load Capacity
BCHARGE  : 100.0 Percent
TIMELEFT :  27.1 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME  : 0 Seconds
SENSE    : Medium
LOTRANS  : 088.0 Volts
HITRANS  : 139.0 Volts
ALARMDEL : Always
BATTV    : 26.9 Volts
LASTXFER : Unacceptable line voltage changes
NUMXFERS : 1
XONBATT  : Sun Sep 12 14:50:12 MDT 2010
TONBATT  : 0 seconds
CUMONBATT: 1 seconds
XOFFBATT : Sun Sep 12 14:50:13 MDT 2010
SELFTEST : NO
STATFLAG : 0x07000008 Status Flag
MANDATE  : 2008-03-05
SERIALNO : JB0810002218
BATTDATE : 2065-00-38
NOMINV  : 120 Volts
NOMBATTV :  24.0 Volts
NOMPOWER : 780 Watts
FIRMWARE : 836.H7 .D USB FW:H7
APCMODEL : Back-UPS XS 1300 LC
END APC  : Sun Sep 12 14:52:35 MDT 2010

What I am interested in is the voltages and percentages. I could care less about the bool values. I know this involves some fancy cut / head / tail / grep stuff, and that has always been my weak area. I looked at the zabbix docs and nothing clicked for me.

So if anyone knows what format this data needs to be converted to - and how to do it, I can get it going from there.

Thanks!

amarand 10-13-2010 11:18 AM

Quote:

Originally Posted by fruitwerks (Post 4095418)
What I am interested in is the voltages and percentages. I could care less about the bool values. I know this involves some fancy cut / head / tail / grep stuff, and that has always been my weak area. I looked at the zabbix docs and nothing clicked for me.

So if anyone knows what format this data needs to be converted to - and how to do it, I can get it going from there.


Looks like we're UPS buddies! I love that series of APC product. I'm running the upsaccess command contained within apcupsd-3.14.0-3.el5. I'm assuming you're using something similar.

So is it just that you want to take that output and send yourself a regular e-mail with the specific numbers, or do you need to have those numbers monitored for high and low values? You mentioned Zabbix, so I'm assuming you want these values monitored and reported when found to be outside of ranges, correct?

fruitwerks 10-13-2010 11:53 AM

I totally forgot I had posted here!

forgot exactly what settings I did for the apcupsd, but it overwrites the file and in my agentd conf I have something like this..

Code:

UserParameter=UPSLine,awk < /var/log/apcupsd.status '/^(LINEV).*:/ { print $3 }'
UserParameter=UPSLoad,awk < /var/log/apcupsd.status '/^(LOADPCT).*:/ { print $3 }'
UserParameter=UPSBatt,awk < /var/log/apcupsd.status '/^(BCHARGE).*:/ { print $3 }'
#UserParameter=UPSTime,awk < /var/log/apcupsd.status '/^(TIMELEFT).*:/ { print $3 }'
#UserParameter=UPSBcap,awk < /var/log/apcupsd.status '/^(BATTV).*:/ { print $3 }'

http://www.imagebam.com/image/d65a4a101982570

Working very well! Took me a while to figure out how it all worked, but it was well worth the effort. As you see I was having some issues and I wanted to get some proof.

amarand 10-13-2010 12:40 PM

Ah, excellent! Glad you got it working.

I may try this out, because it's nice to be able to report with hard facts.

I haven't asked a question here yet, so I don't know how to mark things "Solved" but you might want to do that so it falls off The List (if there is one) of unanswered questions. I was just going through the Zero Reply Threads looking for things I've worked on before. I love APC UPS monitoring on Linux!

fruitwerks 10-13-2010 01:01 PM

good call, I always forget that. very OT, but my issue was my neutral wire at the pole, only had about 15% of the original conductivity. It was a big mess, you can't see on the graph, but we had a spike of 145V and that blew out a surge suppressor and started a fire! We were home and I had recently purchased an extinguisher so the damage was minimal.

On an on-topic note, this same method can be applied to many things that can report data in a similar method. I can't think of any, but I can imagine simple serial devices like environmental sensors and such would be a possibility

niceguy167 07-27-2013 06:34 AM

Needing some help, I have Zabbix working perfectly, and I have apcupsd working great too.
Can you post specifics how you got it working? like what options you added and what steps you took.
That would greatly help
Thanks
Steven

Habitual 07-27-2013 08:03 AM

Steven:

You shouldn't reply to old threads, but start a new one.
Here's how this works:

On the zabbix target that runs zabbix_agentd, edit the /etc/zabbix/zabbix_agentd.conf and insert these lines:
Code:

UserParameter=UPSLine,awk < /var/log/apcupsd.status '/^(LINEV).*:/ { print $3 }'
UserParameter=UPSLoad,awk < /var/log/apcupsd.status '/^(LOADPCT).*:/ { print $3 }'
UserParameter=UPSBatt,awk < /var/log/apcupsd.status '/^(BCHARGE).*:/ { print $3 }'

and restart the zabbix_agent.

In the zabbix web interface for the same host, you'll create 3 new items with the following key values. (Do not use the Select button, they may not be there) Enter these items manually.
Code:

UPSLine
UPSLoad
UPSBatt

Probably a Character "Type of information" and then set the rest of the Item values. I've used Character to get the mysql.replication status on a remote host, but when I switched i to Text, I lost my history for the item. The reply from mysql.slave.status via
Code:

UserParameter=mysql.slave.status,mysql -e "show slave status\G;" | grep Slave_SQL_Running | awk '{print $2}'
The comnand in Bold Red return the string "Yes".
The actual command-line command being hightlighted in Bold Red.
NOTE: The first example from the OP should work for a UPS, but can be used for other custom Items for a given host.

https://www.zabbix.com/documentation...ser_parameters
https://www.zabbix.com/documentation...l/config/items

I hope that's clear.
HTH.


All times are GMT -5. The time now is 07:32 AM.