NUT alerts through Monit?

Started by FullyBorked, July 22, 2022, 04:57:27 AM

Previous topic - Next topic
Anyone know how to get monit to monitor and alert on NUT alerts such as on battery, low battery, and shutdown?

You can trigger an alert, Copy the log and write a rule to monitor within monit like the Suricata example of the docs

Quote from: mimugmail on July 22, 2022, 07:16:58 AM
You can trigger an alert, Copy the log and write a rule to monitor within monit like the Suricata example of the docs

Yea the Suricata example is actually my contribution to the doc 8) I was just lazy and hoping someone had already figured it out to save me digging around in the logs. I'll figure it out this weekend and post up my results.

Ok, finally got this to work.  Took a bit of tinkering but wasn't too bad once I got going.  I created three tests as variation of the below with on battery, low battery, and on line.  That way I get an alert on each status change.

Test -

Name: UPS on battery

Condition: content = "UPS CyberPowerUPS on battery"  **Adjust this content based on your log entry, this is just what mine is called

Action: Alert

Service -

Name: UPS_Status_Change

Type: File

Path: /var/log/system/latest.log

Tests: UPS on battery **choose any others that you created