Puede ejecutar comprobaciones remotas como Ping, TCP y HTTP en servidores físicos y recopilar datos personalizados que, posteriormente, se pueden consumir como una métrica.
Procedimiento
- Actualice la configuración de Telegraf en el servidor físico de destino después de ejecutar el script de muestra. Agregue lo siguiente en el archivo http.conf.
- Para comprobación de Ping:
[[inputs.ping]]
## Hosts to send ping packets to.
urls = ["www.vmware.com"]
## Number of ping packets to send per interval. Corresponds to the "-c"
## option of the ping command.
# count = 1
## Time to wait between sending ping packets in seconds. Operates like the
## "-i" option of the ping command.
# ping_interval = 1.0
## If set, the time to wait for a ping response in seconds. Operates like
## the "-W" option of the ping command.
# timeout = 1.0
## If set, the total ping deadline, in seconds. Operates like the -w option
## of the ping command.
# deadline = 10
## Interface or source address to send ping from. Operates like the -I or -S
## option of the ping command.
# interface = ""
- Para la comprobación de TCP:
[[inputs.net_response]]
name_override="netresponse"
## Server address (default localhost)
address = "10.10.10.10:443"
protocol = "tcp"
## Set timeout
# timeout = "1s"
## Set read timeout (only used if expecting a response)
# read_timeout = "1s"
- Para comprobación de HTTP:
# HTTP/HTTPS request given an address a method and a timeout
[[inputs.http_response]]
name_override="httpresponse"
## List of url to query.
address = https://10.10.10.10/suite-api/api/adapters
method = "GET"
## Set http_proxy.
## Telegraf uses the system wide proxy settings if it's is not set.
# http_proxy = http://localhost:8888
## Set response_timeout (default 5 seconds)
# response_timeout = "5s"
## Whether to follow redirects from the server (defaults to false)
# follow_redirects = false
## Optional name of the field that will contain the body of the response.
## By default it is set to an empty String indicating that the body's content won't be added
# response_body_field = ''
## Optional substring or regex match in body of the response (case sensitive)
# response_string_match = "\"service_status\": \"up\""
# response_string_match = "ok"
# response_string_match = "\".*_status\".?:.?\"up\""
## Optional SSL Config
# ssl_ca = "/etc/telegraf/ca.pem"
# ssl_cert = "/etc/telegraf/cert.pem"
# ssl_key = "/etc/telegraf/key.pem"
## Use SSL but skip chain & host verification
insecure_skip_verify = true
## HTTP Request Headers (all values must be strings)
[inputs.http_response.headers]
accept = "application/json" Authorization = "OpsToken a16f7a2b-b033-48bc-9827-2daf8e205537::ec11ee5f-8623-4558-a904-8b4ea3f6f47d"
- Reinicie Telegraf y espere 10 minutos para obtener los datos.
Qué hacer a continuación
Puede ver las métricas seleccionando el objeto relevante en la pestaña
Métricas de la interfaz de usuario de
VMware Aria Operations:
- En el panel de la izquierda, desplácese a .
- Haga clic en el objeto Ámbito del sistema operativo en el panel derecho.
- Desplácese hasta la pestaña Métricas y seleccione el objeto de SO correspondiente.
- En Objeto de SO encontrará los objetos Ping, TCP y HTTP.