forked from sebest/collectd-mongodb
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcollectd.py
More file actions
44 lines (33 loc) · 975 Bytes
/
collectd.py
File metadata and controls
44 lines (33 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import time
class ConfigNode:
def __init__(self, key, values):
self.key = key
self.values = values
class Config:
def __init__(self):
self.children = []
def add(self, key, value):
self.children.append(ConfigNode(key,[value]))
class Values():
def __init__(self):
self.plugin = None
self.plugin_instance = None
self.type = None
self.type_instance = None
self.values = []
def dispatch(self):
plugin = "{}".format(self.plugin)
if self.plugin_instance:
plugin = "{}-{}".format(self.plugin, self.plugin_instance)
for v in self.values:
print "...{}.{}-{} {}".format(plugin, self.type, self.type_instance, v)
def warning(message):
print "{}".format(message)
def register_read(plugin_query_func):
plugin_query_func()
print "..."
def register_config(plugin_config):
test_config = Config()
test_config.add('Host', '192.168.99.100')
test_config.add('Port', '37268')
plugin_config(test_config)