Hi,

Phil Stracchino wrote:

On Fri, Jul 01, 2005 at 02:47:30PM +0200, Xavier Romero wrote:

I've updated from 1.36.1 to 1.36.3. Certainly that was a display bug
about the IP addres.
With the right IP address being logged i realized than the cause of
these annoying messages was our Nagios box doing check_tcp against the
bacula server :-/
I will find out a better way to determine if Bacula is running..


I have a check, at least for clients, that works without any adverse
effects.  I haven't tried using ot to verify that the SD or Director are
running.  It uses Perl's Net::Ping and Net::Telnet, and verifies that
the client is running by opening the port without actually sending any
dtaa at all to the port -- it just opens the port then, if successful,
immediately closes it again.  I have noticed no adverse effects from
doing this.

I'm using snmp checks to look for the bacula processes, and Christian Masopust has created a nagios plugin that uses the monitor way of checking all components of bacula.

I have this set up to check DIR, SD and FD and it works fine.

I will put both to on my website (after checking Christians license). I'll send a notice to the list.

Arno

I haven't tried using this technique to check for running SD or Director
yet, but it's worth a try.  Note that while Net::Telnet (see attached
script) is told to expect a 'bash$' prompt, the test works perfectly
well on win32 boxes as well.





------------------------------------------------------------------------

#!/usr/bin/perl

use strict;
use Net::Ping;
use Net::Telnet ();
use Getopt::Long;
use IPC::Open2;


# Return values:
#       -1  Program error or no host specified
#        0  Success, FD found and responding
#        1  Client alive but FD not listening
#        2  Client not found on network

my $ret = -1;
my ($host, $p, $ret, $verbose);
GetOptions('verbose'    => \$verbose,
           'v'          => \$verbose);

$host = shift || die "No host specified!\n";

$host .= '.babcom.com' unless ($host =~ /babcom/ || $host =~ /caerllewys/);

printf ("Host $host has address %d.%d.%d.%d\n",
        unpack('C4',
               (my @addrs = (gethostbyname($host))[4])[0])) if ($verbose);

$p = Net::Ping->new();
if ($p->ping($host))
{
    print "Host $host is alive\n" if ($verbose);
    my $t = new Net::Telnet (Timeout => 10,
                             Port    => 9102,
                             Prompt  => '/bash\$ $/');
    if ($t->open($host))
    {
        print "Bacula-FD listening on port 9102\n" if ($verbose);
        $ret = 0;
    }
    else
    {
        print "Bacula-FD not running on host $host\n";
        $ret = 1;
    }
    $t->close;
}
else
{
    print "Client $host not found on network\n";
    $ret = 2;
}
$p->close();

print "Returning value $ret\n" if ($verbose);

exit ($ret);

--
IT-Service Lehmann                    [EMAIL PROTECTED]
Arno Lehmann                  http://www.its-lehmann.de


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to