您可以在實體伺服器中執行 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 物件。