Skip to content

Instantly share code, notes, and snippets.

@arthurzenika
Created January 5, 2016 10:59
Show Gist options
  • Save arthurzenika/5a93d6fab53f936689b1 to your computer and use it in GitHub Desktop.
Save arthurzenika/5a93d6fab53f936689b1 to your computer and use it in GitHub Desktop.
def event_return(events):
'''
Return event data to remote carbon server
Provide a list of events to be stored in carbon
'''
opts = _get_options({}) # Pass in empty ret, since this is a list of events
opts['skip'] = True
for event in events:
log.trace('Carbon returner received event: {0}'.format(event))
metric_base = event['tag']
# TODO move whitelisted functions that should be send to graphite in salt master configuration
if 'ret' in event['tag'].split('/') and event['data'].get('fun') in ('apache.server_status', 'munin.run'):
returner(event['data'])
else:
saltdata = event['data'].get('data')
_send(saltdata, metric_base, opts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment