ServiceNow 指标输出数据格式
nowmetric
输出数据格式(序列化器)将 Telegraf 指标以 ServiceNow 操作智能格式输出。
它可以用于使用文件输出插件写入文件,或者在使用启用REST端点的标准telegraf HTTP输出时,将指标发送到MID服务器。如果您正在使用HTTP输出插件,此序列化器知道如何批量处理指标,这样您就不会为每个指标执行一个HTTP POST操作。
一个示例事件看起来像
[{
"metric_type": "Disk C: % Free Space",
"resource": "C:\\",
"node": "lnux100",
"value": 50,
"timestamp": 1473183012000,
"ci2metric_id": {
"node": "lnux100"
},
"source": “Telegraf”
}]
与HTTP输出插件一起使用
要将这些数据发送到已激活Web服务器扩展的ServiceNow MID服务器,您可以使用HTTP输出插件,您需要添加一些自定义标题来管理MID Web服务器授权,以下是一个HTTP输出的示例配置
[[outputs.http]]
## URL is the address to send metrics to
url = "http://<mid server fqdn or ip address>:9082/api/mid/sa/metrics"
## Timeout for HTTP message
# timeout = "5s"
## HTTP method, one of: "POST" or "PUT"
method = "POST"
## HTTP Basic Auth credentials
username = 'evt.integration'
password = 'P@$$w0rd!'
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
## Data format to output.
## Each data format has it's own unique set of configuration options, read
## more about them here:
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_OUTPUT.md
data_format = "nowmetric"
## Additional HTTP headers
[outputs.http.headers]
# # Should be set manually to "application/json" for json data_format
Content-Type = "application/json"
Accept = "application/json"
从伦敦版本开始,您还需要明确创建事件规则以允许将指标事件绑定到主机CI。
https://docs.servicenow.com/bundle/london-it-operations-management/page/product/event-management/task/event-rule-bind-metrics-to-host.html
与文件输出插件一起使用
您可以使用文件输出插件将有效负载输出到文件。在这种情况下,只需将以下部分添加到您的telegraf配置文件中。
[[outputs.file]]
## Files to write to, "stdout" is a specially handled file.
files = ["C:/Telegraf/metrics.out"]
## Data format to output.
## Each data format has its own unique set of configuration options, read
## more about them here:
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_OUTPUT.md
data_format = "nowmetric"
这个页面有帮助吗?
感谢您的反馈!