Skip to content

Instantly share code, notes, and snippets.

@martinrusev
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save martinrusev/9580025 to your computer and use it in GitHub Desktop.

Select an option

Save martinrusev/9580025 to your computer and use it in GitHub Desktop.
Custom Amon Plugin
from amonagent.plugin import AmonPlugin
class MyCustomPlugin(AmonPlugin):
def collect(self):
"""
The agent collects and sends all the metrics defined in this function
"""
# All values defined in the JSON configuration file can be retrieved with self.config.get()
host = self.config.get('host')
# Defines a gauge metric, which is represented as a chart in Amon
self.gauge(metric, value)
# Defines a counter metric, which is represented as a number in Amon
self.counter(metric, value)
# To Log messages from your plugin
self.log.error('error message')
self.log.info('info message')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment