Agador Service Fetch


In [1]:
import agador, yaml

Load service config into consul KV store


In [2]:
with open("/example/example.yaml") as cfg:
    agador.consul.load_config(yaml.load(cfg))

Get services


In [3]:
influx = agador.consul.service("influxdb")
redis = agador.consul.service("redis")

Create InfluxDB Database


In [4]:
influx.create_database("example")

Write InfluxDB Data


In [5]:
influx.write_points([
    {
        "measurement": "cpu_load_short",
        "tags": {
            "host": "server01",
            "region": "us-west"
        },
        "time": "2009-11-10T23:00:00Z",
        "fields": {
            "value": 0.64
        }
    }
])


Out[5]:
True

Get InfluxDB Data


In [6]:
influx.query('select value from cpu_load_short;')


Out[6]:
ResultSet({'(u'cpu_load_short', None)': [{u'value': 0.64, u'time': u'2009-11-10T23:00:00Z'}]})

Write Redis Key


In [7]:
redis.set("foo", "bar")


Out[7]:
True

Get Redis Key


In [8]:
redis.get("foo")


Out[8]:
'bar'