Prometheus and Grafana

https://prometheus.io/download/
https://grafana.com/grafana/download?platform=arm

Prometheus
==========
SERVER:
apt-get -y install prometheus prometheus-node-exporter prometheus-alertmanager prometheus-process-exporter

systemctl enable prometheus
systemctl start prometheus
http://<IPADDRESS>:9090


AGENTS:
apt-get -y install prometheus-node-exporter

CentOS: tar xvzf node_exporter-1.3.1.linux-armv7.tar.gz ; mv node_exporter-1.3.1.linux-armv7/node_exporter /usr/local/bin/ ; Define service to start via copy of prometheus-node-exporter.service
vi /lib/systemd/system/prometheus-node-exporter.service
chown root:root /usr/local/bin/node_exporter ; systemctl daemon-reload; systemctl enable prometheus-node-exporter ; systemctl start prometheus-node-exporter
iptables -I IN_public_allow -p tcp -m tcp --destination-port 9100 -j ACCEPT
firewall-cmd --zone=public --add-port=9100/tcp
firewall-cmd --zone=public --add-port=9100/tcp --permanent

 

Edit server config prometheus.yml AND do a kill -HUP <serverproc>
vi /etc/prometheus/prometheus.yml

unix4life: apt-get install prometheus-node-exporter prometheus-apache-exporter prometheus-mysqld-exporter prometheus-process-exporter

prometheus-alertmanager - handle and deliver alerts created by Prometheus
prometheus-apache-exporter - Prometheus exporter for Apache server metrics
prometheus-elasticsearch-exporter - Prometheus exporter for various metrics about Elasticsearch
prometheus-mysqld-exporter - Prometheus exporter for MySQL server.
prometheus-node-exporter - Prometheus exporter for machine metrics
prometheus-process-exporter - Prometheus exporter that exposes process metrics from procfs
prometheus-pushgateway - Prometheus exporter for ephemereal jobs


MySQL/MariaDB
vi /etc/default/prometheus-mysqld-exporter
DATA_SOURCE_NAME="prometheus:<Username>@(localhost:3306)/<DatabaseName>"

MariaDB [(none)]> CREATE USER IF NOT EXISTS '<Username>'@'localhost' IDENTIFIED BY '<Password>';
MariaDB [(none)]> GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO '<Username>'@'localhost';


Grafana
=======
Update/Upgrade
wget https://dl.grafana.com/enterprise/release/grafana-enterprise-9.1.5.linux-armv6.tar.gz

systemctl stop grafana

cp -p data/grafana.db data/grafana.db_BACKUP
cp -p conf/defaults.ini conf/defaults.ini_backup
cd /usr/local
mv grafana grafana-9.1.5
tar xvzf grafana-enterprise-9.1.5.linux-armv6.tar.gz
mv grafana-9.1.5 grafana

systemctl start grafana

-----------------------------------------------------
Installation:

 

tar xvzf grafana-enterprise-8.5.2.linux-armv6.tar.gz

mv grafana-8.5.2 /usr/local/grafana

./bin/grafana-server web

http://<IPADDRESS>:3000
    username: admin
    password: <password>

Add first datasource: Prometheus, http://<IPADDRESS>:9090

Dashboards Numbers via => Create => Import : 
- Node: 1860
- Apache: 3894
- Process: ?
- Mysql: 7362
- ELasticsearch: 266
- RabbitMQ (rabbitmq-plugins enable rabbitmq_prometheus): 10991
Apache
ElasticSearch
ElasticSearch Example
Galera/MariaDB - Overview
Mysql - Prometheus
MySQL Overview
MySQL/MariaDB Workload
Named processes
Node Exporter Full
Prometheus system
RabbitMQ-Overview
System Processes Metrics


vi grafana.service
[Unit]
Description=Grafana
After=var-run.mount nss-lookup.target network.target local-fs.target time-sync.target network-online.target
[Install]
WantedBy=multi-user.target
[Service]
Type=simple
ExecStart=/usr/local/grafana/bin/grafana-server -homepath /usr/local/grafana
Restart=always
RestartSec=120


cp -p grafana.service /lib/systemd/system/grafana.service
systemctl daemon-reload
systemctl enable grafana.service
systemctl start grafana.service

CentOS:
https://github.com/prometheus-community/elasticsearch_exporter/releases
CentOS: tar xvzf node_exporter-1.3.1.linux-armv7.tar.gz ; mv elasticsearch_exporter-1.3.0.linux-armv7/elasticsearch_exporter /usr/local/bin/ ; Define service to start via copy of prometheus-node-exporter.service
./elasticsearch_exporter --es.uri=http://<elastic_username>:<Password>@localhost:9200
vi /lib/systemd/system/prometheus-elasticsearch-exporter.service
chown root:root /usr/local/bin/elasticsearch_exporter
systemctl daemon-reload; systemctl enable prometheus-elasticsearch-exporter ; systemctl start prometheus-elasticsearch-exporter
iptables -I IN_public_allow -p tcp -m tcp --destination-port 9114 -j ACCEPT
firewall-cmd --zone=public --add-port=9114/tcp
firewall-cmd --zone=public --add-port=9114/tcp --permanent

 

  Donate now via the Paypal button on the top in US Dollar and on the bottom in Euro