If you want to see the status messages coming in to get a better idea of
what to send, try running this on a computer and point a few of your Big
Brother agents at it for a while.  You should end up with a separate log
file for each incoming status message.

NOTE:  Watch for line wraps

################################
#!/usr/bin/perl

use strict;
use warnings;
use IO::Socket;
use Time::HiRes qw(time);
$| = 1;

my $sock = new IO::Socket::INET(
                                LocalPort => '1984',
                                Proto => 'tcp',
                                Listen => SOMAXCONN,
                                Reuse => 1
                                ) or die("Couldn't create socket on tcp
1984!\n");

while(my $bbclient = $sock->accept()){
    my $host = inet_ntoa($bbclient->peeraddr);
    open(OUTFILE,">>","./bblog/".time().".$host.log") or die("Couldn't
open '".$bbclient->peeraddr.".bbclient.log' for append!\n");
    select OUTFILE;
    $| = 1;
    select STDOUT;

    print "IP=$host\n";

    while(my $recv = <$bbclient>){
        print OUTFILE $recv;
#        print $recv;
    }
}

################################



-----Original Message-----
From: Timothy Johnson 
Sent: Monday, May 15, 2006 5:20 PM
To: Ken Foskey; beginners@perl.org
Subject: RE: :ftp with retry & Big brother notifications from
applications


I had to deal with some of this when I recently wrote a BB agent to
Nagios translator in Perl.

You should be able to send the information you want directly to BB using
the IO::Socket module, connecting to port 1984( or whatever custom port)
on your BB server and sending a status message.



Big Brother status messages look like this (minus the hyphens, all one
line):

------------
status hostname,domainname,com.cpu green Thu May 11 16:58:45 PDT 2006
[sfinfra1.ad.checkpoint.com] up: 21 days, 1 users, 46 procs, load=0%,
PhysicalMem: 2560MB(33%)
------------

It basically breaks down to the following, separated by spaces on one
line:

        status
        FQDN of host(with periods converted to commas).test_name
        color
        time stamp
        info (whatever's left of the line, including spaces)

After the first line you may see more lines of verbose information, but
for what you want to do you should only need the first line.






-----Original Message-----
From: Ken Foskey [mailto:[EMAIL PROTECTED] 
Sent: Sunday, May 14, 2006 4:45 AM
To: beginners@perl.org
Subject: net::ftp with retry & Big brother notifications from
applications

<snip>

Secondly is there an easy way to send messages to Big Brother to go
orange, red then go green again?  We are using a file and writing
messages and there is currently no way of deleting the messages once the
process is fine again.  There must be a better way.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to