On Thu, Aug 2, 2012 at 12:34 PM, Uwe Schuerkamp
<uwe.schuerkamp AT nionex DOT net> wrote:
> On Thu, Aug 02, 2012 at 11:26:44AM -0400, John Drescher wrote:
>>
>> I agree it should be pretty simple. I was asking before I had to spend
>> 30 minutes to 1 hour of work to figure it all out since I have never
>> written a nagios plugin yet.
>>
>
> Just use the "check_log" script as a template and check the output of
> bconsole like so (from memory):
>
> echo "stat dir " | bconsole | grep -q "is waiting for a mount request"
>
> or similar (basically grep's exit status). then Exit 0 from your
> script for all green, 1 for warning, 2 for critical, 3 for unknown.
>
> Cheers, Uwe
>
Thanks. I have just implemented this. I decided to base this on
check_sensors instead. Here is the preliminary code:
#! /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)"
[ Wrote 65 lines ]
vs_www plugins # ./check_bacula_mount
CRITICAL - Bacula is waiting for a mount
And yes bacula is currently waiting for a tape.
vs_www plugins # bconsole
Connecting to Director fileserver:9101
1000 OK: fileserver-dir Version: 5.2.10 (28 June 2012)
Enter a period to cancel a command.
*st dir
fileserver-dir Version: 5.2.10 (28 June 2012) x86_64-pc-linux-gnu gentoo
Daemon started 05-Jan-02 02:13. Jobs: run=60, running=6 mode=0,0
Heap: heap=897,024 smbytes=673,961 max_bytes=719,759 bufs=4,247 max_bufs=4,260
Scheduled Jobs:
Level Type Pri Scheduled Name Volume
===================================================================================
Incremental Backup 10 07-Aug-12 20:30 CVSSource Other-0252
Incremental Backup 10 07-Aug-12 20:30 Info A00056
Incremental Backup 10 07-Aug-12 20:30 Publics A00056
Incremental Backup 10 07-Aug-12 20:30
WindowsSystemBackupShare-ds2-job A00056
Incremental Backup 10 07-Aug-12 20:30 user-private A00056
Full Backup 10 08-Aug-12 01:10 BackupCatalog *unknown*
====
Running Jobs:
Console connected at 07-Aug-12 11:31
JobId Level Name Status
======================================================================
29170 Full user-private.2012-08-05_20.30.00_08 is running
29172 Full Publics.2012-08-05_20.30.00_10 is waiting for a mount request
29176 Increme user-private.2012-08-06_20.30.00_15 is waiting on max
Client jobs
29177 Increme
WindowsSystemBackupShare-ds2-job.2012-08-06_20.30.00_16 is running
29178 Increme Publics.2012-08-06_20.30.00_17 is waiting on max Client jobs
29179 Increme Info.2012-08-06_20.30.00_18 is running
====
Terminated Jobs:
JobId Level Files Bytes Status Finished Name
====================================================================
29167 Incr 0 0 OK 04-Aug-12 20:30 Info
29166 Incr 0 0 OK 04-Aug-12 20:30 Publics
29164 Incr 9,381 2.330 G OK 04-Aug-12 20:36 user-private
29168 Full 1 3.820 G OK 05-Aug-12 01:22 BackupCatalog
29169 Full 1 0 OK 05-Aug-12 20:30 CVSSource
29173 Full 8,570 10.84 G OK 05-Aug-12 21:02 Info
29171 Full 544 10.73 G Error 05-Aug-12 21:04
WindowsSystemBackupShare-ds2-job
29174 Full 1 3.821 G OK 06-Aug-12 01:23 BackupCatalog
29175 Incr 0 0 OK 06-Aug-12 20:30 CVSSource
29180 Full 1 3.821 G OK 07-Aug-12 01:22 BackupCatalog
====
You have messages.
John
------------------------------------------------------------------------------
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
|