2 回答
TA贡献1818条经验 获得超3个赞
除了 Kyle 所说的之外,您还可以查看一些现有的外部收集器以了解它们的输出。这是我们的一位同事编写的用于监控 jvm 内容的 Java 代码。它使用文本格式,它很简单:
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 host
- 2 回答
- 0 关注
- 190 浏览
添加回答
举报