Commits

Anonymous committed f1c5d80

adding tmax and dmax as arguments to the GangliaMetric object so that modules may choose to set them if need be.

Comments (0)

Files changed (2)

src/ganglia-logtailer

             if ( metric_prefix != "" ):
                 m.name = metric_prefix + "_" + m.name
 
-            logger.debug( "Submitting gmetric: %s %s --name %s --value %s --type %s --units %s" %
-                 (gmetric, gmetric_options, m.name, m.value, m.type, m.units) )
-            os.system("%s %s --name %s --value %s --type %s --units %s" %
-                (gmetric, gmetric_options, m.name, m.value, m.type, m.units) )
+            logger.debug( "Submitting gmetric: %s %s --name %s --value %s --type %s --units %s --tmax %s --dmax %s" %
+                 (gmetric, gmetric_options, m.name, m.value, m.type, m.units, m.tmax, m.dmax) )
+            os.system("%s %s --name %s --value %s --type %s --units %s --tmax %s --dmax %s" %
+                (gmetric, gmetric_options, m.name, m.value, m.type, m.units, m.tmax, m.dmax) )
     except LogtailerStateException, e:
         logger.warning( "State exception caught (line %s): %s" % (lineno(), e) )
 
     cmdline.add_option('--classname', '-c', action='store', help='The name of the plugin to use to parse the log file')
     cmdline.add_option('--log_file', '-l', action='store', help='The path to the file to tail and parse')
     cmdline.add_option('--metric_prefix', '-p', action='store', help='Add prefix to all published metrics. This is for people that may multiple instances of same service on same host. So if your metric is e.g. gc_time it becomes tomcat1_gc_time', default='' )
-    cmdline.add_option('--gmetric_options', '-g', action='store', help='Options to pass to gmetric such as -d 180 -c /etc/ganglia/gmond.conf (default). These are passed directly to gmetric',
-                       default='-d 180 -c /etc/ganglia/gmond.conf' )
+    cmdline.add_option('--gmetric_options', '-g', action='store', help='Options to pass to gmetric such as -c /etc/ganglia/gmond.conf (default). These are passed directly to gmetric',
+                       default='-c /etc/ganglia/gmond.conf' )
     cmdline.add_option('--mode', '-m', action='store', type='choice',
                        choices=('daemon', 'cron'), default='cron',
                        help='MODE must be "cron" or "daemon".  Cron mode (default) is designed to be called every X minutes.  Daemon mode is a persistent process.')

src/ganglia_logtailer_helper.py

 """class for ganglia metric objects to be passed around"""
 
 class GangliaMetricObject(object):
-    def __init__(self, name, value, units='', type='float', tmax=60):
+    def __init__(self, name, value, units='', type='float', tmax=60, dmax=0):
         self.name = name
         self.value = value
         self.units = units
         self.type = type
         self.tmax = tmax
+        self.dmax = dmax
 
 class LogtailerParsingException(Exception):
     """Raise this exception if the parse_line function wants to