[Nut-upsuser] UPSSCHED and FreeBSD 8.3?

Thomas Laus lausts at acm.org
Fri Jan 4 14:53:26 UTC 2013


Group:

The Background:

I maintain the network hardware for a county government building that is un-
occupied except for weekday dayshift.  The building is located in an older 
section of town and the electric service has components that are nearing 
their 100 year lifetime.  The building has UPS for all computer and network 
hardware and an autostart generator that starts when utilitity service has 
been lost for over 30 seconds.  The generator is programmed not to 
automatically switch back to the utility when power has been restored and 
needs someone to investigate and make the decision of when to transfer back 
to normal.  The generator controls can be remotly accessed via the Internet.

The Problem:

The site gets about 2-3 short (about one scan cycle on Nut) events a week.  I 
configured upsmon.conf:

NOTIFYCMD /usr/local/sbin/upssched
NOTIFYFLAG ONLINE SYSLOG
NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC

I want to send an email to my cellphone only for significant UPS events that 
involve starting the generator and want to ignore short duration events.

My upssched.conf:

CMDSCRIPT /usr/local/bin/upssched-cmd
PIPEFN /var/db/nut/upssched/upssched.pipe
LOCKFN /var/db/nut/upssched/upssched.lock
AT ONBATT * START-TIMER upsbatt 30
AT ONLINE * CANCEL-TIMER upsbatt
AT LOWBATT * EXECUTE ups-low-batt

My CMDSCRIPT /usr/local/bin/upssched-cmd:

#!/bin/sh

case $1 in
        upsbatt)
                echo "The UPS has been on battery for awhile" \
                | mail -s"UPS monitor" me at testhost.local
                ;;
        ups-low-batt)
                echo "The UPS has a low battery condition" \
                | mail -s"UPS monitor" me at testhost.local
                ;;
        *)
                logger -t upssched-cmd "Unrecognized command: $1"
                ;;
esac

I tested the configuration last week before deployment by pulling the plug on 
the UPS.  The syslog and wall notify commands work, but no email was 
generated nor any entries in my maillog.

The ownership of /var/db/nut/upssched is 'uucp' the default owner of 
everything related to the FreeBSD nut installation.  The execute bit is 
turned on for all scripts and uucp is the owner of all .conf files.

I would like to just test upssched operation without 'pulling the plug' to 
discover the root problem and fix it, is there a way?

The FreeBSD version is 8.3 and the Nut port is:

# $FreeBSD: ports/sysutils/nut/Makefile,v 1.68 2012/12/06 21:29:51 svnexp Exp 
$
#

PORTNAME=       nut
PORTVERSION=    2.6.5
PORTREVISION=   1

Tom

-- 
Public Keys:
PGP KeyID = 0x5F22FDC1
GnuPG KeyID = 0x620836CF




More information about the Nut-upsuser mailing list