Bacula-users

Re: [Bacula-users] Nagios Plungin to check mount requests

2012-08-07 11:28:14
Subject: Re: [Bacula-users] Nagios Plungin to check mount requests
From: John Drescher <drescherjm AT gmail DOT com>
To: Uwe Schuerkamp <uwe.schuerkamp AT nionex DOT net>, John Drescher <drescherjm AT gmail DOT com>, Gilberto Nunes <gilberto.nunes32 AT gmail DOT com>, bacula-users <Bacula-users AT lists.sourceforge DOT net>
Date: Tue, 7 Aug 2012 11:26:16 -0400
>                 if test ${status} -eq 127; then
>                         echo "STATUS UNKNOWN - command not found (did
> you install bconsole)"
>                                                         [ Wrote 65 lines ]
>

Oops.. I did not get the whole script. Here goes:

vs_www plugins # cat check_bacula_mount
#! /bin/sh

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

PROGNAME=`basename $0`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
REVISION="1.4.15"

. $PROGPATH/utils.sh


print_usage() {
 echo "Usage: $PROGNAME"
}

print_help() {
 print_revision $PROGNAME $REVISION
 echo ""
 print_usage
 echo ""
 echo "This plugin checks to see if bacula is waiting on a mount."
 echo ""
 support
 exit 0
}

case "$1" in
 --help)
  print_help
  exit 0
  ;;
 -h)
  print_help
  exit 0
  ;;
 --version)
    print_revision $PROGNAME $REVISION
  exit 0
  ;;
 -V)
  print_revision $PROGNAME $REVISION
  exit 0
  ;;
 *)
  sensordata=$(echo "stat dir " | bconsole)
  status=$?
  if test "$1" = "-v" -o "$1" = "--verbose"; then
   echo ${sensordata}
  fi
  if test ${status} -eq 127; then
   echo "STATUS UNKNOWN - command not found (did you install bconsole)"
   exit -1
  elif test ${status} -ne 0 ; then
   echo "WARNING - returned state $status"
   exit 1
  fi
  if echo ${sensordata} | egrep "is waiting for a mount request"  >
/dev/null; then
   echo CRITICAL - Bacula is waiting for a mount
   exit 2
  else
   echo sensor ok
   exit 0
  fi
  ;;
esac

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users