Skip to content

mpas/infrastructure-and-system-monitoring-using-prometheus

Repository files navigation

General

Prerequisites

Build the required Docker images

  • Execute ./build-docker-images.sh

This will build the following images:

  • Spring Boot Prometheus Demo: Spring Boot app with custom metrics added

Configuration

  • Please add your own Slack API webhook in ./steps/6-alerting/config.yml

Step 1: Running Prometheus native

  • Explain that Prometheus is a Go application which can just be extracted and run
  • Start Prometheus via commandline ./prometheus and show that is running
  • Prometheus
    • Navigate to http://localhost:9090/metrics] > show the metrics that Prometheus itself is generating
    • Navigate to http://localhost:9090 > show prometheus webinterface
    • Show Config file (prometheus.yml) -> show Targets
    • Explain that scraping can be done by various ways (Consul, DNS, or dropping in new config file)

Step 2: Run Prometheus using Docker

  • Start Prometheus using docker-compose > dc up
  • Show docker-compose.yml > including portmapping

Step 3: Add host metrics

  • Start Prometheus using docker-compose > dc up
  • Node exporter
    • Explain Node Exporter
    • Show Node Exporter config inside prometheus.yml > explain scraping
    • Navigate to http://localhost:9100/metrics
    • Explain metrics
  • Prometheus
    • Navigate to http://localhost:9090
    • Show to to query for metrics using the autocomplete
    • Show how to play using the query language (console & graph)
      • node_network_receive_bytes
      • node_network_receive_bytes{device="eth0"}
      • node_network_receive_bytes{device="eth0"}[5m]
      • rate(node_network_receive_bytes{device="eth0"}[5m])

Step 4: Grafana

  • Start Prometheus using docker-compose > dc up
  • Grafana
    • Explain Grafana
    • Navigate to http://localhost:3000
    • Login using > admin/admin
    • Add Datasource
    • Create new Dashboard with widget containing graph from memory
      • node_network_receive_bytes
      • node_network_receive_bytes{device="eth0"}
    • Import dashboard to show the graphs coming from default monitoring of Prometheus
    • Import single server dashboard

Step 5: Monitor Docker Containers

Step 6: Alerting

  • Start Prometheus using docker-compose > dc up
  • Show alert.rules
  • Show alert-manager.yml
  • Alert Manager
  • Prometheus
  • Introduce the Ping container
    • Stop/Start the Ping container -> docker-compose stop ping
  • View the results in:

Step 7: Instrumenting applications

Step 8: Consul demo

  • Start Prometheus using docker-compose > dc up
  • Prometheus
    • Show prometheus.yml > explain consul config
    • Navigate to http://localhost:9090
    • Show targets and see that we are missing the services
  • Consul
    • Navigate to http://localhost:8500
    • Show missing services
    • Register the services using ‘register-services-with-consul.sh`
    • Show the services appearing in Consul
  • Prometheus

Demo Links

References: https://github.com/stefanprodan/dockprom

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published