-
Notifications
You must be signed in to change notification settings - Fork 384
CustomCollectors
chrisbolt edited this page Feb 24, 2013
·
7 revisions
Diamond collectors run within the diamond process and collect metrics that can be published to a graphite server.
Collectors are subclasses of diamond.collector.Collector. In their simplest form, they need to implement a single method called "collect".
import diamond.collector
class ExampleCollector(diamond.collector.Collector):
def collect(self):
# Set Metric Name
metric_name = "my.example.metric"
# Set Metric Value
metric_value = 42
# Publish Metric
self.publish(metric_name, metric_value)
To run this collector in test mode you can invoke the diamond server with the -r option and specify the collector path.
diamond -f -r path/to/ExampleCollector.py -c conf/diamond.conf.example
For detailed description and example please take a look at the example collector in the Collectors Directory.