Application to monitor servers using Prometheus and Grafana
Clone the repository and start the application using docker compose
git clone https://github.com/redpencilio/app-server-monitor.git
docker compose up -d
The Grafana dashboard can be accessed by setting up an SSH tunnel to port 3000
ssh my-server -L 3000:127.0.0.1:3000
Setup a metrics stack with a node-exporter service on the server you want to be monitored. Make the service integrate with Letsencrypt such that it's accessible by a DNS name.
services:
exporter:
image: quay.io/prometheus/node-exporter
pid: "host"
volumes:
- /sys:/sys:ro
restart: always
environment:
VIRTUAL_HOST: "my-domain.redpencil.io"
LETSENCRYPT_HOST: "my-domain.redpencil.io"
LETSENCRYPT_EMAIL: "[email protected]"
expose:
- 9100
networks:
- proxy
- default
networks:
proxy:
external:
name: letsencrypt_default
Next, add the DNS name to the Prometheus configuration in ./config/prometheus.yml
on your monitor server. Restart the server
service:
docker compose restart server
The password for the Grafana admin user can be configured by setting the GF_SECURITY_ADMIN_PASSWORD
environment variable on the grafana
service.
E.g.
version: "3"
services:
grafana:
environment:
GF_SECURITY_ADMIN_PASSWORD: my-secret-password
Prometheus can be configured in ./config/prometheus.yml
and ./config/alertmanager.yml
. Since these files are environment specific, the config folder is listed in .gitignore
.