Permalink
Browse files

Merge branch 'chore/config_api'

  • Loading branch information...
2 parents 5439589 + 43021e3 commit 52c4bcc02148c166f3a6b77c2f09965c4fc7da57 @mheffner mheffner committed Jul 3, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/collectd-librato.py
@@ -30,7 +30,8 @@
# format of this line.
version = "0.0.7"
-config = { 'url' : 'https://metrics-api.librato.com/v1/metrics',
+config = { 'api_path' : '/v1/metrics',
+ 'api' : 'https://metrics-api.librato.com'
'types_db' : '/usr/share/collectd/types.db',
'metric_prefix' : 'collectd',
'metric_separator' : '.',
@@ -138,6 +139,8 @@ def librato_config(c):
config['email'] = val
elif child.key == 'MetricPrefix':
config['metric_prefix'] = val
+ elif child.key == 'Api':
+ config['api'] = val
elif child.key == 'TypesDB':
config['types_db'] = val
elif child.key == 'MetricPrefix':
@@ -182,7 +185,8 @@ def librato_flush_metrics(gauges, counters, data):
body = json.dumps({ 'gauges' : gauges, 'counters' : counters })
- req = urllib2.Request(config['url'], body, headers)
+ url = "%s%s" % (config['api'], config['api_path'])
+ req = urllib2.Request(url, body, headers)
try:
f = urllib2.urlopen(req, timeout = config['flush_timeout_secs'])
response = f.read()

0 comments on commit 52c4bcc

Please sign in to comment.