Koozali.org: home of the SME Server

Live UPS monitoring, Sysmon?

Offline NoTo

  • ****
  • 113
  • +0/-0
Live UPS monitoring, Sysmon?
« on: July 16, 2008, 09:47:53 PM »
Hi all,

Been looking through and searching on this but can't find anything that really helps, so hopefully some kind soul will give me a pointer.

On SME 7.3 I am using a APC UPS with USB cable for monitoring. I followed the HowTo to set it up and it works fine, I even get an email if it goes to battery.

What I'd really like though is an easy way to monitor it's status, battery level, that it's all working fine etc, and preferably without going to the command line.

So far I have added the Sysmon contrib which is fabulous. It has a link for UPS1 on the upper menu, but clicking on it reveals no information at all, no graph etc, just the Hourly, Weekly, Monthly etc link.

Is that contrib capable of displaying my UPS info with a little tinkering, or does anyopne have a suggestion at all?

Very many thanks,
Graham

Offline byte

  • *
  • 2,183
  • +2/-0
Re: Live UPS monitoring, Sysmon?
« Reply #1 on: July 16, 2008, 09:48:17 PM »
Moving this topic to the SME 7.x contribs forum, it is more appropriate there. Thanks!
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!

Offline okepc

  • ****
  • 118
  • +0/-0
    • http://www.okepc.nl
Re: Live UPS monitoring, Sysmon?
« Reply #2 on: July 17, 2008, 09:34:28 AM »
I have installed the systemmonitor from mastersleepy in combination with apcupsd and i get graphs about main and output voltage , runtime , temperature , battery voltage.

From what i understand is that mastersleepy's improved code is goin to merge into sysmon but i don't know if ups statistics from apcupsd work in sysmon.

Dirk 

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Live UPS monitoring, Sysmon?
« Reply #3 on: July 17, 2008, 01:59:17 PM »
I have installed the systemmonitor from mastersleepy in combination with apcupsd and i get graphs about main and output voltage , runtime , temperature , battery voltage.

From what i understand is that mastersleepy's improved code is goin to merge into sysmon but i don't know if ups statistics from apcupsd work in sysmon.

Dirk 
AFAIK the UPS code should also be working in the default one, the code is not MasterSleepy's. Judging from the source it determines the device from the configuration file and uses /usr/bin/upsc to query the ups data. This should be part of the nut or nut-client package, do you have nut installed? You can test with
Code: [Select]
rpm -q nut nut-clientAbove should output the package and version number if installed.
« Last Edit: July 17, 2008, 02:01:10 PM by cactus »
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline NoTo

  • ****
  • 113
  • +0/-0
Re: Live UPS monitoring, Sysmon?
« Reply #4 on: July 17, 2008, 02:05:38 PM »
Code: [Select]
rpm -q nut nut-clientAbove should output the package and version number if installed.
Hi Cactus,
The above command gives this information:
Code: [Select]
nut-2.2.0-3.3.el4
nut-client-2.2.0-3.3.el4

Graham

Offline okepc

  • ****
  • 118
  • +0/-0
    • http://www.okepc.nl
Re: Live UPS monitoring, Sysmon?
« Reply #5 on: July 17, 2008, 03:15:45 PM »
It's only working if you install and configure apcupsd, without it you won't get any graphs concerning the ups.

Offline okepc

  • ****
  • 118
  • +0/-0
    • http://www.okepc.nl
Re: Live UPS monitoring, Sysmon?
« Reply #6 on: July 17, 2008, 03:17:53 PM »
But maybe i have an old version and nut support has been added later.....

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Live UPS monitoring, Sysmon?
« Reply #7 on: July 17, 2008, 04:02:36 PM »
It's only working if you install and configure apcupsd, without it you won't get any graphs concerning the ups.
I wonder what makes you think that as the relevant code seems not to indicate such:

Code: [Select]
            my $cnt=0;
            if ( $upsstatus eq 'enabled') {
                my @upses = `cat /etc/ups/ups.conf | sed -ne 's/\\[\\(.*\\)\\]/\\1/p'`;
                foreach(@upses) {
                    chomp;
                    my $upsname="$_\@localhost";
                    $cnt++;
                    my @upsdata = `/usr/bin/upsc $upsname 2> /dev/null`;
                    foreach(@upsdata) {
                        if(/^([a-z])[^.]+\.(voltage|load|charge|runtime|temperature|humidity)\s*:\s*([0-9,.]+)/) {
                            my $element = "$1_$2";
                            $datahash->{ups}->{$cnt}->{$element}=$3;
                            if($element=~/time/i) { $datahash->{ups}->{$cnt}->{$element} /= 60; }
                        }
                    }
                }
            }

Graham,

what is the output of the following commands:
Code: [Select]
db configuration getprop nut statusand
Code: [Select]
cat /etc/ups/ups.conf | sed -ne 's/\\[\\(.*\\)\\]/\\1/p'
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline NoTo

  • ****
  • 113
  • +0/-0
Re: Live UPS monitoring, Sysmon?
« Reply #8 on: July 17, 2008, 06:10:17 PM »
Cactus,

db configuration getprop nut status
Code: [Select]
enabled
cat /etc/ups/ups.conf | sed -ne 's/\\[\\(.*\\)\\]/\\1/p'
Code: [Select]
no output, just returns to the prompt
Much obliged for your interest :-)

Graham

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Live UPS monitoring, Sysmon?
« Reply #9 on: July 17, 2008, 08:06:28 PM »
db configuration getprop nut status
Code: [Select]
enabled
That means nut is enabled and the system is aware that a UPS should be queried for data.

cat /etc/ups/ups.conf | sed -ne 's/\\[\\(.*\\)\\]/\\1/p'
Code: [Select]
no output, just returns to the prompt
Than I think there is the cause of the problem... no name for the UPS can be determined and hence no UPS will be queried for data. Can you post the contents of the /etc/ups/ups.conf file?

Much obliged for your interest :-)
You're welcome.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline NoTo

  • ****
  • 113
  • +0/-0
Re: Live UPS monitoring, Sysmon?
« Reply #10 on: July 17, 2008, 08:49:31 PM »
Yep, I think I can do that... :-?

/etc/ups/ups.conf

Code: [Select]
#------------------------------------------------------------
#              !!DO NOT MODIFY THIS FILE!!
#
# Manual changes will be lost when this file is regenerated.
#
# Please read the developer's guide, which is available
# at http://www.contribs.org/development/
#
# Copyright (C) 1999-2006 Mitel Networks Corporation
#------------------------------------------------------------
[UPS]
        driver = usbhid-ups
        port = /var/lib/ups/hiddev0


Ooh, I could :shock:

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Live UPS monitoring, Sysmon?
« Reply #11 on: July 17, 2008, 09:16:35 PM »
Yep, I think I can do that... :-?

/etc/ups/ups.conf

Code: [Select]
#------------------------------------------------------------
#              !!DO NOT MODIFY THIS FILE!!
#
# Manual changes will be lost when this file is regenerated.
#
# Please read the developer's guide, which is available
# at http://www.contribs.org/development/
#
# Copyright (C) 1999-2006 Mitel Networks Corporation
#------------------------------------------------------------
[UPS]
        driver = usbhid-ups
        port = /var/lib/ups/hiddev0


Ooh, I could :shock:
Haha, but that is the default contents, I have the same, but I have no UPS, you did reboot after setting the status of nut to enabled like described in the wiki?

What is the make and model of your UPS?

Perhaps Shad, the original author has some ideas...
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline NoTo

  • ****
  • 113
  • +0/-0
Re: Live UPS monitoring, Sysmon?
« Reply #12 on: July 17, 2008, 09:26:54 PM »
It's an APC Back-UPS CS 500.

Yep, I followed the HowTo to the letter like a good noob should :D which was basically

Code: [Select]
config setprop nut status enabled
signal-event post-upgrade
signal-event reboot

Decided to test the UPS by yanking the power lead out. Server kept running for about half an hour and then sent me an email to say it's shutting down. So I think it functioning perfectly. Will wait and see if Shad can shed any light on the matter. I'm happy that it works at least. At the weekend I'll be making it live and on Monday the SBS2003 box goes on ebay  :-P

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Live UPS monitoring, Sysmon?
« Reply #13 on: July 17, 2008, 09:55:30 PM »
Will wait and see if Shad can shed any light on the matter.
Shad is happy to see and try to help out, but for that he would like you to report this in the bugtracker. If you need help with that... I'll be glad to be of assistance.

I'm happy that it works at least. At the weekend I'll be making it live and on Monday the SBS2003 box goes on ebay  :-P
That is nice indeed.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline NoTo

  • ****
  • 113
  • +0/-0
Re: Live UPS monitoring, Sysmon?
« Reply #14 on: July 17, 2008, 11:15:04 PM »
Bug added. Thanks heaps, Cactus. :grin:

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Live UPS monitoring, Sysmon?
« Reply #15 on: July 17, 2008, 11:15:58 PM »
Bug added. Thanks heaps, Cactus. :grin:
Please post a link for future reference.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline NoTo

  • ****
  • 113
  • +0/-0
Re: Live UPS monitoring, Sysmon?
« Reply #16 on: July 17, 2008, 11:43:08 PM »

Offline okepc

  • ****
  • 118
  • +0/-0
    • http://www.okepc.nl
Re: Live UPS monitoring, Sysmon?
« Reply #17 on: July 18, 2008, 09:47:31 AM »
Cactus

later in tha code...

                else
                    {
                    if( -e '/sbin/apcaccess')
                        {
                        $linev = 'U';
                        $loadpct = 'U';
                        $bcharge = 'U';
                        $timeleft = 'U';
                        $outputv = 'U';
                        $itemp = 'U';
                        $battv = 'U';
                        @apcdata = `/sbin/apcaccess status 2> /dev/null`;
                        if ( $debug eq 'debug' )
                    {
                        foreach (@apcdata )
                            {   
                                print 'apcdata : ' . $_;

Quote
if( -e '/sbin/apcaccess')
--> apcupsd

Nut support and apcupsd support.

Dirk

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Live UPS monitoring, Sysmon?
« Reply #18 on: July 18, 2008, 03:43:11 PM »
Cactus

later in tha code...

                else
                    {
                    if( -e '/sbin/apcaccess')
                        {
                        $linev = 'U';
                        $loadpct = 'U';
                        $bcharge = 'U';
                        $timeleft = 'U';
                        $outputv = 'U';
                        $itemp = 'U';
                        $battv = 'U';
                        @apcdata = `/sbin/apcaccess status 2> /dev/null`;
                        if ( $debug eq 'debug' )
                    {
                        foreach (@apcdata )
                            {   
                                print 'apcdata : ' . $_;
 --> apcupsd

Nut support and apcupsd support.

Dirk
Nope that is not in the default contrib (from smecontribs, I believe) I have installed.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)