[Nut-upsuser] Megatec driver floods logs #2 & mail notifications
Yury V. Zaytsev
yury at shurup.com
Tue Dec 29 13:35:06 UTC 2009
Hi!
Please keep the list traffic on the list so that the others can benefit.
1) Be sure that an MTA is installed and working:
mail -s "Test" you at mail.com <<EOF
Test!
EOF
2) Be sure that the script has correct permissions:
chmod ugo+x /mnt/data/scripts/ups-notifier
3) Be sure that it actually works:
/mnt/data/scripts/ups-notifier lineup
/mnt/data/scripts/ups-notifier linedown
/mnt/data/scripts/ups-notifier lineup
You should get only 2 e-mails!
4) Be sure that your configuration is correct:
upsmon.conf:
# ZYV
NOTIFYCMD /usr/sbin/upssched
# ZYV
NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC
upssched.conf:
CMDSCRIPT /mnt/data/scripts/ups-notifier
# ZYV
PIPEFN /var/run/nut/upssched.pipe
LOCKFN /var/run/nut/upssched.lock
# ZYV
# The timers, here 3 min after the ONBATT (ups on battery) event
AT ONBATT * START-TIMER linedown 180
# Cancel the countdown is power is back
AT ONLINE * CANCEL-TIMER linedown
AT ONLINE * EXECUTE lineup
HTH,
--
Sincerely yours,
Yury V. Zaytsev
On Tue, 2009-12-29 at 19:14 +0800, Михаил wrote:
> Юрий!
> Подскажите , какие изменения нужно сделать в upsmon.conf , чтобы ваш скрипт выполнялся?
> указал путь к скрипту-
>
> NOTIFYCMD /sw/sbin/notifyme
>
> Я убрал коммет в строках:
> ___
>
> NOTIFYFLAG ONLINE SYSLOG
> NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
> ______
> И подправил скрипт под себя, должен работать.
>
> Проверяю так - выдергиваю вилку ( питание ups из сети) , спустя минуту вставляю обратно. В консоли появляется сообщение
> ____
> Broadcast Message from _mdnsresponder at Mihails-Power-Mac-G4.local
> (no tty) at 18:48 ULAT...
>
> UPS SU620INET at localhost:3493 on battery
>
>
> Broadcast Message from _mdnsresponder at Mihails-Power-Mac-G4.local
> (no tty) at 18:52 ULAT...
>
> UPS SU620INET at localhost:3493 on line power
> _____
> но письмо не приходит.
>
> Спасибо.
> Михаил
> pano.irk at gmail.com
>
>
>
> On 29 Dec 2009, at 05:38, Yury V. Zaytsev wrote:
>
> > On Mon, 2009-12-28 at 22:02 +0100, Arjen de Korte wrote:
> >
> >> This is trivial to script. Create an empty file somewhere your
> >> CMDSCRIPT has write access to when the 'linedown' timer elapses (ie,
> >> when you send the warning mail). In your 'lineup' event check for the
> >> presence of this file. If it is there, you need to send a message that
> >> the power is back and remove the file. You can improve this above, by
> >> also checking the age of the file (to prevent triggering on stale
> >> files that are accidentally left behind).
> >
> > Hi!
> >
> > Thanks for the ideas! Please find my implementation attached. Hopefully
> > it will be of use to someone... at least now it's googleable :-)
> >
> > --
> > Sincerely yours,
> > Yury V. Zaytsev
> > <ups-notifier>_______________________________________________
> > Nut-upsuser mailing list
> > Nut-upsuser at lists.alioth.debian.org
> > http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser
More information about the Nut-upsuser
mailing list