Skip to content

Instantly share code, notes, and snippets.

@badcrc
Created June 5, 2013 10:35
Show Gist options
  • Save badcrc/5713022 to your computer and use it in GitHub Desktop.
Save badcrc/5713022 to your computer and use it in GitHub Desktop.

Revisions

  1. badcrc created this gist Jun 5, 2013.
    26 changes: 26 additions & 0 deletions gistfile1.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    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'])