The IUDX Monitoring stack uses Prometheus, Grafana, Micrometer, Node Exporter, Docker Daemon to capture API, System metrics. It integrates with telegram to publish alerts from Grafana based on predefined rules.
- Make a copy of sample secrets directory.
cp -r example-secrets/secrets .
- Generate required secrets using following script:
./create-secrets.sh
- Make sure
/tmp/metrics-targets
directory is created on the node where Prometheus is being deployed. It needs to be recreated with every node restart as it is a temporary directory.
mkdir /tmp/metrics-targets
- Config Telegrambot for grafana's alerts is detailed here. Then appropiately define the environment file secrets/grafana-env-secret. The template is defined as follow:
Please do not include comments and substitute appropiate correct values in the placeholders
<placholder>
.
GF_SERVER_ROOT_URL=https://<grafana-domain-name>/
GF_SERVER_DOMAIN=<grafana-domain-name>
TELEGRAM_CHAT_ID=<telegram-chat-id>
TELEGRAM_BOT_TOKEN=<telegram-chat-token>
- Configure servers to be monitored for certificate expiry, server up status, as targets in blackbox-targets.yml. See below for an example.
- targets:
- https://rs.io.test/apis
- https://catalogue.io.test/
- secrets directory after generation of secrets
secrets/
├── configs
│ └── blackbox-targets.yaml
├── .grafana.env
└── passwords
├── grafana-super-admin-passwd
└── grafana-super-admin-username
docker node update --label-add monitoring_node=true <hostname/ID>
Define Appropriate values of resources -
- CPU
- RAM
- PID limit
in
mon-stack.resources.yaml
for grafana, prometheus, loki, promtail, blackbox as shown in sample resource-values file for here
Deploy monitoring stack:
./install.sh
- Installs Vertx_sd, Prometheus, Loki, Grafana, blackbox swarm services with replicas as one at node with "node.labels.monitoring_node==true" .
- Promtail service installed in global mode i.e. all nodes have one promtail task running.
- Grafana creates super admin when it is run for the first time, and the password is saved to db (i.e. grafana-volume). Subsequent running/restarting the docker with new admin credentials doesn't overwrite the password stored in Grafana db.
- Pipeline stages might be different for each application , this can be done using match stage
- mon-stack.yaml contains additional service vertx_sd, which discover vertx instances from zookeeper for prometheus.
- The grafana is now secured through centralised nginx.
- If you need to expose/access grafana HTTP port or have custom stack configuration( see here for example configuration of 'mon-stack.custom.yaml' file). You can bring up as follows.
docker stack deploy -c mon-stack.yaml -c mon-stack.resources.yaml -c mon-stack.custom.yaml mon-stack
This is generally useful in local,dev/test environment.