Created
June 5, 2013 10:35
-
-
Save badcrc/5713022 to your computer and use it in GitHub Desktop.
Send data to ganglia using gmetric.py
This file contains 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
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