普罗米修斯prometheus的安装与监控linux
golang的安装
普罗米修斯是go开发的,所以需要安装go环境。
- 先下载golang,下载地址:https://studygolang.com/dl,
这里选择的是:https://studygolang.com/dl/golang/go1.16.5.linux-amd64.tar.gz
上传至/usr/local目录下并解压
添加环境变量
export GO_HOME=/usr/local/go
export PATH=$PATH:$GO_HOME/bin
- 验证go环境是否安装成功。
# go version
go version go1.16.5 linux/amd64
普罗米修斯prometheus的安装
- 下载prometheus,下载地址:https://github.com/prometheus/prometheus/releases
这里使用的是https://github.com/prometheus/prometheus/releases/download/v2.27.1/prometheus-2.27.1.linux-amd64.tar.gz
上传至/usr/local目录下并解压
将prometheus安装为系统服务
# cat /etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus[Service]
Type=simple
Restart=on-failure
RestartSec=5
ExecStart=/usr/local/prometheus-2.27.1.linux-amd64/prometheus --config.file=/usr/local/prometheus-2.27.1.linux-amd64/prometheus.yml[Install]
WantedBy=multi-user.target
- 启动prometheus
# systemctl enable prometheus
# systemctl start prometheus
# systemctl status prometheus
● prometheus.service - PrometheusLoaded: loaded (/etc/systemd/system/prometheus.service; disabled; vendor preset: disabled)Active: active (running) since Sun 2021-06-06 02:15:28 EDT; 1s agoMain PID: 9565 (prometheus)CGroup: /system.slice/prometheus.service└─9565 /usr/local/prometheus-2.27.1.linux-amd64/prometheus --config.file=/usr/local/prometheus-2.27.1.linux-amd64/prometheus.ymlJun 06 02:15:28 node07 prometheus[9565]: level=info ts=2021-06-06T06:15:28.354Z caller=head.go:755 component=tsdb msg="On-disk memory mappable chunks replay c…ion=14.216µs
Jun 06 02:15:28 node07 prometheus[9565]: level=info ts=2021-06-06T06:15:28.354Z caller=head.go:761 component=tsdb msg="Replaying WAL, this may take a while"
Jun 06 02:15:28 node07 prometheus[9565]: level=info ts=2021-06-06T06:15:28.362Z caller=head.go:813 component=tsdb msg="WAL segment loaded" segment=0 maxSegment=1
Jun 06 02:15:28 node07 prometheus[9565]: level=info ts=2021-06-06T06:15:28.363Z caller=head.go:813 component=tsdb msg="WAL segment loaded" segment=1 maxSegment=1
Jun 06 02:15:28 node07 prometheus[9565]: level=info ts=2021-06-06T06:15:28.363Z caller=head.go:818 component=tsdb msg="WAL replay completed" checkpoint_replay…n=9.195162ms
Jun 06 02:15:28 node07 prometheus[9565]: level=info ts=2021-06-06T06:15:28.370Z caller=main.go:828 fs_type=XFS_SUPER_MAGIC
Jun 06 02:15:28 node07 prometheus[9565]: level=info ts=2021-06-06T06:15:28.370Z caller=main.go:831 msg="TSDB started"
Jun 06 02:15:28 node07 prometheus[9565]: level=info ts=2021-06-06T06:15:28.370Z caller=main.go:957 msg="Loading configuration file" filename=/usr/local/promet...etheus.yml
Jun 06 02:15:28 node07 prometheus[9565]: level=info ts=2021-06-06T06:15:28.421Z caller=main.go:988 msg="Completed loading of configuration file" filename=/usr/local/pro…µs
Jun 06 02:15:28 node07 prometheus[9565]: level=info ts=2021-06-06T06:15:28.421Z caller=main.go:775 msg="Server is ready to receive web requests."
Hint: Some lines were ellipsized, use -l to show in full.
- 验证,浏览器输入:http://192.168.0.207:9090/,出现如下界面说明安装成功了。
node_exporter的安装
prometheus只是监控数据,那么数据的来源呢,由XXX_exporter进行收集,如果是监控linux系统,那么就要安装node_exporter。
- 下载node_exporter,下载地址:https://github.com/prometheus/node_exporter/releases
这里使用的是:https://github.com/prometheus/node_exporter/releases/download/v1.1.2/node_exporter-1.1.2.linux-amd64.tar.gz
上传至/usr/local目录下并解压
安装为系统服务
# cat /etc/systemd/system/node_exporter.service
[Unit]
Description=node-exporter[Service]
Type=simple
Restart=on-failure
RestartSec=5
ExecStart=/usr/local/node_exporter-1.1.2.linux-amd64/node_exporter[Install]
WantedBy=multi-user.target
- 启动node_exporter,并设置为随开机启动。
# systemctl daemon-reload
# systemctl start node_exporter
# systemctl status node_exporter
# systemctl enable node_exporter
- 验证,浏览器输入:http://192.168.0.207:9100/
正常会出现如下界面:
- 将node_exporter与prometheus建立联系,在prometheus.yml最后添加如下内容:
- job_name: 'linux'static_configs:- targets: ['192.168.0.207:9100']
可以使用./promtool check config prometheus.yml
对yml文件格式进行校验。
- 重启prometheus。
重启后,可以打开http://192.168.0.207:9090/targets查看监听的目标。
grafana的安装
prometheus只是监控,而grafana对这些数据进行图形化的展示,下面采用yum进行安装。
官方参考教程:https://grafana.com/docs/grafana/latest/installation/rpm/
- 配置yum源
# cat /etc/yum.repos.d/grafana.repo
[grafana]
name=grafana
baseurl=https://packages.grafana.com/oss/rpm
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packages.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
- 安装
# yum update
# yum makecache
# yum install -y grafana
- 启动,并设置为随系统开机启动
# systemctl daemon-reload
# systemctl start grafana-server
# systemctl status grafana-server
# systemctl enable grafana-server
- 验证,浏览器输入http://192.168.0.207:3000/,默认密码admin/admin
- prometheus与grafana之间建立联系
在http://192.168.0.207:3000/datasources/new添加数据源,选择prometheus。
输入prometheus的地址http://192.168.0.207:9090/保存即可,其余都默认。
- 导入dashboard,打开http://192.168.0.207:3000/dashboard/import,可以在https://grafana.com/grafana/dashboards寻找合适的模板,复制模板ID直接导入即可。
最终效果图如下:
普罗米修斯prometheus的安装与监控linux相关推荐
- 监控神器-普罗米修斯Prometheus的安装
最近看了些AIOPS的资料,对于里面提及的一个普罗米修斯Prometheus起了兴趣,首先是联想到异形,哈哈.去看了一下,普罗米修斯还真是厉害,而且还是开源的,真是搬砖党的福音. 功能: 在业务层用作 ...
- 普罗米修斯Prometheus的安装及Grafana使用
首先安装运行环境go 如果有网络 使用命令 yum install go -y 如果没有网络使用离线安装包 下载:Linux :go1.8.3.linux-amd64.tar.gz [root@bob ...
- 普罗米修斯 软件_监控神器-普罗米修斯Prometheus的安装
搬砖党的福音:普罗米修斯-监控神器 功能: 在业务层用作埋点系统 Prometheus支持多种语言(Go,java,python,ruby官方提供客户端,其他语言有第三方开源客户端).我们可以通过客户 ...
- 普罗米修斯java_springboot集成普罗米修斯(Prometheus)的方法
Prometheus 是一套开源的系统监控报警框架.它由工作在 SoundCloud 的 员工创建,并在 2015 年正式发布的开源项目.2016 年,Prometheus 正式加入 Cloud Na ...
- 监控之星-普罗米修斯Prometheus搭建
监控之星-普罗米修斯Prometheus搭建 导图 #mermaid-svg-JxDWZpg7w4fUYZee {font-family:"trebuchet ms",verdan ...
- 普罗米修斯 mysql监控_普罗米修斯Prometheus监控MySQL
普罗米修斯Prometheus监控MySQL 添加数据库用户 CREATE USER monitor_prometheus@'192.168.245.%' IDENTIFIED BY 'Abcde@1 ...
- 普罗米修斯Prometheus监控神器
文章目录 一.普罗米修斯Prometheus监控系统 1.1实验环境 1.2安装普罗米修斯 1.3访问prometheus界面(web) 1.4主机数据显示 1.5普罗米修斯监控图像 1.6普罗米修斯 ...
- 如何搭建普罗米修斯 Prometheus
如何搭建普罗米修斯 Prometheus 1.下载Prometheus 进到这个网址 https://github.com/prometheus/prometheus/releases 不同的系统下载 ...
- metrics类型 普罗米修斯_接近完美的监控系统—普罗米修斯
普罗米修斯(Prometheus)是一个SoundCloud公司开源的监控系统.当年,由于SoundCloud公司生产了太多的服务,传统的监控已经无法满足监控需求,于是他们在2012年决定着手开发新的 ...
最新文章
- Oracle Internal Event:10235 Heap Checking诊断事件
- 中的stop_谈谈stop容器
- 高性能mysql看不懂_高性能mysql笔记1
- Spring Boot文档阅读笔记-构建Restful风格的WebService
- 数据库封装 sql server mysql_mysql操作数据库进行封装实现增删改查功能
- Bailian2705 跳绳游戏【序列处理】
- Illustrator 教程,如何在 Illustrator 中添加效果?
- Android上SQLite的性能优化问题
- 2021-06-06 下拉框,列表框..
- Linux通过终端查看日志命令
- 微信商户异常处理的几个建议
- Gyroscope in smartphone 手机中的陀螺仪传感器
- 如何升级win10.
- 微信小程序自定义省市区下拉框
- Hypervisor是什么
- Dynamic Head: Unifying Object Detection Heads with Attentions
- 青春日志html,人民日报青春日记:做有信仰的奋斗者
- 2021EC-final博弈论E题Prof. Pang and Poker
- ros手柄控制机器人小车(一)
- BZOJ 4864: [BeiJing 2017 Wc]神秘物质 解题报告
热门文章
- 荧光底物和化学发光底物的介绍(腔肠素/腔肠素-H/BZiPAR/Z-FR-R110)
- 中国GMP级细胞因子市场现状及未来发展趋势
- 重磅!谷歌宣布 DeepMind 与 Google Brain 合并,奋力追赶 OpenAI
- 异常-异常场景的测试
- 1688API接口seller_info - 获得店铺详情
- 备战金9银10,精心整理:38道关于软件测试技术面试题(附带答案)
- 二分查找算法(递归+非递归)
- 主叫号码未显示【一分钟教你解决】
- 最新MSNMessenger机器人列表(转)
- python_在无须过多援引的情况下创建字典