<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I Did a little work on this yesterday. You have to parse the info
section and look for the string "OS:"  gabbing that line<br>
for further processing.  BUT I think Ive an easy way to do what you
want, will look into it today!<br>
<br>
T.J. Yang wrote:
<blockquote cite="mid:BAY138-W15C57FFF741F29336F6CAE9F140@phx.gbl"
 type="cite">
  <style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
  </style>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: <a class="moz-txt-link-abbreviated" href="mailto:michael.nemeth@lmco.com">michael.nemeth@lmco.com</a><br>
> To: <a class="moz-txt-link-abbreviated" href="mailto:hobbit@hswn.dk">hobbit@hswn.dk</a><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>
> <a class="moz-txt-link-rfc2396E" href="mailto:henrik@hswn.dk"><henrik@hswn.dk></a> */<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>
> <a class="moz-txt-link-abbreviated" href="mailto:Michael.nemeth@lmco.com">Michael.nemeth@lmco.com</a> */<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" <a class="moz-txt-link-rfc2396E" href="mailto:martin.flemming@desy.de"><martin.flemming@desy.de></a><br>
> > Sent: Wednesday, November 12, 2008 4:14 AM<br>
> > To: <a class="moz-txt-link-rfc2396E" href="mailto:hobbit@hswn.dk"><hobbit@hswn.dk></a><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>
> >>> <a class="moz-txt-link-abbreviated" href="mailto:hobbit-unsubscribe@hswn.dk">hobbit-unsubscribe@hswn.dk</a><br>
> >>><br>
> >>><br>
> >>><br>
> >>><br>
> >><br>
> ><br>
> ><br>
> ><br>
> >> To unsubscribe from the hobbit list, send an e-mail to<br>
> >> <a class="moz-txt-link-abbreviated" href="mailto:hobbit-unsubscribe@hswn.dk">hobbit-unsubscribe@hswn.dk</a><br>
> >><br>
> ><br>
> > To unsubscribe from the hobbit list, send an e-mail to<br>
> > <a class="moz-txt-link-abbreviated" href="mailto:hobbit-unsubscribe@hswn.dk">hobbit-unsubscribe@hswn.dk</a><br>
> ><br>
> ><br>
> ><br>
> <br>
> <br>
> To unsubscribe from the hobbit list, send an e-mail to<br>
> <a class="moz-txt-link-abbreviated" href="mailto:hobbit-unsubscribe@hswn.dk">hobbit-unsubscribe@hswn.dk</a><br>
> <br>
> <br>
  <br>
  <br>
  <hr>Windows Live Hotmail now works up to 70% faster. <a
 moz-do-not-send="true"
 href="http://windowslive.com/Explore/Hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_faster_112008"
 target="_new">Sign up today.</a></blockquote>
<br>
</body>
</html>