Xymon Mailing List Archive search

Windows version of a fully functional bb command

13 messages in this thread

list Bruce White · Fri, 14 Mar 2008 14:21:22 -0500 ·
Hi all,

 
I know I saw a thread earlier about a fully functional bb for windows and
that someone had ported the hobbit bb code to windows and got it working.
I, for the life of me, can not now find that thread.  I'm interested in a
windows bb executable so I can write a quick DOS bat file that my windows
guys can run to place a windows server into maintenance mode.   Anybody have
a windows bb executable and/or such a script?

 
Thanks,

Bruce

 
Note: The information contained in this message may be privileged and
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, or an employee or agent responsible for
delivering this message to the intended recipient, you are hereby notified
that any dissemination, distribution or copying of this communication is
strictly prohibited. If you have received this communication in error,
please notify us immediately by replying to the message and deleting it from
your computer. Thank you. Fellowes, Inc.
list Henrik Størner · Fri, 14 Mar 2008 22:46:40 +0100 ·
quoted from Bruce White
On Fri, Mar 14, 2008 at 02:21:22PM -0500, White, Bruce wrote:
I know I saw a thread earlier about a fully functional bb for windows and
that someone had ported the hobbit bb code to windows and got it working.
I, for the life of me, can not now find that thread.  I'm interested in a
windows bb executable so I can write a quick DOS bat file that my windows
guys can run to place a windows server into maintenance mode.   Anybody have
a windows bb executable and/or such a script?
Compiles fine with Cygwin. Available here:
http://www.hswn.dk/~henrik/bbutility.zip


Henrik
list Etienne Grignon · Thu, 20 Mar 2008 16:39:14 +0100 ·
Hi,

2008/3/14, White, Bruce <user-58f975e8bf9d@xymon.invalid>:
quoted from Henrik Størner
 Hi all,


I know I saw a thread earlier about a fully functional bb for windows and
that someone had ported the hobbit bb code to windows and got it working.
I, for the life of me, can not now find that thread.  I'm interested in a
windows bb executable so I can write a quick DOS bat file that my windows
guys can run to place a windows server into maintenance mode.   Anybody have
a windows bb executable and/or such a script?
You can use the bbwincmd.exe utility which is installed with BBWin. It is a
cmd command line utility to send messages to hobbit server almost like the
original bb command and your don't need cygwin.

Regards,


-- 
Etienne GRIGNON
list Bruce White · Thu, 20 Mar 2008 12:17:02 -0500 ·
Etienne,

 
I just tested it and it worked like a champ.  Thanks!

 
    ......Bruce

 
From: Etienne Grignon [mailto:user-87c74c1037a4@xymon.invalid] 
Sent: Thursday, March 20, 2008 10:39 AM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] Windows version of a fully functional bb command

 
Hi,

2008/3/14, White, Bruce <user-58f975e8bf9d@xymon.invalid <mailto:user-58f975e8bf9d@xymon.invalid>
quoted from Etienne Grignon
:
Hi all,

 
I know I saw a thread earlier about a fully functional bb for windows and
that someone had ported the hobbit bb code to windows and got it working.
I, for the life of me, can not now find that thread.  I'm interested in a
windows bb executable so I can write a quick DOS bat file that my windows
guys can run to place a windows server into maintenance mode.   Anybody have
a windows bb executable and/or such a script?


You can use the bbwincmd.exe utility which is installed with BBWin. It is a
cmd command line utility to send messages to hobbit server almost like the
original bb command and your don't need cygwin.

Regards,

 
-- 
Etienne GRIGNON 


Note: The information contained in this message may be privileged and
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, or an employee or agent responsible for
delivering this message to the intended recipient, you are hereby notified
that any dissemination, distribution or copying of this communication is
strictly prohibited. If you have received this communication in error,
please notify us immediately by replying to the message and deleting it from
your computer. Thank you. Fellowes, Inc.
list Charles Jones · Thu, 20 Mar 2008 10:29:40 -0700 ·
Speaking of such, is the protocol for the bb command published anywhere? It would be handy if I could write my own function for it in perl and other languages that I am writing hobbit scripts in. I'm guessing it's not as simple as just making a tcp connection to the port and sending the command.

-Charles
quoted from Bruce White
*From:* Etienne Grignon [mailto:user-87c74c1037a4@xymon.invalid]
*Sent:* Thursday, March 20, 2008 10:39 AM
*To:* user-ae9b8668bcde@xymon.invalid
*Subject:* Re: [hobbit] Windows version of a fully functional bb command

 
Hi,

2008/3/14, White, Bruce <user-58f975e8bf9d@xymon.invalid <mailto:user-58f975e8bf9d@xymon.invalid>>:

Hi all,

 
I know I saw a thread earlier about a fully functional bb for windows and that someone had ported the hobbit bb code to windows and got it working.   I, for the life of me, can not now find that thread.  I'm interested in a windows bb executable so I can write a quick DOS bat file that my windows guys can run to place a windows server into maintenance mode.   Anybody have a windows bb executable and/or such a script?


You can use the bbwincmd.exe utility which is installed with BBWin. It is a cmd command line utility to send messages to hobbit server almost like the original bb command and your don't need cygwin.

Regards,

 
list Greg L Hubbard · Thu, 20 Mar 2008 15:05:36 -0500 ·
Once upon a time I think I heard that there was an RFC published,
enshrining port 1984.  But I never looked into it myself.
 
GLH
quoted from Charles Jones


	From: Charles Jones [mailto:user-e86b4aeade4e@xymon.invalid] 
	Sent: Thursday, March 20, 2008 12:30 PM
	To: user-ae9b8668bcde@xymon.invalid
	Subject: [hobbit] bb cmd protocol? (was [hobbit] Windows version
of a fully functional bb command)
	
	
	Speaking of such, is the protocol for the bb command published
anywhere? It would be handy if I could write my own function for it in
perl and other languages that I am writing hobbit scripts in. I'm
guessing it's not as simple as just making a tcp connection to the port
and sending the command.
	
	-Charles
	
	
		From: Etienne Grignon [mailto:user-87c74c1037a4@xymon.invalid]

		Sent: Thursday, March 20, 2008 10:39 AM
		To: user-ae9b8668bcde@xymon.invalid
		Subject: Re: [hobbit] Windows version of a fully
functional bb command

		
		Hi,

		2008/3/14, White, Bruce <user-58f975e8bf9d@xymon.invalid>:

		Hi all,

		
		I know I saw a thread earlier about a fully functional
bb for windows and that someone had ported the hobbit bb code to windows
and got it working.   I, for the life of me, can not now find that
thread.  I'm interested in a windows bb executable so I can write a
quick DOS bat file that my windows guys can run to place a windows
server into maintenance mode.   Anybody have a windows bb executable
and/or such a script?

		
		You can use the bbwincmd.exe utility which is installed
with BBWin. It is a cmd command line utility to send messages to hobbit
server almost like the original bb command and your don't need cygwin.
		
		Regards,
list Graeme A Shea · Fri, 21 Mar 2008 08:31:38 +1100 ·
Is http://quest.bb4.com/bb/help/help/Status_Message_Format.htm what your
after.

 
Regards

Graeme
quoted from Charles Jones

 
From: Charles Jones [mailto:user-e86b4aeade4e@xymon.invalid] 
Sent: Friday, 21 March 2008 4:30 AM
To: user-ae9b8668bcde@xymon.invalid
Subject: [hobbit] bb cmd protocol? (was [hobbit] Windows version of a
fully functional bb command)

 
Speaking of such, is the protocol for the bb command published anywhere?
It would be handy if I could write my own function for it in perl and
other languages that I am writing hobbit scripts in. I'm guessing it's
not as simple as just making a tcp connection to the port and sending
the command.

-Charles


From: Etienne Grignon [mailto:user-87c74c1037a4@xymon.invalid] 
Sent: Thursday, March 20, 2008 10:39 AM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] Windows version of a fully functional bb command

 
Hi,

2008/3/14, White, Bruce <user-58f975e8bf9d@xymon.invalid>:

Hi all,

 
I know I saw a thread earlier about a fully functional bb for windows
and that someone had ported the hobbit bb code to windows and got it
working.   I, for the life of me, can not now find that thread.  I'm
interested in a windows bb executable so I can write a quick DOS bat
file that my windows guys can run to place a windows server into
maintenance mode.   Anybody have a windows bb executable and/or such a
script?


You can use the bbwincmd.exe utility which is installed with BBWin. It
is a cmd command line utility to send messages to hobbit server almost
like the original bb command and your don't need cygwin.

Regards,

 

Important - This email and any attachments may be confidential. If received in error, please contact us and delete all copies. Before opening or using attachments check them for viruses and defects. Regardless of any loss, damage or consequence, whether caused by the negligence of the sender or not, resulting directly or indirectly from the use of any attached files our liability is limited to resupplying any affected attachments. Any representations or opinions expressed are those of the individual sender, and not necessarily those of the Department of Education and Early Childhood Development.
list Henrik Størner · Thu, 20 Mar 2008 22:39:43 +0100 ·
quoted from Charles Jones
On Thu, Mar 20, 2008 at 10:29:40AM -0700, Charles Jones wrote:
Speaking of such, is the protocol for the bb command published anywhere?
See the bb(1) man-page.


Henrik
list Charles Jones · Thu, 20 Mar 2008 14:42:07 -0700 ·
No, I know the format of status messages...what I'm looking for is the protocol for establishing a connection to hobbit on port 1984 so that I can send status and other messages to Hobbit. I guess I could run a sniffer to find out, but I figure that its either documented somewhere, or Henrik could just let me know :)

-Charles
quoted from Graeme A Shea

Shea, Graeme A wrote:
Is http://quest.bb4.com/bb/help/help/Status_Message_Format.htm what your after.

 
Regards

Graeme

 
*From:* Charles Jones [mailto:user-e86b4aeade4e@xymon.invalid]
*Sent:* Friday, 21 March 2008 4:30 AM
*To:* user-ae9b8668bcde@xymon.invalid
*Subject:* [hobbit] bb cmd protocol? (was [hobbit] Windows version of a fully functional bb command)

 
Speaking of such, is the protocol for the bb command published anywhere? It would be handy if I could write my own function for it in perl and other languages that I am writing hobbit scripts in. I'm guessing it's not as simple as just making a tcp connection to the port and sending the command.

-Charles


*From:* Etienne Grignon [mailto:user-87c74c1037a4@xymon.invalid]
*Sent:* Thursday, March 20, 2008 10:39 AM

*To:* user-ae9b8668bcde@xymon.invalid <mailto:user-ae9b8668bcde@xymon.invalid>
quoted from Graeme A Shea
*Subject:* Re: [hobbit] Windows version of a fully functional bb command

 
Hi,

2008/3/14, White, Bruce <user-58f975e8bf9d@xymon.invalid <mailto:user-58f975e8bf9d@xymon.invalid>>:

Hi all,

 
I know I saw a thread earlier about a fully functional bb for windows and that someone had ported the hobbit bb code to windows and got it working.   I, for the life of me, can not now find that thread.  I'm interested in a windows bb executable so I can write a quick DOS bat file that my windows guys can run to place a windows server into maintenance mode.   Anybody have a windows bb executable and/or such a script?


You can use the bbwincmd.exe utility which is installed with BBWin. It is a cmd command line utility to send messages to hobbit server almost like the original bb command and your don't need cygwin.

Regards,

 
*Important - *This email and any attachments may be confidential. If received in error, please contact us and delete all copies. Before opening or using attachments check them for viruses and defects. Regardless of any loss, damage or consequence, whether caused by the negligence of the sender or not, resulting directly or indirectly from the use of any attached files our liability is limited to resupplying any affected attachments. Any representations or opinions expressed are those of the individual sender, and not necessarily those of the Department of Education and Early Childhood Development.
list Charles Jones · Thu, 20 Mar 2008 15:43:10 -0700 ·
Henrik,

I'm talking about the connection protocol, not the message protocol. So that I can write code that can connect to a BBDISPLAY and send/receive data, without shelling out and using a bb binary.  I've tried telnetting to port 1984 and typing various commands, and also using netcat, none of which seem to work, so I suspect that hobbitd is expecting to see some certain characters before it will accept a command.

-Charles
quoted from Henrik Størner

Henrik Stoerner wrote:
On Thu, Mar 20, 2008 at 10:29:40AM -0700, Charles Jones wrote:
  
Speaking of such, is the protocol for the bb command published anywhere?
    
See the bb(1) man-page.


Henrik

list Ralph Mitchell · Thu, 20 Mar 2008 20:22:18 -0500 ·
quoted from Charles Jones
On Thu, Mar 20, 2008 at 5:43 PM, Charles Jones <user-e86b4aeade4e@xymon.invalid> wrote:
 Henrik,

I'm talking about the connection protocol, not the message protocol. So
that I can write code that can connect to a BBDISPLAY and send/receive data,
without shelling out and using a bb binary.  I've tried telnetting to port
1984 and typing various commands, and also using netcat, none of which seem
to work, so I suspect that hobbitd is expecting to see some certain
characters before it will accept a command.

-Charles
Would bb.pl be of any use to you??  As found on deadcat.net:

#!/usr/bin/perl -w

# bb.pl
#
# BIG BROTHER CLIENT PROGRAM
# Nicolas Chuche <user-adc826d0ca9d@xymon.invalid>
# Version 1
# Jul 15, 2000

# This program is a remake of bb.c in perl.
# I've do that to :
# 1. have a real client for my NT servers
# 2. see what it done in perl

# I've tried to have full compatibility so i've keep all the error
# messages.

# If you want to use it, just replace the original bb by this file in
# BBHOME/bin

# The header of bb.c :

# SENDS THE INPUT LINE TO THE DAEMON ON THE BIG BROTHER PORT
# Format: bb IP-ADDR [<LINE>|-]
#
#    IP-ADDR:    IP-ADDR OF THE SERVER
#    LINE:        <page|status|summary> <DATA>
#        DATA:    for page:    <NUMERIC MESSAGE><status-msg>
#            for status:    <machine><color-code><status-msg>
#            fro summary:    <summary name><color-code><http link>
#
#    -        Will read from standard input a one line status
#                message.
#

use strict;
use Socket;

my $PORT              = 1984;                    # The bbd port
my $PAGELEVELSDEFAULT = "red purple";            # the default page level
my $MAXBBLINE         = 256;                     # the max input line length

# sub debug { print STDERR shift;};              # debug message : uncomment
this line
sub debug {};                                    # and comment this one

@ARGV == 2                  or &Usage;
my ($server, $line) = @ARGV or &Usage;

# take the standart input if second arg is "-"
if ($line eq '-') {
  debug("bb gets its input from stdin\n");
  while (<STDIN>) {
    chomp;
    $_ = substr($_, 0, $MAXBBLINE - 1);
    debug("data came in [$_]\n");
    bb_notify($server, $_);
  }
  debug("Done\n");
} else {
  bb_notify($server, $line);
}

exit(0);

sub bb_notify {
  my ($machine, $data) = @_;
  my (@bbdisplays, @bbpagers, $bbpage, $pagelevels) = ();

  @bbdisplays = split /\s+/, $ENV{BBDISPLAYS} if defined $ENV{BBDISPLAYS};
  debug("Sending: ** $data ** to $machine - @bbdisplays\n");
  bb_send($machine, \@bbdisplays, $data);

  $bbpage     = $ENV{BBPAGE};# if defined $ENV{BBPAGE};
  $pagelevels = ((defined $ENV{PAGELEVELS}) && $ENV{PAGELEVELS}) ?
$ENV{PAGELEVELS} : $PAGELEVELSDEFAULT;

  # paging or not paging ?
  if( $bbpage && $pagelevels ) {
    my ($type, $machine, $color, $message) = $data =~
/^(\S+)\s+(\S+)\s+(\S+)\s+(.*)$/;

    debug("v1:[$type] v2:[$machine] v3:[$color] v4:[$message]\n");

    if ($type =~ /status/ && $pagelevels =~ /$color/) {
      $data =~ s/^(\s*status\S*\s+)/page /;                # Change msg type
      @bbpagers   = split /\s+/, $ENV{BBPAGERS} if defined $ENV{BBPAGERS};
      debug("Sending: ** $data ** to $bbpage - @bbpagers\n");
      bb_send($bbpage,\@bbpagers,$data);    # SEND IT ACROSS TO BBPAGER
    }
  }
}

# ##############
# Send a message

sub bb_send {
  my ($bbdisp, $machinelist, $message) = @_;
  my (%machine, @machinelist) = ();

  @machinelist = ($bbdisp ne "0.0.0.0") ? ($bbdisp) : @$machinelist;

  debug("BOX: $bbdisp\nBOXES: @machinelist\n");

  for my $server (@machinelist) {
    my ($port, $iaddr, $paddr, $proto);    # Variable réseau

    # don't send the message twice to the same machine
    next if $machine{$server};
    $machine{$server} = 1;

    debug("Host: $server\n");

    $iaddr   = inet_aton($server)              || warn "bb: Unknown host:
$server\n", next;
    $paddr   = sockaddr_in($PORT, $iaddr);
    $proto   = getprotobyname('tcp');

    socket(SOCK, PF_INET, SOCK_STREAM, $proto) || warn "bb: Can't open
stream socket\n", next;
    connect(SOCK, $paddr)                      || warn "bb: CAN'T CONNECT TO
bbd SERVER @ $server", next;
    # select((select(SOCK), $| = 1)[0]);         # unbuffer the socket
    print SOCK $message;
    close (SOCK);
  }
  debug("Host list done\n");
}

# ###########
# Print usage

sub Usage {
  print STDERR <<EOF;
bb: incorrect number of arguments
Format: <IP-ADDR> <DATA>
EOF
  exit(1);
}


Ralph Mitchell
list Henrik Størner · Fri, 21 Mar 2008 10:02:01 +0100 ·
The description of the "Message Syntax" in the man-page is what you need
to know. Hobbit uses plain TCP, and data being transferred is plain
text. I.e.

   - connect to tcp port 1984
   - send "status www,foo,com.mytest green"
   - close the connection


Regards,
Henrik
quoted from Charles Jones


On Thu, Mar 20, 2008 at 03:43:10PM -0700, Charles Jones wrote:
Henrik,

I'm talking about the connection protocol, not the message protocol. So that I can write code that can connect to a BBDISPLAY and send/receive data, without shelling out and using a bb binary.  I've tried telnetting to port 1984 and typing various commands, and also using netcat, none of which seem to work, so I suspect that hobbitd is expecting to see some certain characters before it will accept a command.

-Charles

Henrik Stoerner wrote:
On Thu, Mar 20, 2008 at 10:29:40AM -0700, Charles Jones wrote:
  
Speaking of such, is the protocol for the bb command published anywhere?
    
See the bb(1) man-page.
list Charles Jones · Fri, 21 Mar 2008 10:44:50 -0700 ·
quoted from Ralph Mitchell
Ralph Mitchell wrote:
On Thu, Mar 20, 2008 at 5:43 PM, Charles Jones <user-e86b4aeade4e@xymon.invalid <mailto:user-e86b4aeade4e@xymon.invalid>> wrote:

    Henrik,

    I'm talking about the connection protocol, not the message
    protocol. So that I can write code that can connect to a BBDISPLAY
    and send/receive data, without shelling out and using a bb
    binary.  I've tried telnetting to port 1984 and typing various
    commands, and also using netcat, none of which seem to work, so I
    suspect that hobbitd is expecting to see some certain characters
    before it will accept a command.

    -Charles


Would bb.pl be of any use to you??  As found on deadcat.net <http://deadcat.net>;:

sub bb_send {
  my ($bbdisp, $machinelist, $message) = @_;
  my (%machine, @machinelist) = ();
  @machinelist = ($bbdisp ne "0.0.0.0 <http://0.0.0.0>";) ? ($bbdisp) : @$machinelist;
quoted from Ralph Mitchell
  for my $server (@machinelist) {
    my ($port, $iaddr, $paddr, $proto);    # Variable réseau
    # don't send the message twice to the same machine
    next if $machine{$server};
    $machine{$server} = 1;
    debug("Host: $server\n");
    $iaddr   = inet_aton($server)              || warn "bb: Unknown host: $server\n", next;
    $paddr   = sockaddr_in($PORT, $iaddr);
    $proto   = getprotobyname('tcp');
    socket(SOCK, PF_INET, SOCK_STREAM, $proto) || warn "bb: Can't open stream socket\n", next;
    connect(SOCK, $paddr)                      || warn "bb: CAN'T CONNECT TO bbd SERVER @ $server", next;
    # select((select(SOCK), $| = 1)[0]);         # unbuffer the socket
    print SOCK $message;
    close (SOCK);
  }
}
Indeed! From looking at that code, it is just a simple TCP connection...Hmm I guess I need to go see why my test code didn't work :-)  Thanks!

-Charles