On 02/12/2018 10:06 AM, Michal Svec wrote:>
> Is it possible to limit the frequency of specific notifications? In
> 2.7.4 it seems to be possible only for REPLBATT via RBWARNTIME, but
> that's it.
>
> My specific problem is that the UPS got disconnected and before I got
> hold of the server to turn the upsmon off my mailbox got flooded with
> hundreds of messages.
>
> It probably doesn't make sense for all notification types, but for
> COMMBAD it would be fairly useful.
There is a general hook in the form of NOTIFYFLAG.? In upsmon.conf you
can specify the program to deliver notifications:
NOTIFYCMD /usr/sbin/upssched
NOTIFYFLAG COMMBAD????? EXEC
NOTIFYFLAG COMMOK EXEC
NOTIFYFLAG ONBATT EXEC
NOTIFYFLAG ONLINE EXEC
You can put your own program in place of upssched, but upssched has
quite a few features already implemented - including TIMER.
My upssched.conf:
CMDSCRIPT /usr/bin/upssched-tripp
AT COMMBAD tripp at localhost START-TIMER upsreset 10
AT COMMOK tripp at localhost CANCEL-TIMER upsreset
AT ONBATT * EXECUTE sms-onbatt
AT ONLINE * EXECUTE sms-online
upssched hands off to the program/script in CMDSCRIPT after implementing
its own features, passing the arbitrary even names you provide.