在bosun中定义新的外部收集器的过程是什么?
我们可以编写python或shell脚本来收集数据吗?
发布于 2015-08-05 22:27:24
关于这一点的文档并不是很新。您可以按照http://godoc.org/bosun.org/cmd/scollector#hdr-External_Collectors中的描述进行操作,但我们也支持更好的JSON输出。
无论采用哪种方法,您都可以编写一些内容并将其放入外部收集器目录中,然后是频率目录,然后是可执行脚本或二进制文件。类似于:
<external_collectors_dir>/<freq_sec>/foo.sh。
如果目录频率为零0,那么预计脚本将持续运行,并且您将在代码中设置睡眠(这是我对外部收集器的首选方法)。脚本将telnet格式或未记录的JSON格式输出到stdout。收集器拾取它,并将该信息排入队列以便发送。
不久前,我创建了一个问题来记录这个问题,https://github.com/bosun-monitor/bosun/issues/1225。在我们中的一个人开始之前,这里是添加了JSON https://github.com/bosun-monitor/bosun/commit/fced1642fd260bf6afa8cba169d84c60f2e23e92的PR
发布于 2015-08-05 23:43:21
除了Kyle所说的,您还可以查看一些现有的外部收集器,看看它们输出了什么。here是我们的一个同事用java编写的,用来监控jvm的东西。它使用文本格式,简单地说就是:
metricname timestamp value tag1=foo tag2=bar如果你想使用JSON格式,这里有一个来自我们的收集器的例子:
{"metric":"exceptional.exceptions.count","timestamp":1438788720,"value":0,"tags":{"application":"AdServer","machine":"ny-web03","source":"NY_Status"}}
您还可以发送元数据:
{"Metric":"exceptional.exceptions.count","Name":"rate","Value":"counter"}
{"Metric":"exceptional.exceptions.count","Name":"unit","Value":"errors"}
{"Metric":"exceptional.exceptions.count","Name":"desc","Value":"The number of exceptions thrown per second by applications and machines. Data is queried from multiple sources. See status instances for details on exceptions."}`或者向stderror发送错误消息:
2015/08/05 15:32:00 lookup OR-SQL03: no such hosthttps://stackoverflow.com/questions/31834586
复制相似问题