<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2>Are you trying to do something with</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2>TIMESTAMP=`/bin/ping -c1 -T tsonly host.domain.com | 
/usr/bin/awk ' $1 == "TS:" { print $2 } '`</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2>The key here is that you can use an awk script to extract 
the number (field no 2 on the line begining with TS:)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2>This extracts the big integer from the timestamp answer, 
but you need to know what to do with it.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2>You can learn awk scripts and regular expressions 
in O´Reilly's "sed & awk pocket 
reference".</FONT></SPAN></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2>Another solution is to have a nice Bourne shell function 
like this:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2>tsprint() {</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2>    while read line</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006>    <FONT 
face=Arial color=#0000ff size=2>do</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN 
class=799051211-30112006>        <FONT 
face=Arial color=#0000ff size=2>set bogus $line    # $line could 
be empty. Plain "set" would dump the environment variables. Hence a "bogus" and 
shift.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN 
class=799051211-30112006>        <FONT 
face=Arial color=#0000ff size=2>shift</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN 
class=799051211-30112006>        <FONT 
face=Arial><FONT color=#0000ff size=2>if [ "$1" == "TS:" 
]</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN 
class=799051211-30112006>        <FONT 
face=Arial color=#0000ff size=2>then</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN 
class=799051211-30112006>            
<FONT face=Arial color=#0000ff size=2>echo "$2"</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN 
class=799051211-30112006>            
<FONT face=Arial color=#0000ff size=2>break</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN 
class=799051211-30112006>        <FONT 
face=Arial color=#0000ff size=2>else</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN 
class=799051211-30112006>            
<FONT face=Arial color=#0000ff size=2>continue # loop</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN 
class=799051211-30112006>        <FONT 
face=Arial color=#0000ff size=2>fi</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006>    <FONT 
face=Arial color=#0000ff size=2>done</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2>}</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006>    
</SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2>TIMESTAMP=`/bin/ping -c1 -T tsonly host.domain.com | 
tsprint`</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2>Then you can compare the size of the timestamp using ' if [ 
$VARIABLE -lt $THRESHOLD ]; then ...</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2>Numeric comparisons: -lt, -le, -eq, -ge, 
-gt</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2>String comparisons: ==, !=</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=799051211-30112006><FONT face=Arial color=#0000ff 
size=2>Recommended reading:</FONT></SPAN></DIV>
<DIV><SPAN class=799051211-30112006><FONT face=Arial color=#0000ff 
size=2>1) </FONT></SPAN><SPAN class=799051211-30112006><FONT face=Arial 
color=#0000ff size=2>A good book about bourne shell scripts and Unix 
command line in general is "Sams teach yourself shell programming in 24 
hours".</FONT></SPAN></DIV>
<DIV><SPAN class=799051211-30112006><FONT face=Arial color=#0000ff size=2>2) 
Bourne shell is a bit archaic, and Bash provides many nice improvements 
such as calculations and arrays. "man bash" is enough, after you master the 
Bourne shell.</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=799051211-30112006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=799051211-30112006>You 
should now be able to complete yout monitoring plugin. As your thesis is 
about Hobbit, you should certainly know how to implement basic extensions. Take 
a look at the plugins.</SPAN></FONT></DIV>
<DIV><BR> </DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Giorgio Volpini [mailto:vorpini@gmail.com] 
<BR><B>Sent:</B> Thursday, November 30, 2006 11:46 AM<BR><B>To:</B> 
henrik@hswn.dk; hobbit@hswn.dk<BR><B>Subject:</B> [hobbit] Hobbit 
help<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=4>Dear Mr.Storner,</FONT></DIV>
<DIV><FONT face=Arial size=4>my name's Giorgio Volpini, I'm a Computer Science 
student of the university of Pisa.</FONT></DIV>
<DIV><FONT face=Arial size=4></FONT> </DIV>
<DIV><FONT face=Arial size=4>I need some help about your program : Hobbit. Few 
months ago I used Hobbit during my stage and now I'm writing a thesis about 
it. I'd like to complete my report with a dimostration of Bash-script to use in 
the program; my problem is that i don't know Bash-scripting and I have not 
enought time to learn it. If I don't give you too much trouble, I needa script 
to control the time of presence rivelators connected in Lan with Hobbit 
server.</FONT></DIV>
<DIV><FONT face=Arial size=4></FONT> </DIV>
<DIV><FONT face=Arial size=4>I also have a general idea about the 
script:</FONT></DIV>
<DIV><FONT face=Arial size=4>    - ping the 
rivelator</FONT></DIV>
<DIV><FONT face=Arial size=4>    - compare the time of the answer 
packet with Hobbit system time</FONT></DIV>
<DIV><FONT face=Arial size=4>    - decide if it's all ready or 
not</FONT></DIV>
<DIV><FONT face=Arial size=4>    - warn the administrator with 
e-mail, sms or only with Hobbit web interface</FONT></DIV>
<DIV><FONT face=Arial size=4>I need only a dimostrative script to add an my 
report, so is not important that it works perfectly, but only that 
bash-script has right syntax.</FONT></DIV>
<DIV><FONT face=Arial size=4></FONT> </DIV>
<DIV><FONT face=Arial size=4>Your help is very important for me and I think it 
is an work for you.</FONT></DIV>
<DIV><FONT face=Arial size=4></FONT> </DIV>
<DIV><FONT face=Arial size=4>Thank you very much for your 
attention.</FONT></DIV>
<DIV><FONT face=Arial size=4></FONT> </DIV>
<DIV><FONT face=Arial size=4>Your faithfully.</FONT></DIV>
<DIV><FONT face=Arial size=4></FONT> </DIV>
<DIV><FONT face=Arial size=4>Giorgio Volpini.</FONT></DIV></BODY></HTML>