====== Сервис Grafana ======
* [[https://geekflare.com/prometheus-grafana-setup-for-linux/|A Guide to Monitor Linux Server using Prometheus and Grafana]]
* [[https://techexpert.tips/ru/grafana-ru/%D0%BD%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0-%D1%83%D0%B2%D0%B5%D0%B4%D0%BE%D0%BC%D0%BB%D0%B5%D0%BD%D0%B8%D0%B9-%D0%BF%D0%BE-%D1%8D%D0%BB%D0%B5%D0%BA%D1%82%D1%80%D0%BE%D0%BD%D0%BD%D0%BE-2/|Настройка уведомлений по электронной почте Grafana]]
* [[https://grafana.com/docs/grafana/next/administration/organization-preferences/?cta=...#change-grafana-ui-theme|Смена "темы"]]
===== Установка =====
* [[https://grafana.com/docs/grafana/latest/installation/debian/|Install on Debian or Ubuntu]]
==== Docker ====
* [[Технология Docker]]
# id=$(docker create grafana/grafana-oss)
# docker cp $id:/etc/grafana/ - > etc_grafana.tar
# tar -xvf etc_grafana.tar -C /etc
или
# docker cp $id:/etc/grafana/ /etc/grafana/
# docker rm -v $id
# docker run -d -p 3000:3000 -v /etc/grafana:/etc/grafana --name grafana grafana/grafana-oss:7.5.4-ubuntu
или
# docker run -d -p 3000:3000 -v /etc/grafana:/etc/grafana --name grafana grafana/grafana-oss
# docker update --restart=always grafana
* l:admin p:admin
* [[http://server.corpX.un:3000]]
* [[http://192.168.X.10:3000]]
* [[http://10.5.N.100+X:3000]]
===== Интеграция с Prometheus =====
Configuratin/Connections->Data Source->Prometheus
URL: http://localhost:9090
http://192.168.X.10:9090 Если grafana в docker
===== Grafana dashboard =====
* [[https://grafana.com/grafana/dashboards|Official & community built dashboards]]
==== Import dashboard ====
+ Import->Import via grafana.com
prometheus-node-exporter: 1860
prometheus-blackbox-exporter: 7587
Data Source: Prometheus
==== Create dashboard ====
* !!! Не забыть сохранить !!!
* Лучше в folder1 (понадобится для alert)
+ Create
Name: router
Add New Panel
Panel Title: FastEthernet0/0 connection to WAN
или
Panel Title: Port-channel1 connection to LAN
Query: A
Metrics: 8*rate(ifInOctets{ifDescr="FastEthernet0/0",instance="router"}[1m])/1000000
или
Metrics: rate(ifOutOctets{ifDescr="Port-channel1",instance="router"}[1m])/125000
Legend: in Mbps
Query: B
Metrics: 8*irate(ifOutOctets{ifDescr="FastEthernet0/0",instance="router"}[1m])/1000000
или
Metrics: irate(ifInOctets{ifDescr="Port-channel1",instance="router"}[1m])/125000
Legend: out Mbps
===== Настройка уведомлений =====
==== Настройка модуля smtp ====
# cat /etc/grafana/grafana.ini
...
[smtp]
enabled = true
host = server.corpX.un:25 #if docker, and may be, better use ip
from_address = grafana@corpX.un
ehlo_identity = server.corpX.un
startTLS_policy = NoStartTLS
...
# service grafana-server restart
или
# docker restart grafana
==== Настройка получателей ====
Alerting->Notification Channels/Contact points ...
userX/Email/userX@isp.un
student/Email/student@corpX.un
==== Настройка уведомлений ====
=== Версия 11 ===
* Можно заменить B на Last Count
=== Версия 7 ===
Dashboard->Panel (name)->Edit->Alert->...->
Evaluate every: 15s For 1m
WHEN avg() OF query(B,1m,now) IS ABOVE 8
Send To: userX/student
Apply->Save Dashboard!!!!