On 22 Aug 2006 at 9:58, Bill Moran wrote:

> In response to "Dan Langille" <[EMAIL PROTECTED]>:
> 
> > After having the Director stop running on the 19th, and only noticing 
> > it last night, I decided to start monitoring the service.
> > 
> > I found bacula/examples/nagios_plugin_check_bacula.tgz but cannot 
> > find how it should be compiled.
> > 
> > Anyone done this?
> 
> I rolled my own.  It has the advantage of checking both the director and
> the SD for responsiveness.  I haven't tried the one in the examples.

I like this solution for two reasons:

- it uses perl (meaning it's a script and I do not need to compile 
it)
- it takes a different approach to what I was going to do (not that I 
had a plan, but I had not thought about using bconsole for this)

My version of the script differs slightly:

> #!/usr/bin/perl
> 
> use warnings;
> use strict;
> 
> # Note that there _must_ be a rule in sudoers for this to work:
> # nagios  ALL=(ALL)       NOPASSWD: /usr/local/sbin/bconsole
> open BC, "echo \"status storage=${ARGV[1]}\" | sudo /usr/local/sbin/bconsole 
> |"
>     or die "bconsole: $!";

I don't need sudo, but I do this:

open BC, "echo \"status storage=${ARGV[1]}\" | 
/usr/local/sbin/bconsole -c /usr/local/etc/bconsole.conf |"

I include the configuration file in the -c argument.  no sudo 
required.

IDEALLY, one could specify the hostname and SD name on the command 
line.  At present, the hostname is just informational and is not 
actually used.  

Thanks.

> 
> my $result = "BACULA: critical";
> my $return = 2;
> while (my $line = <BC>)
> {
>     chomp $line;
>     if ($line eq "Connecting to Storage daemon ${ARGV[1]} at 
> ${ARGV[0]}:9103") {
>         $result = "BACULA: ok";
>         $return = 0;
>         last;
>     }
> }
> 
> print "$result\n";
> exit $return;
> 
> 
> -- 
> Bill Moran
> Collaborative Fusion Inc.
> 



-- 
Dan Langille : Software Developer looking for work
my resume: http://www.freebsddiary.org/dan_langille.php



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to