ToB企服应用市场:ToB评测及商务社交产业平台
标题:
Centos7安装摆设prometheus
[打印本页]
作者:
小小小幸运
时间:
2024-10-8 17:20
标题:
Centos7安装摆设prometheus
普罗米修斯
的紧张特点是:
具有由度量名称和键/值对标识的时间序列数据的多维
数据模型
PromQL,一种
灵活的查询语言,
可以使用这一维度
不依赖分布式存储; 单个服务器节点是自治的
时间序列集合通过HTTP上的拉模型发生
推送时间序列
通过中间网关支持
通过服务发现或静态设置发现目标
多种图形和仪表板支持模式
一、安装prometheus
系统情况:Centos7
版本:prometheus 2.54.1
二、下载安装包
直接下载官网的二进制包:https://www.prometheus.io/download/
三、开始安装
1、提前上传下载好的二进制安装包
2、
解压安装包
# tar -zxvf
prometheus-2.54.1.linux-amd64.tar.gz
-C /usr/local/ #根据本身实际情况解压到指定目次
3、进入加压后的目次
# cd /usr/local/prometheus-2.54.1.linux-amd64
4、使用默认设置启动服务
# ./prometheus --config.file=prometheus.yml
默认使用9090端口启动,服务启动后,我们可以使用浏览器访问连接查看web端
http://192.168.31.155:9090
#改成本身的ip,首页很简单的
四、开始安装 exporter(被监控端,客户端)
1、exporter下载地址:
# wget https://github.com/prometheus/node_exporter/releases/download/v0.16.0-rc.3/node_exporter-0.16.0-rc.3.linux-amd64.tar.gz
2、解压,直接启动服务就ok了
# tar zxvf
node_exporter-1.8.2.linux-amd64.tar.gz
-C /usr/local
# cd /usr/local/
node_exporter-1.8.2.linux-amd64
# ./node_exporter
2、在服务端设置,监控该客户端
# vi /usr/local/prometheus-2.54.1.linux-amd64/prometheus.yml
在
scrape_configs
下面添加如下内容,格式一定要正确,有多台就按照此格式添加多个
- job_name: '192.168.31.156' # 任务名本身定义,唯一
static_configs:
- targets: ['192.168.31.156:9100'] #ip改成本身被监控端的ip
3、打开web端,status-》target查看被监控端详情
五
、安装Grafana
1.下载、解压
#wget https://dl.grafana.com/oss/release/grafana-7.0.1.linux-amd64.tar.gz
#tar -zxvf grafana-7.0.1.linux-amd64.tar.gz
#mv grafana-7.0.1.l /usr/local/
#ln -s /usr/local/grafana-7.0.1/ /usr/local/grafana
2.创建grafana用户及数据存放目次
#useradd -s /sbin/nologin -M grafana
#mkdir /data/grafana
#chown -R grafana:grafana /usr/local/grafana
#chown -R grafana:grafana /data/grafana/
3. 修改设置文件
修改 /usr/local/grafana/conf/defaults.ini 文件,设置为上面新建的数据目次。
data = /data/grafana/data
logs = /data/grafana/log
plugins = /data/grafana/plugins
provisioning = /data/grafana/conf/provisioning
.4 把grafana-server添加到systemd中,新增 grafana-server.service 文件,使用systemd来管理grafana服务
#touch /etc/systemd/system/grafana-server.service
#vi /etc/systemd/system/grafana-server.service
[Unit]
Description=Grafana
After=network.target
[Service]
User=grafana
Group=grafana
Type=notify
ExecStart=/usr/local/grafana/bin/grafana-server -homepath /usr/local/grafana
Restart=on-failure
[Install]
WantedBy=multi-user.target
#chmod +x /etc/systemd/system/grafana-server.service
5.启动grafana并将其设置开机自启
#mkdir /script
#如果已经存在 #cd /script
#touch grafana_service.sh
#vi grafana_service.sh
systemctl daemon-reload
systemctl restart grafana-server
systemctl status grafana-server
systemctl enable grafana-server
#chmod +x grafana_service.sh
#sh /script/grafana_service.sh
6.访问
http://192.168.31.158:3000/login
# ps -ef | grep grafana
注意:grafana 初始账号密码:admin/admin
http://192.168.31.158:3000 进入主页
安装完成,大功告成
注意:忘记grafana的admin密码重置下令
#cd /usr/local/grafana/bin
#grafana-cli admin reset-admin-password admin1234
好了,简易安装摆设已完成,其它的设置会在以后的搭建测试博客中慢慢书写,谢谢关注,也可以去官网查看相干文档。
六.帮助文档
grafana 图表模板:https://grafana.com/grafana/dashboards
prometheus 文档:https://prometheus.io/docs/introduction/overview
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/)
Powered by Discuz! X3.4