https://github.com/petergrace/anchorage
Light wrapper to enable nimble checks to be input to bosun without needing scollector
https://github.com/petergrace/anchorage
Last synced: about 1 year ago
JSON representation
Light wrapper to enable nimble checks to be input to bosun without needing scollector
- Host: GitHub
- URL: https://github.com/petergrace/anchorage
- Owner: PeterGrace
- Created: 2017-03-09T18:03:40.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-21T14:49:21.000Z (about 8 years ago)
- Last Synced: 2025-02-15T02:44:36.553Z (over 1 year ago)
- Language: Python
- Size: 5.86 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
anchorage
===============
Anchorage is a small python framework for emitting metadata-defined metrics into Bosun.
- Create a new python file with the below contents.
- Define your metrics in check_hash
- write your actual check logic in the func defined in check_hash, in the below example testcheck()
- your check function must return a hash with value defined by 'value' key, and a sub-hash of tags in key 'tags'.
Example instantiation: `anchorage --debug --test --token `
- --test does not send data to the server.
- --debug enables debug logging inside of anchorage
To execute the example, use `anchorage --debug --test examples/example http://invalidurl`
Example module from examples directory:
```
from anchorage.check import Check
def testcheck():
return {
'value': '0',
'tags':
{'host': 'host'}
}
check_hash = {
'pete.widgets': {
'rate': 'gauge',
'unit': 'Widgets per Fortnight',
'desc': 'the number of widgets created per fortnight of production',
'func': testcheck
}
}
c = Check(check_hash)
def initialize(url, token):
c.set_url(url, token)
def execute():
return c.run_checks()
def run_tests():
return c.run_tests()
```