简体   繁体   中英

Monitoring using telegraf and prometheus

How can I monitor another server from my pc using prometheus and telegraf? Do I need to install telegraf on both of them?

Your question would benefit from more precision including a description of what you've tried (even hypotheses). For this reason, it may get flagged.

Until then...

It appears that Telegraf supports Prometheus as an output plugin ( link ).

So you should be able to:

  1. Run Telegraf configured with Prometheus as an output plugin (see above)
  2. Run Prometheus configured to scrape the metrics exposed by #1

Assuming you use a Telegraf config of the form:

[[outputs.prometheus_client]]
  ## Address to listen on.
  listen = ":9273"

You should be able to browse|curl http://localhost:9273/metrics from the host on which Telegraf's running to see the metrics it exposes.

NOTE If not localhost ( 127.0.0.1 ) then replace localhost with the host's name|address.

Then you will want to configure a Prometheus scrape target to scrape the Telegraf metrics:

scrape_configs:
  # Telegraf
  - job_name: "telegraf-agent"
    static_configs:
      - targets:
          - "localhost:9273"
  # Self
  - job_name: "prometheus-server"
    static_configs:
      - targets:
          - "localhost:9090"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM