Changeset 7

Show
Ignore:
Timestamp:
10/02/2001 08:41:08 AM (7 years ago)
Author:
chris
Message:

Added the ability to receive and store multiple data points per RRD.
The store argument in the config must have comma-separated data names if there
are multiple data points to store at once. They must also match the DS names
created in the RRD file.

elvinrrd.cf has an example entry supporting multiple data points.

Location:
elvinrrd/trunk/elvinrrd
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • elvinrrd/trunk/elvinrrd/elvinrrd.cf

    r3 r7  
    1 # Elvin RRD Name to match       RRD filename                            What Elvin variable to store 
    2 #########################       #######################                 ############################ 
    3 elvinrrd=warrane-rad1.hay       rrdfile=/export/rrd/radiustiming/warrane-rad1.hay.rrd   store=timing 
    4 elvinrrd=yarrina-rad1.hay       rrdfile=/export/rrd/radiustiming/yarrina-rad1.hay.rrd   store=timing 
    5 elvinrrd=rexx-rad1.hay          rrdfile=/export/rrd/radiustiming/rexx-rad1.hay.rrd      store=timing 
    6 elvinrrd=hakisak-rad1.hay       rrdfile=/export/rrd/radiustiming/hakisak-rad1.hay.rrd   store=timing 
     1# elvinrrd.cf - Config File for elvinrrd.py 
     2# $Id$ 
     3# $Source$ 
     4# 
     5# Elvin RRD Name to match       RRD filename                                    What Elvin variable(s) to store 
     6#########################       #######################                         ############################### 
     7#### Load Averages 
     8elvinrrd=loadavg1-crazy         rrdfile=/export/rrd/loadavg/loadavg1-crazy.rrd  store=loadavg1 
     9elvinrrd=loadavg5-crazy         rrdfile=/export/rrd/loadavg/loadavg5-crazy.rrd  store=loadavg5 
     10elvinrrd=loadavg15-crazy        rrdfile=/export/rrd/loadavg/loadavg15-crazy.rrd store=loadavg15 
    711 
    8 elvinrrd=warrane-rad1.mel       rrdfile=/export/rrd/radiustiming/warrane-rad1.mel.rrd   store=timing 
    9 elvinrrd=yarrina-rad1.mel       rrdfile=/export/rrd/radiustiming/yarrina-rad1.mel.rrd   store=timing 
    10 elvinrrd=rexx-rad1.mel          rrdfile=/export/rrd/radiustiming/rexx-rad1.mel.rrd      store=timing 
    11 elvinrrd=hakisak-rad1.mel       rrdfile=/export/rrd/radiustiming/hakisak-rad1.mel.rrd   store=timing 
     12elvinrrd=loadavg1-mental        rrdfile=/export/rrd/loadavg/loadavg1-mental.rrd store=loadavg1 
     13elvinrrd=loadavg5-mental        rrdfile=/export/rrd/loadavg/loadavg5-mental.rrd store=loadavg5 
     14elvinrrd=loadavg15-mental       rrdfile=/export/rrd/loadavg/loadavg15-mental.rrd store=loadavg15 
    1215 
    13 elvinrrd=hakisak-radentoo       rrdfile=/export/rrd/radiustiming/hakisak-radentoo.rrd   store=timing 
     16#### Scan Rates 
     17elvinrrd=sr-mental              rrdfile=/export/rrd/scanrate/sr-mental.rrd      store=scanrate 
     18 
     19#### CPU 
     20elvinrrd=cpu-crazy              rrdfile=/export/rrd/cpu/cpu-crazy.rrd           store=cpu_user,cpu_nice,cpu_system,cpu_idle 
  • elvinrrd/trunk/elvinrrd/elvinrrd.py

    r3 r7  
    2222import elvin    # requires Elvin4 modules from http://elvin.dstc.edu.au/ 
    2323 
    24 ELVIN_URL='elvin://elvin.connect.com.au' 
     24ELVIN_URL='elvin://elvin' 
    2525ELVIN_SCOPE='elvin' 
    26 RRD_DB = '/var/tmp/test.rrd' 
    2726 
    2827################################################################ 
     
    9291        try: 
    9392            r = self.rrddict[msg[u'ELVINRRD']] 
    94             val = msg[u'%s'%(r.store)] 
    95             u = (r.rrdfile, "N:%s" % (str(val))) 
     93            storelist = string.split( r.store, ',' ) 
     94            if len(storelist) == 1: 
     95                # only one variable to store, use default method 
     96                val = msg[u'%s'%(r.store)] 
     97                u = (r.rrdfile, "N:%s" % (str(val))) 
     98            else: 
     99                # multiple variables to store - must name them 
     100                ds = "-t" 
     101                n = "N:" 
     102                for s in storelist: 
     103                    val = msg[u'%s'%(s)] 
     104                    ds = "%s%s:" % (ds,s) 
     105                    n = "%s%s:" % (n,str(val)) 
     106 
     107                ds = ds[:-1]    # remove ':' from end 
     108                n = n[:-1]      # remove ':' from end 
     109                u = (r.rrdfile, ds, n) 
     110 
    96111            print ' rrd.update( %s )' % (u,) 
    97112            self.rrd.update( u ) 
    98113 
    99         except KeyError: 
    100             print "KeyError with message %s" % (msg) 
     114        except KeyError, err: 
     115            print "KeyError, %s, with message %s" % (err, msg) 
    101116 
    102         except IOError: 
    103             print "IOError, cannot update rrd file for message %s" % (msg) 
     117        except IOError, err: 
     118            print "IOError, %s, cannot update rrd file for message %s" % (err, msg) 
    104119 
    105120