系统监控prometheus使用简洁汇总

系统监控prometheus使用简洁汇总

作者:蓝眼泪

1.修改centos7.9电脑名称

sudo hostnamectl set-hostname master-server
echo "192.168.1.103 master
192.168.1.100 node1">>/etc/hosts

2.关闭防火墙

systemctl stop firewalld 
systemctl disable firewalld 
 iptables -F

3.启动prometheus

/usr/local/prometheus/prometheus --config.file="/usr/local/prometheus/prometheus.yml" &
/usr/local/Prometheus/prometheus --config.file="/usr/local/Prometheus/prometheus.yml" &
pkill prometheus
ss -antlp |grep 9090 3000
ps -ef |grep 9090 3000

4.启动mysql监控

/usr/local/mysqld_exporter-0.11.0.linux-amd64/mysqld_exporter --config.my-cnf="/usr/local/mysqld_exporter-0.11.0.linux-amd64/.my.cnf" &
systemctl start mysqld.service
systemctl enable mysqld.service
systemctl stop mysqld.service
systemctl disable mysqld.service
 create user 'root'@'localhost' identified by '123456';
 GRANT REPLICATION CLIENT, PROCESS ON *.* TO 'root'@'localhost';
 GRANT SELECT ON performance_schema.* TO 'root'@'localhost';
 ALTER USER root@localhost IDENTIFIED WITH mysql_native_password BY '123456';
 flush privileges;

5.启动node-exporter centos7.9系统

/usr/local/node_exporter-0.17.0.linux-amd64/node_exporter &

6.启动redis_exporter

./redis_exporter redis//192.168.60.124:6379 & -web.listenaddress 192.168.60.124:9121

7.编辑yml配置文件

vim /usr/local/Prometheus/prometheus.yml

参考如下:

  - job_name: 'Prometheus'
    static_configs:
    - targets: ['192.168.0.102:9100']
      labels:
        instance: Prometheus

8.重启grafana服务

service grafana restart

猜你喜欢

转载自blog.csdn.net/qq_31086997/article/details/114019218