前言
项目所需工具:
链接:https://pan.baidu.com/s/1sIa8nninf2Fz6YqE3vUpqQ?pwd=5wr3
提取码:5wr3
–来自百度网盘超级会员V4的分享
06:node_exporter插件
-
目标:实现node_exporter插件的安装监控Linux指标
-
实施
- 上传安装
cd ~ rz tar zxvf node_exporter-1.1.2.linux-amd64.tar.gz -C /opt/prometheus-2.26/ mv /opt/prometheus-2.26/node_exporter-1.1.2.linux-amd64 /opt/prometheus-2.26/node_exporter
- 注册
# 创建并编辑文件 vim /etc/systemd/system/node_exporter.service
[Unit] Description=node_exporter Documentation=Prometheus node_exporter plugin [Service] ExecStart=/opt/prometheus-2.26/node_exporter/node_exporter Restart=on-failure [Install] WantedBy=multi-user.target
- 启动
# 设置开机自启动 systemctl enable node_exporter # 启动服务 systemctl start node_exporter # 查看服务状态 systemctl status node_exporter
- 配置Prometheus
vim /opt/prometheus-2.26/prometheus.yml
scrape\_configs: - job\_name: 'prometheus' static\_configs: - targets: ['localhost:9090'] # 增加以下内容 - job\_name: 'linux' static\_configs: - targets: ['localhost:9100'] labels: instance: node1
- 重启prometheus ``` systemctl restart prometheus.service ```
- 验证:http://node1:9090
- 查看当前主机的CPU使用情况:node\_cpu\_seconds\_total ![image-20211005184748505](https://img-blog.csdnimg.cn/img_convert/003cd943a9d23874e753d2350e5d5ded.png) - 查看当前主机的CPU负载情况 :node\_load15 ![image-20211005184828208](https://img-blog.csdnimg.cn/img_convert/470ee8ff7c861f04f665a62b333cffd4.png)
-
小结
- 实现node_exporter插件的安装监控Linux指标
07:mysqld_exportor插件
-
目标:实现mysqld_exportor插件的安装监控MySQL指标
-
实施
- 上传安装
cd ~ rz tar zxvf mysqld_exporter-0.13.0-rc.0.linux-amd64.tar.gz -C /opt/prometheus-2.26/ mv /opt/prometheus-2.26/mysqld_exporter-0.13.0-rc.0.linux-amd64/ /opt/prometheus-2.26/mysqld_exporter/
- 配置MySQL用户授权
mysql -uroot -p SHOW VARIABLES LIKE 'validate\_password%'; set global validate_password_policy=LOW; set global validate_password_length=6; # 授权 GRANT PROCESS, REPLICATION CLIENT, SELECT ON \*.\* TO 'mysql\_exporter'@'localhost' IDENTIFIED BY '123456' WITH MAX_USER_CONNECTIONS 3; flush privileges;
- DDL:数据定义语言:建库建表 - DML:数据操作语言:增删改 - DQL:数据查询语言:查询 - DCL:grant、revoke
- 注册服务
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
,可以戳这里获取](https://bbs.csdn.net/topics/618545628)**
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!