Last active
August 29, 2015 13:57
-
-
Save martinrusev/9580025 to your computer and use it in GitHub Desktop.
Custom Amon Plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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