<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Thanks for sharing the code of your modification.<BR>
I will need to parse "uname -a" section and have a hash or array to keep counting of os appearance... etc.<BR>
 <BR>
later<BR>
<BR><BR>T.J. Yang<BR><BR><BR><BR>> Date: Wed, 12 Nov 2008 07:34:06 -0500<BR>> From: michael.nemeth@lmco.com<BR>> To: hobbit@hswn.dk<BR>> Subject: Re: [hobbit] [Hobbit/Xymon] PDF Reports<BR>> <BR>> |I have a pet project to write a oscount hobbit server side module by <BR>> modifying<BR>> |Henrik's rootlogin perl script. The script is to display statistics of <BR>> OS types and their verions.<BR>> Maybe this will help you with your project<BR>> This is what to "parse " ps output on the server side to chech for <BR>> running back-up (save -s).<BR>> Watch out for line wraps<BR>> #!/usr/local/bin/perl<BR>> <BR>> #*----------------------------------------------------------------------------*/<BR>> #* Hobbit client message <BR>> processor. */<BR>> #* <BR>> */<BR>> #* This perl program shows how to create a server-side module using <BR>> the */<BR>> #* data sent by the Hobbit clients. This program is fed data from <BR>> the */<BR>> #* Hobbit "client" channel via the hobbitd_channel program; each <BR>> client */<BR>> #* message is processed by looking at the [who] section and <BR>> generates */<BR>> #* a "login" status that goes red when an active "root" login is <BR>> found. */<BR>> #* <BR>> */<BR>> #* Written 2007-Jan-28 by Henrik Storner <BR>> <henrik@hswn.dk> */<BR>> #* <BR>> */<BR>> #* This program is in the public domain, and may be used freely <BR>> for */<BR>> #* creating your own Hobbit server-side <BR>> modules. */<BR>> #* Henrik's script was modified by me, Mike Nemeth <BR>> Michael.nemeth@lmco.com */<BR>> #* the rootlogin.pl which parses the [who] section was changed to <BR>> parse */<BR>> #* the [ps] of client <BR>> data. */<BR>> #* Often Ive seen people ask how to monitor a certain proccess and <BR>> have */<BR>> #* a separted test/column for it This works for <BR>> me! */<BR>> #* <BR>> */<BR>> #*----------------------------------------------------------------------------*/<BR>> <BR>> # $Id: rootlogin.pl,v 1.1 2007/01/28 12:42:34 henrik Exp $<BR>> # look for back-ups running: save -s<BR>> <BR>> my $bb;<BR>> my $bbdisp;<BR>> my $hobbitcolumn = "bkup";<BR>> my $hostname = "";<BR>> my $msgtxt = "";<BR>> my %sections = ();<BR>> my $cursection = "";<BR>> <BR>> sub processmessage;<BR>> <BR>> <BR>> # Get the BB and BBDISP environment settings.<BR>> $bb = $ENV{"BB"} || die "BB not defined";<BR>> $bbdisp = $ENV{"BBDISP"} || die "BBDISP not defined";<BR>> <BR>> <BR>> # Main routine.<BR>> #<BR>> # This reads client messages from <STDIN>, looking for the<BR>> # delimiters that separate each message, and also looking for the<BR>> # section markers that delimit each part of the client message.<BR>> # When a message is complete, the processmessage() subroutine<BR>> # is invoked. $msgtxt contains the complete message, and the<BR>> # %sections hash contains the individual sections of the client<BR>> # message.<BR>> <BR>> while ($line = <STDIN>) {<BR>> if ($line =~ /^\@\@client\#/) {<BR>> # It's the start of a new client message - the header <BR>> looks like this:<BR>> # <BR>> @@client#830759/HOSTNAME|1169985951.340108|10.60.65.152|HOSTNAME|sunos|sunos<BR>> <BR>> # Grab the hostname field from the header<BR>> @hdrfields = split(/\|/, $line);<BR>> $hostname = $hdrfields[3];<BR>> <BR>> # Clear the variables we use to store the message in<BR>> $msgtxt = "";<BR>> %sections = ();<BR>> }<BR>> elsif ($line =~ /^\@\@/) {<BR>> # End of a message. Do something with it.<BR>> processmessage();<BR>> }<BR>> elsif ($line =~ /^\[(.+)\]/) {<BR>> # Start of new message section.<BR>> <BR>> $cursection = $1;<BR>> $sections{ $cursection } = "\n";<BR>> }<BR>> else {<BR>> # Add another line to the entire message text variable,<BR>> # and the the current section.<BR>> $msgtxt = $msgtxt . $line;<BR>> $sections{ $cursection } = $sections{ $cursection } . $line;<BR>> }<BR>> }<BR>> <BR>> <BR>> # This subroutine processes the client message. In this case,<BR>> # we watch the [ps] section of the client message and alert<BR>> # if our string is found: save -s meaning backs are active.<BR>> <BR>> <BR>> sub processmessage {<BR>> my $color;<BR>> my $summary;<BR>> my $statusmsg;<BR>> my $cmd;<BR>> my $cmdl;<BR>> <BR>> # Dont do anything unless we have the "ps" section<BR>> return unless ( $sections{"ps"} );<BR>> <BR>> # Is the string/process somewhere in the "ps" section?<BR>> # Note that we must match with /m because there are multiple<BR>> # lines in the [ps] section.<BR>> if ( ($cmdl) = $sections{"ps"} =~ /(save.+-s.*)/ ) {<BR>> $color = "yellow";<BR>> $summary = "There MAYBE active backups" ;<BR>> # $statusmsg = "&yellow " . $cmdl . $sections{"ps"};<BR>> # sendins out the entire ps section seam to cause some purples so just <BR>> send the match `, hey you've a proc column all ready.<BR>> $statusmsg = "&yellow " . $cmdl ;<BR>> }<BR>> else {<BR>> $color = "green";<BR>> $summary = "Ok";<BR>> $statusmsg = "&green No backup active\n\n";<BR>> }<BR>> # Build the command we use to send a status to the Hobbit daemon<BR>> $cmd = $bb . " " . $bbdisp . " \"status " . $hostname . "." . <BR>> $hobbitcolumn . " " . $color . " " . $summary . "\n\n"<BR>> . $statusmsg . "\"";<BR>> # And send the message<BR>> system $cmd;<BR>> }<BR>> <BR>> <BR>> <BR>> <BR>> T.J. Yang wrote:<BR>> ><BR>> ><BR>> > --------------------------------------------------<BR>> > From: "Martin Flemming" <martin.flemming@desy.de><BR>> > Sent: Wednesday, November 12, 2008 4:14 AM<BR>> > To: <hobbit@hswn.dk><BR>> > Subject: Re: [hobbit] [Hobbit/Xymon] PDF Reports<BR>> ><BR>> >><BR>> >> Hi, Thomas ..<BR>> >><BR>> >> i'm very interesting and other too, i think :-)<BR>> ><BR>> > Second that.<BR>> > you can post your script here, I will upload the script to svn <BR>> > repository.<BR>> ><BR>> > Or request an account from Henrik and upload the script yourself.<BR>> ><BR>> > I have a pet project to write a oscount hobbit server side module by <BR>> > modifying<BR>> > Henrik's rootlogin perl script. The script is to display statistics of <BR>> > OS types and their verions.<BR>> > This is useful for management to understand how many Solaris 2.5.1, <BR>> > 2.6 are still hanging around<BR>> > in a big IT environment.<BR>> ><BR>> ><BR>> > tj<BR>> ><BR>> >> .. the shire will be the right place ..<BR>> >><BR>> >> cheers,<BR>> >> martin<BR>> >><BR>> >> On Wed, 12 Nov 2008, Thomas Séglard wrote:<BR>> >><BR>> >>> Hello,<BR>> >>><BR>> >>> some months (year ?) ago, I wrote a few php/shell code lines to <BR>> >>> generate<BR>> >>> on-demand/automatised PDF reports with the help of the RRD data <BR>> >>> produced by<BR>> >>> Hobbit. At the time of coding, I've used 'libfpdf' but it's a pain <BR>> >>> to include<BR>> >>> PNG with alpha-channel.<BR>> >>><BR>> >>> I'm now in charge of a new platform and I setup Hobbit to monitor <BR>> >>> everything,<BR>> >>> of course :) Besides, I discovered the library 'tcpdf' which is very <BR>> >>> good and<BR>> >>> efficient. So, I decided to bring back my reports and have them to <BR>> >>> work with<BR>> >>> 'tcpdf'. Modifications were easy since 'tcpdf' is based on 'libfpdf' <BR>> >>> and now<BR>> >>> everything works again :) But this time, I really want to share this <BR>> >>> work<BR>> >>> with you on the Shire or whatever. I need to know if some of you are<BR>> >>> interested by these reports... Thus, just let me know.<BR>> >>><BR>> >>> Best regards,<BR>> >>><BR>> >>> ThomaS<BR>> >>><BR>> >>> To unsubscribe from the hobbit list, send an e-mail to<BR>> >>> hobbit-unsubscribe@hswn.dk<BR>> >>><BR>> >>><BR>> >>><BR>> >>><BR>> >><BR>> ><BR>> ><BR>> ><BR>> >> To unsubscribe from the hobbit list, send an e-mail to<BR>> >> hobbit-unsubscribe@hswn.dk<BR>> >><BR>> ><BR>> > To unsubscribe from the hobbit list, send an e-mail to<BR>> > hobbit-unsubscribe@hswn.dk<BR>> ><BR>> ><BR>> ><BR>> <BR>> <BR>> To unsubscribe from the hobbit list, send an e-mail to<BR>> hobbit-unsubscribe@hswn.dk<BR>> <BR>> <BR><BR><br /><hr />Windows Live Hotmail now works up to 70% faster. <a href='http://windowslive.com/Explore/Hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_faster_112008' target='_new'>Sign up today.</a></body>
</html>