2 回答

TA貢獻1818條經(jīng)驗 獲得超3個贊
除了 Kyle 所說的之外,您還可以查看一些現(xiàn)有的外部收集器以了解它們的輸出。這是我們的一位同事編寫的用于監(jiān)控 jvm 內(nèi)容的 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"}}
您還可以發(fā)送元數(shù)據(jù):
{"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 發(fā)送錯誤信息:
2015/08/05 15:32:00 lookup OR-SQL03: no such host
- 2 回答
- 0 關(guān)注
- 215 瀏覽
添加回答
舉報