Graphs

Lawrence, Lynne LLawrence at osc.uscg.mil
Tue Oct 26 17:18:07 CEST 2004


<snip>
> > ... "output:offset:/-?([0-9.]+)/" "output:jitter:/jitter 
> ([0-9.]+) msec/"
> > 
> > As it is there ^^, this is what happens:
> > 
> >  +VALUE: 0.000492
> >  +VALUE: 0.157
> > 
> > So far, so fine... Now I change the regexp to read "Offset 
> -?([0-9.]+)", and
> > still it only pulls the number (a good thing for me, I only 
> want the number
> > - but that is not how I was understanding things.  The same 
> for the jitter
> > part, why does nagiostat only pull the numbers ?).
> >  
> > But now, ntp offset is not always positive, that is why I 
> added '-?', so, I
> > get a line that reads:
> > 
> > OUTPUT="NTP OK: Offset -0.000509 secs, jitter 0.157 msec, 
> peer is stratum 3"
> > 
> > And my regexp is ^^, the output:
> > 
> >  +VALUE: 0.000509
> >  +VALUE: 0.157
> > 
> > What happened to '-' ?  I want to insert a negative value 
> into RRD, so this
> > is wrong for me.
> > 
> 
> Parentheses create back-references. Include the minus (without the 
> question mark) inside the parentheses and it will be output 
> (I think. I 
> haven't tried the regex engine of nagiostat).

Actually, I believe you _do_ want to include the '?' in the parens,
otherwise positive values will not match.  Try:

   "output:offset:/(-?[0-9.]+)/"

to pick up either positive or negative values.

Regards,

Lynne Lawrence
QSS/USCG
<snip>
> 


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list