[hobbit] Slightly OT: External Perl Script
Schwimmer, Eric E *HS
EES2Y at hscmail.mcc.virginia.edu
Wed Mar 1 21:01:14 CET 2006
It's 118 lines, it does open a TCP socket, strictly for message
sending, but it also does a little error handling and combo
msging to make life easier on your bb server:
http://nerdvana.org/eric/files/bbmsg.pm
You could probably also send other commands (drop, rename, etc)
through it, but I havent tried, so caveat emptor :)
-Eric
> -----Original Message-----
> From: Charles Jones [mailto:jonescr at cisco.com]
> Sent: Wednesday, March 01, 2006 2:45 PM
> To: hobbit at hswn.dk
> Subject: Re: [hobbit] Slightly OT: External Perl Script
>
> If it's short please post it, or a link to it. Isn't all that
> is needed is to make a TCP connection, or are you completely
> emulating all of the functions of the bb binary?
>
> -Charles
>
> Schwimmer, Eric E *HS wrote:
>
> I've got a perl module that emulates the bb binary, if anybody
> is interested.
>
> -Eric
>
>
>
> -----Original Message-----
> From: FARRIOR, Andy
> [mailto:Andy.Farrior at victoriacollege.edu]
> Sent: Wednesday, March 01, 2006 11:23 AM
> To: hobbit at hswn.dk
> Subject: RE: [hobbit] Slightly OT: External Perl Script
>
>
> ARGH! replied to the wrong person.... must
> drink more coffee....
>
>
> that'd do it to. I know his $msg had a bunch
> of quotes in it
> and was killing the shell.
>
>
> again, sorry about that.
>
> andy
>
>
> ________________________________
>
> From: Sherman, Larry, GCM
> [mailto:Larry.Sherman at rbsgc.com]
> Sent: Wednesday, March 01, 2006 8:41 AM
> To: hobbit at hswn.dk
> Subject: RE: [hobbit] Slightly OT: External Perl Script
>
>
>
> How about
>
>
>
> $LINE = "status $hostname.ups $color $now -
> some Text if you
> want it $msg";
>
> system("/path/to/bb $bbhost \"$LINE\" &")
>
>
>
> That's what I do
>
>
>
>
>
>
>
> -----Original Message-----
> From: Taylor, Robert
> [mailto:Robert.Taylor at HendrickAuto.com]
> Sent: Wednesday, March 01, 2006 9:24 AM
> To: hobbit at hswn.dk
> Subject: [hobbit] Slightly OT: External Perl Script
>
>
>
> All,
>
>
>
> This may be slightly off topic, but I figured
> that there is
> someone here
>
> that can help. Over the past weekend I wrote
> my first Perl script to
>
> replace a number of aging shell scripts that I
> had. What I
> have done is
>
> written Perl scripts to query Liebert UPS
> systems, Netbotz environment
>
> monitors and Juniper SSL VPN appliances.
> Needless to say I am now a
>
> believer in how much faster Perl is than shell.
> My scripts
> dropped from
>
> about almost two minutes to run to 8 seconds.
>
>
>
> I can see all of the output when I print to
> screen so I know
> that it is
>
> polling everything okay. The problem that I am
> having is getting Perl
>
> to send this data to Hobbit. It is just a
> formatting issue as I can
>
> have it send plain text fine, but I am trying
> to send HTML to create
>
> nice looking status pages. I have looked at previous
> scripts, but they
>
> all use the BigBrother.pm module and I would
> like to get this working
>
> without that. I am by no means a programmer
> but this problem is going
>
> to bother me until I can get it working.
>
>
>
> Perhaps someone could provide just a bit of
> Perl guidance?
> The portion
>
> of the code that I think it is getting hung up
> on is the colons in the
>
> HTML, but I am not sure.
>
>
>
> sub sendupdates {
>
>
>
> $msg = <<EOM;
>
> <html><body><center>
>
> <!-- Created with Version 3 of the Liebert Test
> Script-->
>
> <table border=\"0\" align=\"center\" id=\"table1\"
>
> style=\"height: 197px; width: 649px;\">
>
> <tbody>
>
> <tr>
>
> <th align=\"center\">
>
> <hr width=\"100%\"></th>
>
> </tr>
>
>
>
> < snip other HTML >
>
>
>
> </center>
>
> </body>
>
> </html>
>
>
>
> EOM
>
>
>
> my $now = localtime($^T) . "\n";
>
>
>
> if ($debug eq "yes"){
>
> print "------------------- Time Stamp
> --------------------\n";
>
> print "Time Stamp: $now\n";
>
> print "------------------- HTML Output
> -------------------\n";
>
> print $msg;
>
> }
>
>
>
>
>
> system("$bb $bbhost \"status ${bbhostname}.ups
> $color $now ${msg}\"");
>
>
>
>
>
> }
>
>
>
>
>
> The error messages that our output to the
> screen give the following:
>
>
>
> bb: incorrect number of arguments
>
> Format: <IP-ADDR> <DATA>
>
> sh: line 5: width:: command not found
>
> sh: line 13: >
>
>
>
> then there are also a lot of the following messages:
>
>
>
> sh: line 14: > </div>
>
> <table id=table2 style=width:: No such
> file or directory
>
> sh: line 14: height:: command not found
>
> sh: line 17: >
>
> <tbody>
>
> <tr>
>
> <th width=267style=font-weight::
> command not found
>
> sh: line 17: text-align:: command not found
>
> sh: line 18: >Hostname:</th>
>
>
>
>
>
> Thanks in advance for any help.
>
>
>
> Robert Taylor
>
>
>
>
>
> To unsubscribe from the hobbit list, send an e-mail to
>
> hobbit-unsubscribe at hswn.dk
>
>
>
>
>
> ________________________________
>
>
>
>
> *******************************************************************
> *
>
> This e-mail is intended only for the addressee
> named above.
> As this e-mail may contain confidential or
> privileged information,
> if you are not the named addressee, you are not
> authorized
> to retain, read, copy or disseminate this
> message or any part of
> it.
>
>
> *******************************************************************
> *
>
>
>
>
>
>
> To unsubscribe from the hobbit list, send an e-mail to
> hobbit-unsubscribe at hswn.dk
>
>
>
>
More information about the Xymon
mailing list