#NicAlarming A monitoring solution for NicLabs projets with Prometheus, Grafana, cAdvisor, NodeExporter, PostgresExporter, NginxExporter, Blackbox and alerting with AlertManager, Bot Telegram.
Cloning repositories:
-
Create a folder "Prometheus"
-
Prometheus
$ cd Prometheus $ git clone https://github.com/prometheus/prometheus
-
AlertManager
$ cd Prometheus $ git clone https://github.com/prometheus/alertmanager
-
Prometheus bot
$ cd Prometheus $ git clone https://github.com/inCaller/prometheus_bot
-
Grafana
# Download and unpack Grafana from binary tar (adjust version as appropriate). $ cd Prometheus $ curl -L -O https://grafanarel.s3.amazonaws.com/builds/grafana-2.5.0.linux-x64.tar.gz $ tar zxf grafana-2.5.0.linux-x64.tar.gz
-
NicAlarming
$ git clone https://github.com/cdotte/NicAlarming.git
-
Copy all files of NicAlarming folder and paste into Prometheus (Yes to replace all files that already exists)
-
You have to install with
sudo go get $dependencies
where $dependencies:github.com/gin-gonic/gin github.com/gin-gonic/gin/binding github.com/go-telegram-bot-api/telegram-bot-api gopkg.in/yaml.v2
-
Edit
run.sh
, in the file:Edit variable "GO" with yout GO path directory
Edit variable PostgresURL: edit the database name, the user, the password, hostname and the port with our values. For more info you can visit the link above (PostgresExporter).
Edit NginxURI with your Nginx status page here more information
-
To configure bot to alert with telegram:
Edit
prometheus_bot/config.yaml
with the token of your telegram bot.Edit
alertmanager/config.yaml
chatID with the ChatID of your group in telegram.Add grafana dashboards link to your telegram group to quickly visit if something goes wrong.
-
Edit
prometheus/prometheus.yml
scrape_configs with your ip adresses (I recommend check out the ip adress of the containers usingdocker inspect --format '{{ .NetworkSettings.IPAddress }}' container_name_or_id
and local ip adress) or edit run.sh to link your containers. -
Edit
blackbox_exporter/blackbox.yml
with your end-points to monitoring and edit prometheus config file. here more information -
Start the monitoring solution with
$ sudo ./run.sh start
Bash script to start, restart, remove, upgrade and stop the application. The usage is:
# To start, restart, stop, delete, upgrade
$ ./run.sh start | restart | stop | delete | upgrade
You have to import in grafana all dashboards available in a folder "dashboards". Below there is more information.
Thanks to dackprom for the darshboards to Grafana's imports.
-
If you want to create others rules for alarming. You have to visit this
-
If you want to change existing rules for alarming. You have to change the next files
prometheus/host.rules
,prometheus/targets.rules
,prometheus/postgres.rules
,prometheus/containers.rules
,prometheus/host.rules
. -
If you want to see Dashboards (Grafana) in a specific range of time. You have to visit this