Hi Damjan,
Monit use some environment variables are available in user script.

> I also hope if there is possible to use variable for defined alarm in 
> 
> The end of my string 'Message on SMS - Monit Problem XYZ'

Some of my check file monitor definitions use scripts with something
like this.

Get some information based on the service name used by monit.

if [ -n "$MONIT_SERVICE" ]; then
  SERV="$MONIT_SERVICE"
#  APPL=`echo "$MONIT_SERVICE" | cut -f 1 -d '_'`
  CELL=`echo "$MONIT_SERVICE" | cut -f 2 -d '_'`
  SRVR=`echo "$MONIT_SERVICE" | cut -f 3 -d '_'`
  PROC="Serv_${CELL}_${SRVR}"
else
:
fi

# Handle some events.
if [ -n "$MONIT_EVENT" ]; then
  :
fi

Handle the message lines found by the match.

# Handle matched lines.
if [ -n "$MONIT_DESCRIPTION" ]; then
  echo $MONIT_DESCRIPTION | grep -e "^content match" >/dev/null
  if [ $? -eq 0 ]; then

# Remove duplicate lines.
    echo -e $MONIT_DESCRIPTION | uniq | \
    while read desc; do
      if [[ "$desc" = *'ORBX0390E:'* ]]; then
:
      fi
    done
  fi

I use
check file file.log with path "/path/to/file.log"
  if not exist then exec "/path/t/file.log"
  if match "error" then alert
  if match "ORBX0390E:" then exec "/path/to/script.sh"
:

A suggestion only,
with regards,
Lutz

p.s.
See https://mmonit.com/wiki/MMonit/PushoverNotification


--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to