
Promethus-day4-监控不携带metrics接口的服务
发布日期:2021-05-10 01:01:22
浏览次数:38
分类:精选文章
本文共 3499 字,大约阅读时间需要 11 分钟。
������������������������
1. ������Prometheus������������
1.1 ������������
- ���������������Nginx���
[root@k8s-master1]# cat /etc/nginx/conf.d/status.confserver { listen 8081; location / { stub_status; }}
- ������Prometheus���Grafana���
[root@k8s-master1]# mkdir exporter-nginx[root@k8s-master1]# cd exporter-nginx[root@k8s-master1]# vim exporter-nginx-deployment.yaml
1.2 ������Prometheus Exporter
- ���������������������
cat > exporter-nginx-deployment.yaml
- ���������������
[root@k8s-master1 exporter-nginx]# kubectl apply -f exporter-nginx-deployment.yaml
- ���������������������������
cat > exporter-service.yaml
���������������
[root@k8s-master1 exporter-nginx]# kubectl apply -f exporter-service.yaml
1.3 ������EndPrints
- ���������������
[root@k8s-master1 exporter-nginx]# kubectl apply -f endpoint-service.yaml
1.4 ServiceMonitor������
- ������ServiceMonitor���������������
cat > service-monitor.yaml
- ������ServiceMonitor���
[root@k8s-master1 exporter-nginx]# kubectl apply -f service-monitor.yaml
1.5 ������������������Grafana���
- ������������������������
[root@k8s-master1 exporter-nginx]# kubectl get servicemonitor -n monitoring
2. ������Redis
2.1 ������Redis
- ������Redis���
[root@k8s-master1]# yum install redis\*[root@k8s-master1]# systemctl enable --now redis
- ������Redis���������
cat > redis-deploy.yaml
���������
[root@k8s-master1 exporter-redis]# kubectl apply -f redis-deploy.yaml
2.2 ������Redis Exporter
- ������Redis Exporter���
[root@k8s-master1 exporter-redis]# wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.12.1/mysqld_exporter-0.12.1.linux-amd64.tar.gz
- ������Redis Exporter���
[root@k8s-master1 exporter-redis]# tar -xf mysqld_exporter-0.12.1.linux-amd64.tar.gz -C /usr/local/[root@k8s-master1 exporter-redis]# nohup /usr/local/mysqld_exporter-0.12.1/mysqld_exporter --config.my-cnf=/usr/local/mysqld_exporter-0.12.1/.my.cnf &
3. ������MySQL���MariaDB���
3.1 ������MariaDB
- ������MariaDB���
[root@k8s-master1]# yum install mariadb\*[root@k8s-master1]# systemctl enable --now mariadb
- ���������������������
[root@k8s-master1]# mysql -u mysql_monitor -h localhost -pGRANT SELECT, REPLICATION CLIENT, PROCESS ON \*.\* TO 'mysql_monitor'@'%' IDENTIFIED BY 'oldboy@123';
3.2 ������MySQL Exporter
-
������MySQL Exporter���
[root@k8s-master1 exporter-mysql]# wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.12.1/mysqld_exporter-0.12.1.linux-amd64.tar.gz
-
������MySQL Exporter���
[root@k8s-master1 exporter-mysql]# tar -xf mysqld_exporter-0.12.1.linux-amd64.tar.gz -C /usr/local/
-
������MariaDB���������������
[root@k8s-master1]# vim /usr/local/mysqld_exporter-0.12.1/.my.cnf
���������������
[client]user=mysql_monitorpassword=123
-
���������������
[root@k8s-master1 exporter-mysql]# nohup /usr/local/mysqld_exporter-0.12.1/mysqld_exporter --config.my-cnf=/usr/local/mysqld_exporter-0.12.1/.my.cnf &
4. ������������Exporter
4.1������������
- ���������������Exporter���
[root@k8s-master1]# wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.12.1/mysqld_exporter-0.12.1.linux-amd64.tar.gz
- ������������������
[root@k8s-master1]# tar -xf mysqld_exporter-0.12.1.linux-amd64.tar.gz -C /usr/local/
- ���������������
[root@k8s-master1]# nohup /usr/local/mysqld_exporter-0.12.1/mysqld_exporter --config.my-cnf=/usr/local/mysqld_exporter-0.12.1/.my.cnf &
Each section follows a clear, step-by-step format to ensure ease of understanding and execution, providing a comprehensive guide for deploying a monitoring system.
发表评论
最新留言
路过按个爪印,很不错,赞一个!
[***.219.124.196]2025年04月28日 05时24分32秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
Linux之shell脚本实现ssh登录报警
2021-05-10
《五、企业级SVN运维实战:SVN禁止删除和强制注释》
2021-05-10
docker实战练习02-tomcat安装
2021-05-10
SQL server 2016安装
2021-05-10
Excuses, Excuses! map的应用
2021-05-10
搭建nfs服务器练习
2021-05-10
linux基础:命令行的使用(shell)、shell里的快捷键、linux基础设置
2021-05-10
Angular动态表单使用
2021-05-10
php中奖概率算法,刮刮卡/大转盘抽奖算法
2021-05-10
linux 编译出现的错误
2021-05-10
如何保证消息队列的高可用?
2021-05-10
Vue 判断对象是否存在某个属性/字段
2021-05-10
学习spring security 5~入门
2021-05-10
ArcEngine代码 GP区域分析之面积制表(统计各行政区内的各土地利用类型面积)
2021-05-10
ArcEngine代码 GP提取分析之筛选
2021-05-10
Flutter-Dart version solving failed
2021-05-10
常见状态码
2021-05-10
重定向
2021-05-10
MYISAM存储引擎
2021-05-10
什么情况必须使用 statement
2021-05-10