[rrd-users] CDEF: comparing Strings

Simon Hobson linux at thehobsons.co.uk
Mon Nov 7 12:10:43 CET 2011


Andre Luis wrote:
>hello, I'm new into cacti and I would like to know it there's a way 
>to compare strings with CDEF ...
>
>I did some tests using numbers and it worked, but when I try with 
>strings, it gives an error.."ERROR: invalid rpn expression in:"

That's because these functions only work, and only makes sense with, 
numbers. You cannot store strings in RRD databases, so there aren't 
tools to work with them.

If you need to do conditionals based on strings from "the outside", 
then you may need to dynamically build your graph/query definitions. 
Eg, in Bash :

(
   echo "<some stuff>"

   if [ "$a" = "test" ]
   then
     echo "<some more stuff>"
   else
     echo "<some other stuff>"
   fi
   echo "<finishing stuff>"
) | rrdcgi .....

I have some cgi scripts building many dynamic graphs, all written in Bash.

-- 
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