Skip to content

Instantly share code, notes, and snippets.

@badcrc
Created June 5, 2013 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save badcrc/5713022 to your computer and use it in GitHub Desktop.
Save badcrc/5713022 to your computer and use it in GitHub Desktop.
Send data to ganglia using gmetric.py
import Gmetric
def send_gmetric_data(metric_name,metric_value,metric_group):
parser = optparse.OptionParser()
#gmond configuration
options = {}
options['host'] = "your_server"
options['protocol'] = "udp"
options['port'] = 8649
options['name'] = metric_name
options['value'] = metric_value
options['units'] = ""
options['slope'] = "both"
options['type'] = "int16"
options['tmax'] = "60"
options['dmax'] = "0"
options['group'] = metric_group
options['spoof'] = metric_group
#mandamos los datos
g = Gmetric(options['host'], options['port'], options['protocol'])
g.send(options['name'], options['value'], options['type'], options['units'],
options['slope'], options['tmax'], options['dmax'], options['group'], options['spoof'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment