APCUPSD status monitoring alerts

Started by z0rk, April 21, 2025, 10:35:03 PM

Previous topic - Next topic
OPNsense 25.1.5_5-amd64
os-apcupsd (installed) 1.2_3

I am using monit to restart apcupsd when the process fails (pasted_image.png)

I would also like to receive an email alert upon status changes. I came across the following post.
https://forum.opnsense.org/index.php?topic=23071.0

(pasted_image002.png, pasted_image003.png)

Script:

#!/bin/sh

STATUS=$(/usr/local/sbin/apcaccess -p STATUS)
OK='ONLINE'
if [ "$STATUS" != $OK ]; then
echo "$STATUS"
exit 1
else
exit 0
fi

Email alert message content:

Status failed Service UPSStatusCheck

   Date:        Mon, 21 Apr 2025 13:00:54
   Action:      alert
   Host:        CPUUsage
   Description: status failed (1) -- ONLINE

Your faithful employee,
Monit

When I enable the service check I get the email (see above) reporting a failed status. Does anyone have a suggestion what I am doing wrong here?

Thank you
OPNsense 24.7.2

you didn't configure it as in the post you linked.
The check needs to be "custom" pointing on the script you placed in /usr/local/opnsense/scripts/OPNsense/Monit/

Ah my bad, I included the wrong screenshot. The settings are correct because I also received an email.
Thank you for your feedback.
OPNsense 24.7.2