OPNsense Forum

English Forums => General Discussion => Topic started by: z0rk on April 21, 2025, 10:35:03 PM

Title: APCUPSD status monitoring alerts
Post by: z0rk on April 21, 2025, 10:35:03 PM
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
Title: Re: APCUPSD status monitoring alerts
Post by: caplam on April 22, 2025, 07:11:38 PM
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/
Title: Re: APCUPSD status monitoring alerts
Post by: z0rk on April 25, 2025, 07:10:43 AM
Ah my bad, I included the wrong screenshot. The settings are correct because I also received an email.
Thank you for your feedback.