您可以在物理服务器中运行 Ping、TCP 和 HTTP 等远程检查,并收集自定义数据,然后将这些数据用作衡量指标。

过程

  1. 运行示例脚本后,更新目标物理服务器中的 Telegraf 配置。在 http.conf 文件中添加以下内容。
    • 对于 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 = ""
    • 对于 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"
      
    • 对于 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"
  2. 重新启动 Telegraf 并等待 10 分钟以获取数据。

下一步做什么

您可以通过从 VMware Aria Operations 用户界面的 衡量指标选项卡选择相关对象来查看衡量指标:
  1. 从左侧菜单中,导航到环境 > 自定义组
  2. 单击右侧窗格中的操作系统环境对象。
  3. 导航到衡量指标选项卡,然后选择相应的操作系统对象。
  4. 操作系统对象下,将显示 PingTCPHTTP 对象。