[Nut-upsuser] Email Alerts for Multiple UPSs with upssched
Jim Klimov
jimklimov at cos.ru
Tue Oct 31 17:36:29 UTC 2017
On October 31, 2017 4:09:46 PM GMT+01:00, Garrett Michael Hayes <Garrett at VerbalImaging.com> wrote:
>Greetings Gentlebeings,
>
>I have started deploying a number of NUT instances on Raspberry Pi
>machines (Raspbian Jessie) across my network. The purpose of these
>"nutcases" as we refer to them is to monitor the status of the UPSs
>supporting our network switching infrastructure and notify us of power
>and battery events via email. No shutdown or other actions are
>required.
>
>Everything is going spiffy as all get-out so far. But now I'm running
>up against a configuration issue I don't quite know how to address.
>
>Thus far each "nutcase" has been configured to monitor a single UPS.
>Now I want to deploy one to monitor three UPSs in a larger switch
>closet. Adding the additional UPSs to ups.conf and upsmon.conf is
>fairly straightforward. But I'm darned if I can figure out how to
>configure the email alerts to let me know WHICH UPS is the source of an
>event.
>
>I'm using upssched as my NOTIFYCMD, and it in turn is calling a little
>shell script that reads the flag that's passed and sends an email.
>What I can't figure out is how (if there is a way) to determine the
>originating UPS. It seems that only the status flag makes it across to
>the shell script. Or at least if it's passing more than that, I don't
>know how to retrieve it.
>
>I'm sure I must be missing something simple. Any thoughts/pointers
>would be appreciated!
>
>Garrett Michael Hayes
Try $UPSNAME (this and other vars are RTFMed somewhere, maybe comments to configs) - I used it in NOTIFYCMD handling by scripts directly, maybe it would pass through upssched too?
Also a script can call `set` to print out its env, as well as you can inspect /proc/PID/environ on linux to get the envvars of a running process.
Jim
--
Typos courtesy of K-9 Mail on my Android
More information about the Nut-upsuser
mailing list