[rrd-users] CDEF: comparing Strings

Simon Hobson linux at thehobsons.co.uk
Tue Nov 8 12:22:46 CET 2011

Andre Luis wrote:
>well, I'm doing a cacti graph to show the weblogic server status..
>I take the status with a snmp get and my ideas was to do the following..
>1) get the Status..
>2) compare the status with the "Running" string
>3) if the strings match, the variable status_value would receive the 
>value 1, else it would be 0
>4) create the graph with the status_value variable ..so if the 
>server is running, my graphs would be in 1 .. else it would be in 0 
>do you have any idea of how could I do that?

Simple, in your script, translate from whatever you get back via SNMP 
to a numeric value. Eg, "good" = 1, "failed" = 0. Store that number 
(use gauge datatype) in RRD. Then what you get out from RRD will be a 
measure of "goodness" over the consolidation/normalisation period 
queried. Eg, if when you consolidate, half the samples were 1, and 
half were 0, then you'd get 0.5 returned.

Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.

More information about the rrd-users mailing list