<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:m =
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.3157" name=GENERATOR>
<STYLE>@font-face {
font-family: Calibri;
}
@font-face {
font-family: Tahoma;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.0in 1.0in 1.0in; }
P.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif"
}
LI.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif"
}
DIV.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif"
}
A:link {
COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
P {
FONT-SIZE: 12pt; MARGIN-LEFT: 0in; MARGIN-RIGHT: 0in; FONT-FAMILY: "Times New Roman","serif"; mso-style-priority: 99; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto
}
SPAN.EmailStyle18 {
COLOR: #1f497d; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal-reply
}
.MsoChpDefault {
FONT-SIZE: 10pt; mso-style-type: export-only
}
DIV.Section1 {
page: Section1
}
</STYLE>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV dir=ltr align=left><SPAN class=447514314-12102007><FONT face=Arial
color=#0000ff size=2>Hi.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=447514314-12102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=447514314-12102007><FONT face=Arial
color=#0000ff size=2>I would LOVE that idea .. especially since I had to dig
through a LOT of information and spend a lot of time to get all this
information.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=447514314-12102007><FONT face=Arial
color=#0000ff size=2>Just remember to give proper credits
:-)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=447514314-12102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=447514314-12102007><FONT face=Arial
color=#0000ff size=2>Also, it seems that a couple of lines are crappy down
below, the perl scripts would not work as they are below.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=447514314-12102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=447514314-12102007><FONT face=Arial
color=#0000ff size=2>You might want to parse a bit of it (or just post it and
i'll post a fixup).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=447514314-12102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=447514314-12102007><FONT face=Arial
color=#0000ff size=2>with regards,</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV align=left><FONT size=2>
<P align=left>------------------------------</P>
<P>Sigurður Guðbrandsson<BR>Raförninn ehf.<BR>Suðurhlíð 35<BR>105 Reykjavik |
Iceland<BR><A
href="mailto:sigurdur@raforninn.is">sigurdur@raforninn.is</A> | <A
href="http://www.raforninn.is/">www.raforninn.is</A></FONT><BR><FONT
size=2>Office: +(354) 552 2070<BR>Mobile: +(354) 867 3573</P>
<P>------------------------------</P></FONT></DIV>
<DIV> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Galen Johnson
[mailto:Galen.Johnson@sas.com] <BR><B>Sent:</B> 12. október 2007
14:29<BR><B>To:</B> hobbit@hswn.dk<BR><B>Subject:</B> RE: [hobbit] Custom graphs
in hobbit, resend, ATTN Alan Sparks<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=Section1>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Would
you mind if I include the content of this as an FAQ on The
Shire?<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">=G=<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p> </o:p></SPAN></P>
<DIV>
<DIV
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
<P class=MsoNormal><B><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'">From:</SPAN></B><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'"> Sigurður
Guðbrandsson [mailto:sigurdur@raforninn.is] <BR><B>Sent:</B> Friday, October 12,
2007 8:36 AM<BR><B>To:</B> hobbit@hswn.dk<BR><B>Subject:</B> [hobbit] Custom
graphs in hobbit, resend, ATTN Alan Sparks<o:p></o:p></SPAN></P></DIV></DIV>
<P class=MsoNormal><o:p> </o:p></P>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">(This is a resend
since the formatting was crapped out in the previous
mail)</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Hi.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">The problem with
parsing is to know what you want to parse.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">The first step is to
send your information to hobbit and see it
displayed.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Second step is to
configure hobbitlaunch.cfg file to send the data from the column to your
script.<BR> FROM
/etc/hobbit/hobbitlaunch.cfg<BR>[rrdstatus]<BR>
ENVFILE
/usr/lib/hobbit/server/etc/hobbitserver.cfg<BR>
NEEDS hobbitd<BR> CMD hobbitd_channel
--channel=status --log=$BBSERVERLOGS/rrd-status.log hobbitd_rrd
--extra-tests=hitastig --extra-script=/usr/lib/hobbit/server/ext/rrd_digitemp.pl
--rrddir=$BBVAR/rrd The --extra-tests is the definition of what columns you want
to parse. You can have as many columns as you like, comma seperated.<BR>The
--extra-script is the path to the script that you wish to run to do the parsing.
You can only have one there.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Then you have to edit
hobbitserver.cfg and add the test to TEST2RRD and GRAPHS variables.<BR>Then
either reboot the server or kill hobbit_channel processes (they should restart
the next time they are scheduled to run)</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">To begin to know what
you have to parse, just tell the script to write to some file (overwrite, not
append .. Unless of course you want it to grow bigger and bigger). It should be
very similar to what the web site shows.<BR>Alternatively there should be a way
to use the bb program to display it, but I didn't bother finding out
how.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Then of course you do
your parsing.<BR>I recommend that you read about RRD graphs and how you can
display different values (is it a counter, is it a variable like temperature,
percentage etc etc) on the official RRD website which slips my mind ATM where it
is located .. Google will probably help.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">You should receive 3
args from hobbit when it runs your script, it behaves so: $scriptname $hostname
$testname $messagefile The messagefile is a temporary file which you shall
parse.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">The final stage is to
output your information to hobbit in a way it understands, printing directly to
STDOUT.<BR>The format is so, note that you don’t have to have the type GAUGE,
replace with what you
need:<BR>DS:<datasetname>:GAUGE:600:0:100<BR><Testname>.<sensorname>.rrd<BR><value><BR>DS:<datasetname>:GAUGE:600:0:100<BR><Testname>.<sensor2name>.rrd<BR><value><BR>Etc
etc..</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">A tip for the wise, I
had a lot of struggle with this when I was making it, and then realised that I
can't have the datasetnames any different in all the files, it has to be static,
that is, one name.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Then you should check
if there are any RRD files being made.<BR>They should be located in
/var/lib/hobbit/rrd/<hostname>/</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Then there comes the
fun, to be able to show off your results in a graph. You should edit
hobbitgraph.cfg file for that.<BR>Mine looks like
this:<BR>[hitastig]<BR> FNPATTERN
hitastig.(.*).rrd<BR> TITLE
Hitastig<BR> YAXIS
Celsius<BR>
DEF:h@RRDIDX@=@RRDFN@:temperature:AVERAGE<BR>
LINE2:h@RRDIDX@#@COLOR@:@RRDPARAM@<BR>
GPRINT:h@RRDIDX@:LAST: \: %5.1lf
(cur)<BR> GPRINT:h@RRDIDX@:MAX: \:
%5.1lf (max)<BR> GPRINT:h@RRDIDX@:MIN:
\: %5.1lf (min)<BR>
GPRINT:h@RRDIDX@:AVERAGE: \: %5.1lf (avg)\n</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">The files it expects
are hitastig.<sensorname>.rrd, don't let that extra dot fool you, it needs
to be there.<BR>See in the DEF line, the name I chose for the datasets is
temperature. (I REMIND YOU AGAIN, IT NEEDS TO BE
STATIC)</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">If you do this
successfully, you should see a graph in hobbit as soon as you finish this last
thing (just let the website refresh once).</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">For reference (and of
course to future developers that will read the mailing list archive) I will
attach my scripts here so you know what to expect.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">dgitemp.pl -- This
script reads from digitemp values, names and peak values from the MySQL database
and sends them to hobbit.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">#!/usr/bin/perl<BR>#
This script reads digitemp values and writes them to a # temporary file which
the hobbit client sends out to # the Hobbit Monitor.<BR># This script really
should be rewritten so it will contain subs for operations.<BR># That would be
much more tidier.<BR># Written by Sigurdur Gudbrandsson<BR># <A
href="mailto:sigurdur@raforninn.is">sigurdur@raforninn.is</A></SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">use strict;<BR>use
DBI;</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"># Lets declare our
variables</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">my $db_user =
"username"; # Change to whatever your username is my $db_pass = "password"; #
Change to whatever your password is my $db_name = "stats"; my $table_meta =
"digitemp_metadata"; my $table = "digitemp";</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"># We need to get some
variables from the environment, don't change this my $BB = $ENV{BB}; my $BBDISP
= $ENV{BBDISP}; my $MACHINE = $ENV{MACHINE}; my $BBTMP =
$ENV{BBTMP};</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"># Change this to
whatever you want your test to be named my $testname =
"hitastig";</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"># Don't change this
or your test will never be green my $color =
"green";</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"># Set this to other
than 0 if you want to debug my $debug = 0;</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"># Lets connect to the
database<BR>my $dbh =
DBI->connect("DBI:mysql:$db_name","$db_user","$db_pass")<BR>
or die "I cannot connect to dbi:mysql:$db_name as $db_user -
$DBI::errstr\n";</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"># Lets get the sensor
ID's, names and min/max values</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">my $sql = "SELECT
SerialNumber,name,description,min,max FROM
$db_name.$table_meta";</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">my $sth =
$dbh->prepare($sql) or die "Can't execute statement $sql because:
$DBI::errstr"; $sth->execute();</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">my (@sensors) =
();<BR>while (my @ary = $sth->fetchrow_array())
{<BR> if ($ary[3] == "NULL")
{<BR>
$ary[3] = 0.000;<BR>
}<BR> if ($ary[4] == "NULL")
{<BR>
$ary[4] = 99.999;<BR>
}<BR> push(@sensors, [@ary]); #
[@ary] is a reference } $sth->finish();</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"># Now we have all the
sensors in a two dimensional array, @sensors # Also, if there is a NULL value in
min or max, it has been substituted with a value</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"># Now we will get the
temperature of each sensor from the database # and check if the temp is too high
or too low.</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">my $count =
0;<BR>while (@{sensors[$count]}) {<BR>
print "WHILE: entering first while loop\n" if
($debug);<BR> my $sql = "SELECT
Fahrenheit FROM $db_name.$table WHERE SerialNumber='$sensors[$count][0]' ORDER
BY dtKey DESC LIMIT 0,1";<BR> print
"SQL: term is \" $sql \" \n" if
($debug);<BR> my $sth =
$dbh->prepare($sql) or die "Can't execute statement $sql because:
$DBI::errstr";<BR>
$sth->execute();<BR>
$sensors[$count][5] =
$sth->fetchrow_array();<BR> if
($sensors[$count][5] >
$sensors[$count][4]){<BR>
print "IF: status for $sensors[$count][1] is red\n" if
($debug);<BR>
$sensors[$count][6] =
"&red";<BR>
$color = "red";<BR>
}<BR> elsif ($sensors[$count][5] <
$sensors[$count][3]){<BR>
print "IF: status for $sensors[$count][1] is yellow\n" if
($debug);<BR>
$sensors[$count][6] =
"&yellow";<BR>
if ($color !=
"red"){<BR>
$color =
"yellow";<BR>
}<BR>
}<BR> else
{<BR>
print "IF: status for $sensors[$count][1] is green\n" if
($debug);<BR>
$sensors[$count][6] =
"&green";<BR>
}<BR>
$sth->finish();<BR>
$count++;<BR>}</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"># We can close the
database now<BR>$dbh->disconnect();</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"># Next is to get our
results into an array # For reference, 0=SerialNumber 1=name 2=description 3=min
4=max 5=value 6=color in our array</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">my $tmp =
"\n"; # First line in the
array<BR>print $color if ($debug);<BR>$count = 0;<BR>while (@{sensors[$count]})
{<BR> print "WHILE: entering second
while loop\n" if ($debug);<BR> print
"WHILE: $sensors[$count][1] is being printed\n" if
($debug);<BR> $tmp =
$tmp." $sensors[$count][6]
$sensors[$count][1] =
$sensors[$count][5]\n";<BR> $tmp =
$tmp." :
min=$sensors[$count][3]
max=$sensors[$count][4]\n";<BR> $tmp =
$tmp." :
$sensors[$count][2]\n\n";<BR>
$count++;<BR>}</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"># Now we decode from
UTF-8 to latin1 (iso-8859-1) if there is anything in utf8 open(TEMP,
">$BBTMP/$testname.tmp.txt"); print TEMP $tmp;
close(TEMP);</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"># Now we get the
converted data<BR>$tmp = `/usr/bin/iconv -f utf8 -t iso-8859-1
$BBTMP/$testname.tmp.txt`;</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"># Now finally we
output the information to our beloved hobbit my $date = localtime; my $cmd =
"$BB $BBDISP \"status $MACHINE.$testname $color $date \n $tmp \n \"";
system($cmd);</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">print $cmd if
($debug);<BR>print $tmp if ($debug);</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">exit;</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"><BR>Here is the
output from this script<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
&green Tölvu_kæling = 21.25
C<BR> :
min=1.000
max=25.000<BR>
: This sensor has not yet been described<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
&green Verkstæði = 25.81
C<BR> :
min=0.000
max=99.999<BR>
: This sensor has not yet been described<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
&green Tölvuskápur = 22.12
C<BR> :
min=14.000
max=25.000<BR>
: This sensor has not yet been described<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
&green Tölvu_kæl_út = 46.38
C<BR> :
min=0.000
max=99.999<BR>
: This sensor has not yet been described<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">rrd_digitemp.pl --
This script parses the information from hobbit and produces the channel data to
make the RRD files.<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">#!/usr/bin/perl<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">use
strict;<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"># Input parameters:
Hostname, testname (column), and messagefile my $hostname=$ARGV[0]; my
$testname=$ARGV[1]; my $fname=$ARGV[2];<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">my ($line1, @line,
@buff, @key, @value, $value, @tmp);<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">open(IN,"$fname");<BR>read(IN,
$line1, 10000);<BR>@line=split('\n',$line1);<BR>@buff = grep(/ =
/,@line);<BR>close(IN);<BR>chomp(@buff);
# Lets strip the newline if there is any.<BR>for( my $i = 0; $i <
scalar(@buff); $i++) # Now we go through the
whole array of lines<BR>{<BR>
$buff[$i] = substr($buff[$i], 10); # Trimming the
beginning<BR> $buff[$i] =~ s/
C//g;
# Removing the end<BR> $buff[$i] =~ s/
//g;
# Removing all the whitespace<BR> @tmp
= split('=', $buff[$i]);<BR> $key[$i]
= makesafe($tmp[0]);<BR> $value[$i] =
$tmp[1];<BR># print
$buff[$i]."\n";
# Printing a test line to view the results<BR>}<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">open(IN,">>/var/log/hobbit/custrrd.log");<BR>write($buff[1]);<BR>close(IN);<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"><BR># The next loop
will print out the information for making the RRD file.<BR>for( my $i = 0; $i
< scalar(@key); $i++ ) {<BR> print
"DS:temperature:GAUGE:600:0:100\n"; # Prints out
each sensor name<BR># print
"DS:".$key[$i].":GAUGE:600:0:100\n"; # Prints out
each sensor name<BR> print
$testname.".".$key[$i].".rrd\n";
# Prints out the rrd file name<BR>
print
$value[$i]."\n";
# Prints out the value<BR>}<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"># This sub produces
safe output so hobbit will be able to make the files # (It seems that hobbit
doesn't like special letters in file names) sub makesafe
{<BR> my $word =
shift;<BR> $word =~
s/ö/o/g;<BR> $word =~
s/á/a/g;<BR> $word =~
s/í/i/g;<BR> $word =~
s/é/e/g;<BR> $word =~
s/ó/o/g;<BR> $word =~
s/ý/y/g;<BR> $word =~
s/ú/u/g;<BR> $word =~
s/æ/ae/g;<BR> $word =~
s/ð/d/g;<BR> $word =~
s/þ/th/g;<BR># $word =~
s/_//g;<BR># $word =
lc($word);<BR> return
$word;<BR>}<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">exit;<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"><BR>I hope this isn't
overkill. :)<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">With
regards,<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">------------------------------<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Sigurður
Guðbrandsson<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Raförninn
ehf.<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Suðurhlíð
35<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">105 Reykjavik |
Iceland<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"><A
href="mailto:sigurdur@raforninn.is">sigurdur@raforninn.is</A> | <A
href="http://www.raforninn.is">www.raforninn.is</A><o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Office: +(354) 552
2070<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Mobile: +(354) 867
3573<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">------------------------------<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"><BR>-----Original
Message-----<BR>From: Alan Sparks [mailto:asparks@doublesparks.net]<BR>Sent: 10.
október 2007 21:06<BR>To: Sigurður Guðbrandsson<BR>Subject: Re: [hobbit] Custom
graphs with multiple data sources<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Since I am in the
same boat with my server (downtime not an option), I am interested in your
approach. I already have custom scripts for this, but am interested in
what you do differently as far as parsing. Are you parsing the incoming
messages and re-sending them to Hobbit? What is the "proper
format?"<BR>Thanks for your reply.<BR>-Alan<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> wrote:<BR>>
Hi.<BR>><BR>> There is a fourth option, which I took as updating to
snapshot caused my hobbit to break for some reason, and seeing that it is a
system I must have up 99% of the day, I just backported.<BR>> Well, that was
not the option anyways :)<BR>><BR>> My suggestion is that you make a
custom script to parse your information and create the RRD's (actually the
hobbit server manages creating the RRD's .. You just have to parse the
information and send it in the proper format to hobbit).<BR>> That way you
can have your multi-file RRD's (one per balancer or some) and you don't have to
update to snapshot.<BR>><BR>> I wrote my script in perl (my very first
perl script .. How I hate the language ;) and it works very well.<BR>> You
will not find it in the Shire, mainly because I haven't posted it there
yet.<BR>><BR>> If you need info on how the information is, and how to
parse it, just drop me a line.<BR>><BR>> With
regards,<BR>><BR>><BR>> ------------------------------<BR>><BR>>
Sigur ur Gu brandsson<BR>><BR>> Raf rninn ehf.<BR>><BR>> Su
urhl 35<BR>><BR>> 105 Reykjavik | Iceland<BR>><BR>> <A
href="mailto:sigurdur@raforninn.is">sigurdur@raforninn.is</A> | <A
href="http://www.raforninn.is">www.raforninn.is</A><BR>><BR>> Office:
+(354) 552 2070<BR>><BR>> Mobile: +(354) 867 3573<BR>><BR>>
------------------------------<BR>><BR>><BR>> -----Original
Message-----<BR>> From: Charles Goyard
[mailto:charles.goyard@orange-ftgroup.com]<BR>> Sent: 10. okt ber 2007
06:50<BR>> To: <A href="mailto:hobbit@hswn.dk">hobbit@hswn.dk</A><BR>>
Subject: Re: [hobbit] Custom graphs with multiple data sources<BR>><BR>>
Hi,<BR>><BR>><BR>> Alan Sparks wrote :<BR>><BR>>
<BR>>> However, with this, I am only able to manage one graph, and one
data <BR>>> source, per device. I would like to graph all the
session values.<BR>>> I would also like to use multiple RRD files.
My experience with the <BR>>> single-file, multiple-DS approach is that,
if I add another virtual, <BR>>> graphing will break (updates error out,
probably since the RRD was <BR>>> not created with this new data source
defined).<BR>>> [...]<BR>>> <BR>><BR>>
Check the september 2007 mail archives, there's a discussion about
it.<BR>><BR>> There's three solutions :<BR>><BR>> - apply a patch I
posted on the list (does split-ncv on a testname<BR>> basis). My
patch has a memory leak, so beware (I kill my hobbitd_rrd<BR>>
every 24h).<BR>> - send "data" messages with a body like
"foo.rrd:mydsname:GAUGE:500<BR>> (Sorry, no pointers for that
one, and it needs a recent snapshot).<BR>> - take a snapshot or a least the
hobbitd/rrd directory from the source,<BR>> it includes the
split-ncv feature without the memory leak (thank<BR>>
Henrik).<BR>><BR>><BR>> --<BR>> Charles Goyard - <A
href="mailto:charles.goyard@orange-ftgroup.com">charles.goyard@orange-ftgroup.com</A>
- (+33) 1 45 38 01<BR>> 31 Orange Business Services - online multimedia
// ing nierie<BR>><BR>> To unsubscribe from the hobbit list, send an
e-mail to <BR>> <A
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
href="mailto:hobbit-unsubscribe@hswn.dk">hobbit-unsubscribe@hswn.dk</A><BR>><BR>><BR>><BR>>
<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"><BR>--<BR>Alan
Sparks, UNIX/Linux Systems Integration and Administration <<A
href="mailto:asparks@doublesparks.net">asparks@doublesparks.net</A>></SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<P><SPAN
style="FONT-SIZE: 10pt">------------------------------<o:p></o:p></SPAN></P>
<P><SPAN style="FONT-SIZE: 10pt">Sigurður Guðbrandsson<BR>Raförninn
ehf.<BR>Suðurhlíð 35<BR>105 Reykjavik | Iceland<BR><A
href="mailto:sigurdur@raforninn.is">sigurdur@raforninn.is</A> | <A
href="http://www.raforninn.is/">www.raforninn.is</A></SPAN><BR><SPAN
style="FONT-SIZE: 10pt">Office: +(354) 552 2070<BR>Mobile: +(354) 867
3573<o:p></o:p></SPAN></P>
<P><SPAN
style="FONT-SIZE: 10pt">------------------------------<o:p></o:p></SPAN></P>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV></DIV></BODY></HTML>