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
On Fri, 4 Jan 2013, Thomas Laus wrote:> 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 > ;;...> ..., but no email was generated nor any entries in my maillog.If you execute "/usr/local/bin/usssched-cmd upsbatt" from the command line as the owner of the script, do you receive a mail? Roger
On 05/01/2013, at 1:23, Thomas Laus <lausts at acm.org> wrote:> 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.What about if you use the full path for mail? I don't know about the environment used - if it is very restrictive the mail executable might not be found. -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4358 bytes Desc: not available URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20130105/a1afb5af/attachment.bin>