[Top][All Lists]

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

Re: [monit] Monitoring script output

From: Martin Pala
Subject: Re: [monit] Monitoring script output
Date: Wed, 17 Mar 2010 21:23:51 +0100

Native support for delegating check to script is planned, in the mean time you 
can use following workarounds:

       1.) based on timestamp monitoring of file, which is updated by external 
script, running from
       cron. When everything is OK, the script will update (touch) the file.
       When the state is false, the script won't update the timestamp and
       monit will perform the related action.

       For example script for monitoring the count of files inside /tmp
       if [ `ls -1 /tmp |wc -l` -lt 100 ]
         touch /var/tmp/monit_flag_tmp

       run this script via cron (for example, every 20 minutes):
        20 * * * * /root/test_tmp_files > /dev/null 2>&1

       and do timestamp check on /var/tmp/monit_flag_tmp (or any file you 
       in monit control file:
        check file monit_flag_tmp with path /var/tmp/monit_flag_tmp
          if timestamp > 25 minutes then alert


       Another Example script: for monitoring the Solaris Volume Manager
       /usr/sbin/metastat | /usr/xpg4/bin/grep -q maintenance
       if [ $? -ne 0 ]; then
         touch /var/tmp/monit_flag_svm

       2.) alternatively you can use the monit's file content testing to watch
       logfiles or status files created similar way as described above.

       Example script:
       /usr/sbin/metastat > /var/tmp/monit_svm

       and example monit syntax:
       check file svm with path /var/tmp/monit_svm
         if match "maintenance" then alert

On Mar 17, 2010, at 4:08 PM, Mark Olliver wrote:

> Is is possible to monitor the result of a script for example once every
> 5 mins.
> I would like to reduce our reliance on nagios for internal monitoring
> but we have a few checks like an expect script which logs into our
> servers and runs a few checks. Ideally i would like monit to monitor
> these as well.
> Mark Olliver BSc (Hons) MBCS CITP
> Thermeon (System Admin)
> Russ Hill Farm, Russ Hill, Charlwood, RH6 0EL, UK
> +44 1293 864 300
> --
> To unsubscribe:

reply via email to

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