Jeff Moe
c87cc5ff22
|
6 years ago | |
---|---|---|
.. | ||
README.md | 6 years ago |
README.md
##############################################################################
Prometheus Server
To Install Server
Stretch:
apt install -t stretch-backports prometheus
Buster:
apt install prometheus
On main prom1 server, running buster:
apt install prometheus-alertmanager prometheus prometheus-node-exporter
Open up ports on firewall:
Prometheus
-A INPUT -p tcp --dport 9090 -j ACCEPT -A INPUT -p tcp --dport 9093 -j ACCEPT -A INPUT -p tcp --dport 9094 -j ACCEPT -A INPUT -p tcp --dport 9100 -j ACCEPT
##############################################################################
Prometheus Clients
Install exporter on all nodes
Stretch:
apt install -t stretch-backports prometheus-node-exporter
Buster:
apt install prometheus-node-exporter
To enable various collectors on a node, edit:
#vim /etc/default/prometheus-node-exporter
Ones of note:
#-collector.netstat.fields=(.) --collector.vmstat.fields=(.) --collector.interrupts
Add to all: XXX not done
################ --collector.netstat.fields="^(.(InErrors|InErrs)|Ip_Forwarding|Ip(6|Ext)(InOctets|OutOctets)|Icmp6?(InMsgs|OutMsgs)|TcpExt(Listen.|Syncookies.*)|Tcp_(ActiveOpens|PassiveOpens|RetransSegs|CurrEstab)|Udp6?_(InDatagrams|OutDatagrams|NoPorts))$" --collector.vmstat.fields="^(oom_kill|pgpg|pswp|pg.fault)." --collector.interrupts --collector.ntp --collector.systemd ################
Just copy over an existing one:
XXX not really.
#scp -p testo4:/etc/default/prometheus-node-exporter /etc/default/prometheus-node-exporter
Start on boot:
systemctl enable prometheus-node-exporter
Firewall open port for prometheus-node-exporter
-A INPUT -p tcp --dport 9100 -j ACCEPT
##############################################################################
For MySQL servers, on all servers:
apt install prometheus-mysqld-exporter
On sql1, log into database:
CREATE USER 'prometheus-mysqld-exporter'@'10.42.1.0/255.255.255.0' IDENTIFIED BY 'password' WITH MAX_USER_CONNECTIONS 3; GRANT PROCESS, REPLICATION CLIENT, SELECT ON . TO 'prometheus-mysqld-exporter'@'10.42.1.0/255.255.255.0'; FLUSH PRIVILEGES;
On sql1 sql2 sql3 sql4 servers:
Edit
vim /etc/default/prometheus-mysqld-exporter
Set this line (setting correct local IP):
export DATA_SOURCE_NAME="prometheus-mysqld-exporter:password@(10.42.1.171:3306)/"
on prom1 /etc/prometheus/prometheus.yml
- job_name: 'mysql-monitor'# Job name
static_configs:
- targets: ['10.42.1.171:9104'] labels: alias: db1# alias name given to this instance
Add firewall rule to sql1 sql2 sql3 sql4
#-A INPUT