Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - ack_too_damn_high

#1
I mostly figured this out last night and I think I found a UI bug in 23.7.10_1

When using the opnsense monit Web UI - it doesn't quote the path used in the exec statement.
Every example of exec in the Monit Manual says the path should be quoted, but the UI complains if this is attempted.
https://mmonit.com/monit/documentation/monit.html

/usr/local/etc/monitrc is overwritten by save/apply in webUI.
This will break exec statement- So make a new configuration file


/usr/local/etc/monit.opensense.d/000-customconfig.conf


check host myserver.domain.com address 8.8.8.8
   if failed ping count 3 then exec "/usr/local/etc/monitpush.sh"
   if failed port 443 protocol https and certificate valid > 30 days then exec "/usr/local/etc/monitpush.sh"


Pretty sure you can put this straight in the custom config with quotes instead of using a script.
Here's the curl:

/usr/local/etc/monitpush.sh

#!/bin/sh
/usr/local/bin/curl -s \
  -F "token=TOKEN" \
  -F "user=USERKEY" \
  --form-string "title=$MONIT_HOST - $MONIT_EVENT" \
  --form-string "message=$MONIT_DATE - $MONIT_DESCRIPTION" \
  https://api.pushover.net/1/messages.json


---
addendum;
Heres the config checker
configctl monit check
The smart thing to do is run this as non-root
from manual:

if failed <test> then exec "/usr/local/bin/sms.sh"
      as uid "nobody" and gid "nobody"
      repeat every 5 cycles