Prometheus的安装和配置教程详解
1. 从官网选择Prometheus版本进行下载
官网地址>> https://github./prometheus/prometheus/releases/
2. 实验安排
在主机192.168.153.137上安装prometheus监控192.168.153.138上的mysql服务和主机状态
3. 上传软件包到137服务器并配置
3.1 将软件包解压到 /usr/local 目录下
tar xzf prometheus-2.24.1.linux-amd64.tar.gz -C /usr/local/
3.2 给目录创建软链接
ln -s /usr/local/prometheus-2.24.1.linux-amd64/ /usr/local/prometheus
3.3 切换到目录下
cd /usr/local/prometheus
3.4 修改配置文件 prometheus.yml
,配置要监控的项
scrape_configs: # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config. - job_name: 'prometheus' # metrics_path defaults to '/metrics' # scheme defaults to 'http'. static_configs: - targets: ['localhost:9090'] #监控Linux主机状态 - job_name: 'linux' static_configs: - targets: ['192.168.153.138:9100'] #监控mysql服务状态 - job_name: 'mysql' static_configs: - targets: ['192.168.153.138:9104']
3.5 启动promethus服务
./prometheus --config.file=prometheus.yml
3.6 浏览器输入 IP:9090
查看
在Status->Targets
页面下,我们可以看到我们配置的两个Target,它们的State为DOWN。
4. 配置138主机 4.1 下载exporter
下载地址>> https://github./prometheus/node_exporter/releases
4.2 将软件包解压到 /usr/local 目录下
tar xzf node_exporter-1.0.1.linux-amd64.tar.gz -C /usr/local/
4.3 启动exporter
nohup /usr/local/node_exporter-1.0.1.linux-amd64/node_exporter &
4.4 下载mysqld_exporter
下载地址>> https://github./prometheus/mysqld_exporter/releases
4.5 将软件包解压到 /usr/local 目录下
tar xzf mysqld_exporter-0.12.1.linux-amd64.tar.gz -C /usr/local/
4.6 数据库给mysqld_exporter授权
[root@host-138 ~]# mysql Wele to the MariaDB monitor. Commands end with ; or \g. MariaDB [(none)]> GRANT REPLICATION CLIENT,PROCESS ON *.* TO 'mysql_monitor'@'localhost' identified by 'mysql_monitor'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> GRANT SELECT ON *.* TO 'mysql_monitor'@'localhost'; Query OK, 0 rows affected (0.00 sec)
4.7 创建 .my.f
配置文件
vim /usr/local/mysqld_exporter-0.12.1.linux-amd64/.my.f
内容为:
[client] user=mysql_monitor password=mysql_monitor
4.8 运行mysqld_exporter服务
nohup /usr/local/mysqld_exporter-0.12.1.linux-amd64/mysqld_exporter --config.my-f="/usr/local/mysqld_exporter-0.12.1.linux-amd64/.my.f" &
5. 在promethus页面刷新Status->Targets页面,可以看到配置的两个Target的State为UP:
5. 在137主机上安装部署grafana
安装教程链接>>https://.jb51./article/204660.htm
5.1 添加promethus数据源 未完待续…
到此这篇关于Prometheus的安装和配置教程详解的文章就介绍到这了,更多相关Prometheus安装和配置内容请搜索狼蚁SEO以前的文章或继续浏览狼蚁网站SEO优化的相关文章希望大家以后多多支持狼蚁SEO!
编程语言
- 机械手焊接机器人编程 机械手焊接设备编程
- vb数据库编程实例,vb做数据库
- tiobe世界编程语言排行榜,全球编程语言排行
- 成都java编程培训 成都it编程培训中心
- 编程基础培训,编程基础知识培训
- flash游戏编程基础教程,flash游戏开发教程
- 不会英语能学编程吗 不会英语可以学程序员吗
- 爱心代码编程C语言 爱心代码编程c语言公式
- c语言编程学习入门 c语言编程快速入门
- 西门子plc编程培训 西门子plc编程培训班
- 哪里可以学编程 台州哪里可以学编程
- 少儿编程哪个好 少儿编程哪个品牌好
- 编程是什么意思,图形编程是什么意思
- c语言编程软件下载,c语言编程软件在哪下载
- java编程软件下载,java编程下载手机版
- ug编程培训学校,ug编程培训教程