LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-12-2010, 04:11 PM   #1
fruitwerks
Member
 
Registered: Apr 2009
Posts: 77

Rep: Reputation: 15
[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!

Last edited by fruitwerks; 10-13-2010 at 12:56 PM. Reason: SOLVED!
 
Old 10-13-2010, 11:18 AM   #2
amarand
LQ Newbie
 
Registered: Oct 2010
Location: Galloway, Ohio, USA
Distribution: CentOS
Posts: 19

Rep: Reputation: 7
Question

Quote:
Originally Posted by fruitwerks View Post
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?
 
Old 10-13-2010, 11:53 AM   #3
fruitwerks
Member
 
Registered: Apr 2009
Posts: 77

Original Poster
Rep: Reputation: 15
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.
 
Old 10-13-2010, 12:40 PM   #4
amarand
LQ Newbie
 
Registered: Oct 2010
Location: Galloway, Ohio, USA
Distribution: CentOS
Posts: 19

Rep: Reputation: 7
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!
 
Old 10-13-2010, 01:01 PM   #5
fruitwerks
Member
 
Registered: Apr 2009
Posts: 77

Original Poster
Rep: Reputation: 15
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
 
Old 07-27-2013, 06:34 AM   #6
niceguy167
LQ Newbie
 
Registered: Jul 2013
Posts: 1

Rep: Reputation: Disabled
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
 
Old 07-27-2013, 08:03 AM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
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.

Last edited by Habitual; 07-27-2013 at 08:06 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
APCUPSD - Unable to create UPS lock file sirpimpsalot Linux - Software 7 03-14-2017 09:46 PM
APC Smart-UPS and apcupsd michaelsr Linux - Software 4 06-24-2014 06:49 AM
APC UPS - apcupsd on Ubuntu 8.04 not sending emails bob808 Linux - Software 1 04-24-2009 12:08 PM
apcupsd (UPS monitoring) maniannam Linux - Networking 0 12-31-2008 08:43 AM
apcupsd - power off UPS problem eyt Linux - General 1 02-14-2006 01:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration