You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 26, 2022. It is now read-only.
chrisbolt edited this page Feb 24, 2013
·
3 revisions
Customizing a collector
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.