Simple setup to monitor my machine using
node_exporter: Exposes my machine metrics at http://localhost:9100/metrics
prometheus: A storage for metrics.
It scrapes the metrics from endpoint /metrics at defined interval to get the current state of the metrics and
stores values in prometheus tsdb
grafana: Visual representation of metrics used for analysing and alerting. It is queried using PromQl.
Install required binaries from here: https://prometheus.io/download/
- start: ./node_exporter
- verify: curl http://localhost:9100/metrics
- Create a prometheus.yml to define where to scrape from and at what interval
#The job name is added as a label `job=<job_name>` to any timeseries scraped from this config. - job_name: 'local_prometheus' #Override the global default and scrape targets from this job every 5 seconds. scrape_interval: 5s static_configs: - targets: ['127.0.0.1:9100']
docker run -p 9090:9090 --net=host -d -v ~/k8s_terraform/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
- Verify on browser http://localhost:9090
Click on status -> targets and verify container connections and is up.
Here is how you can monitor by exploring your system metrics.
docker run -d -p 3000:3000 grafana/grafana-oss:latest
- Login to dashboard at http://localhost:3000.
Add endpooint in data source i.e http://localhost:9090, because Prometheus and Grafana are running on the same server.