monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: monit sms alert with script


From: Damjan Hajsek
Subject: RE: monit sms alert with script
Date: Sat, 15 Oct 2016 21:17:19 +0200

Sorry I have no knowledge of programming or using program language.

-----Original Message-----
From: monit-general
[mailto:address@hidden On Behalf Of Lutz
Mader
Sent: Saturday, October 15, 2016 2:14 PM
To: This is the general mailing list for monit
Subject: Re: monit sms alert with script

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

[Prev in Thread] Current Thread [Next in Thread]