Closed1

Prometheus Grafana Related

otokunaga2otokunaga2

趣旨

担当しているシステムの監視の仕組みをいれておきたく、調査したついでにメモしてます。
基本的な設定は以下のサイトを参考にメモさせて頂いております。

Node.js Application Monitoring with Prometheus and Grafana

なお、ソースコード一式も上記ブログ上で紹介されているソースコードで動作確認しました。

nodejs-application-monitoring-with-prometheus-and-grafana

scrapeする際に、どこからデータを取得するのか設定ファイルで記述する必要があります。

How to scrape from Prometheus

global:
  scrape_interval: 5s
scrape_configs:
  - job_name: "example-nodejs-app"
    static_configs:
      - targets: ["localhost:8080"]

設定ファイル補足

  • 上記はscrape_intervalで5秒毎にデータを収集する設定になっています。
  • job_nameで対象のデータがどのようなタイトルか設定しています。
  • static_configsの中に設定しているtargetsで取得するサーバのエンドポイントを指定してあげる必要があります。

参考情報

Node.js Application Monitoring with Prometheus and Grafana

このスクラップは2021/03/06にクローズされました