[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [hobbit] wildcards or regex with SPLITNCV



Shawn

I'm not using SPLITNCV as I wanted a bit more flexibility in the format of the status report (I wanted to have comment line, single colons not delimiting values etc.), but am using an external script. You may find my earlier reply here
http://www.hswn.dk/hobbiton/2008/10/msg00159.html useful though.

With the external script mechanism you don't need to restart Hobbit if your test generates additional indexes, only if you add new tests. I'm not entirely sure whether SPLITNCV works the same although it looks OK - but you sound perfectly at home with the source, so have a look at that (do_ncv.c). If you're interested, I attach my parsing script to the end of this - enter the test name list and change the regex for your needs. The commented lines were from when I was using a single RRD file for all indices, but that doesn't give the flexibility of displaying multiple graphs, or adding additional indices.

Graham Nayler

#!/usr/bin/python

import sys, re

def main():
   #print len(sys.argv), sys.argv
   if( sys.argv[2] in (<enter test name list here>)):
       #print "%s scanning file '%s'"%(sys.argv[2], sys.argv[3])
       data = ""
       lineno = 0
       f = open(sys.argv[3],'r')
       for line in f:
           lineno = lineno+1
           if (lineno > 2):
mo = re.match("(.*\s+)?([^\s]+)\s*::\s*(-?[0-9\.]*).*$",line)
               if not (mo == None):
                   if( len(mo.group(3)) > 0 ):
                       print "DS:%s:GAUGE:600:U:U"%mo.group(2)
#                        if len(data) > 0:
#                            data = data + ":" + mo.group(3)
#                        else:
#                            data = mo.group(3)
                       print "%s.%s.rrd"%(sys.argv[2],mo.group(2))
                       print mo.group(3)
       f.close()
#        if( len(data) > 0 ):
#            print "%s.rrd"%sys.argv[2]
#            print data

if __name__ == "__main__":
   main()


----- Original Message ----- From: "Shawn Heisey" <hobbit (at) elyograg.org>
To: <hobbit (at) hswn.dk>
Sent: Monday, October 13, 2008 9:56 PM
Subject: Re: [hobbit] wildcards or regex with SPLITNCV


Shawn Heisey wrote:
I am working on setting up graphs to track an application. I have created a test that produces the output at the end of this message, I want to use SPLITNCV to handle it, but I don't want to be required to update the hobbit configuration and restart when the number of indexes in the system increases.
I have not been able to find a SPLITNCV example like the following one for regular NCV:

http://www.hswn.dk/~henrik/howtograph.txt

To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe (at) hswn.dk