fixes for agent

This commit is contained in:
Alexey Lavrenuke 2016-04-05 18:40:21 +03:00
parent f9b347777e
commit 50d8289646
3 changed files with 7 additions and 22 deletions

View File

@ -631,6 +631,8 @@ class AgentWorker(Thread):
# known metrics
for metric_name in self.metrics_collected:
if not metric_name:
continue
try:
data = self.known_metrics[metric_name].check()
if len(data) != len(self.known_metrics[
@ -638,8 +640,8 @@ class AgentWorker(Thread):
raise RuntimeError(
"Data len not matched columns count: %s" % data)
except Exception, e:
logger.error('Can\'t fetch %s: %s', metric_name, e)
data = [''
logger.exception('Can\'t fetch %s', metric_name)
data = ['0'
] * len(self.known_metrics[metric_name].columns())
line.extend(data)

View File

@ -467,9 +467,11 @@ class MonitoringCollector(object):
names[agent_name] = 1
metric = ','.join(names.keys())
if not metric and not custom:
metric = "cpu-stat"
return {
'metric': metric or 'cpu-stat',
'metric': metric,
'interval': host.get('interval', 1),
'priority': host.get('priority', 0),
'port': int(host.get('port', 22)),

View File

@ -1,19 +0,0 @@
[main]
interval=1
host=localhost
[metric]
#names=mem,cpu-stat
#names=cpu-la
names=cpu-stat
[custom]
#tail=aWQz:L3Zhci90bXAvdG1wLmxvZw==
#call=aWQx:cHMgYXV4IHwgd2MgLWw=,aWQy:cHMgYXV4ZmYgfCB3YyAtbA==
[startup]
cmd1=cat /dev/urandom | awk 'BEGIN {RS="ya"} {print length($0)}' > /tmp/urandom.txt
cmd2=ps auxff > /tmp/ps.txt
[shutdown]
cmd2=uptime > /tmp/uptime.txt