koder aka kdanilov | cff7b2e | 2015-04-18 20:48:15 +0300 | [diff] [blame^] | 1 | from .api import start_monitoring, Empty |
koder aka kdanilov | e06762a | 2015-03-22 23:32:09 +0200 | [diff] [blame] | 2 | # from influx_exporter import connect, add_data |
koder aka kdanilov | dda86d3 | 2015-03-16 11:20:04 +0200 | [diff] [blame] | 3 | |
| 4 | uri = "udp://192.168.0.104:12001" |
koder aka kdanilov | e06762a | 2015-03-22 23:32:09 +0200 | [diff] [blame] | 5 | # infldb_url = "influxdb://perf:perf@192.168.152.42:8086/perf" |
| 6 | # conn = connect(infldb_url) |
koder aka kdanilov | dda86d3 | 2015-03-16 11:20:04 +0200 | [diff] [blame] | 7 | |
koder aka kdanilov | e06762a | 2015-03-22 23:32:09 +0200 | [diff] [blame] | 8 | monitor_config = {'127.0.0.1': |
| 9 | {"block-io": {'allowed_prefixes': ['sda1', 'rbd1']}, |
| 10 | "net-io": {"allowed_prefixes": ["virbr2"]}}} |
koder aka kdanilov | dda86d3 | 2015-03-16 11:20:04 +0200 | [diff] [blame] | 11 | |
| 12 | with start_monitoring(uri, monitor_config) as queue: |
| 13 | while True: |
| 14 | try: |
| 15 | (ip, port), data = queue.get(True, 1) |
koder aka kdanilov | e06762a | 2015-03-22 23:32:09 +0200 | [diff] [blame] | 16 | print (ip, port), data |
| 17 | # add_data(conn, ip, [data]) |
koder aka kdanilov | dda86d3 | 2015-03-16 11:20:04 +0200 | [diff] [blame] | 18 | except Empty: |
| 19 | pass |