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 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. -- Phil Stracchino [EMAIL PROTECTED] Renaissance Man, Unix generalist, Perl hacker Mobile: 603-216-7037 Landline: 603-886-3518
#!/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);