prometheus安装(普罗米修斯)

1.安装包

链接:https://pan.baidu.com/s/1McvL1t0-YpCuZ-IX-d8jQA
提取码:vy9h
--来自百度网盘超级会员V3的分享

一.prometheus

2.解压

3.准备工作

cp prometheus promtool /usr/local/bin/
mkdir -p /etc/prometheus/
cp prometheus.yml /etc/prometheus/

4.查看版本

prometheus --version

 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: ['192.168.92.111:9090']
# 添加 PushGateway 监控配置
  - job_name: 'pushgateway'
    static_configs:
    - targets: ['192.168.92.111:9091']
      labels:
       instance: pushgateway
 # 添加 Node Exporter 监控配置
  - job_name: 'node exporter'
    static_configs:
    - targets: ['192.168.92.111:9100', '192.168.92.112:9100', '192.168.92.113:9100']

   
复制代码

 

5.添加系统服务

vim /etc/systemd/system/prometheus.service

将以下内容写入文件中

复制代码
[Unit]
Description=Prometheus
Documentation=https://prometheus.io/
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/prometheus --web.enable-lifecycle --config.file=/etc/prometheus/prometheus.yml
Restart=on-failure
[Install]
WantedBy=multi-user.target
复制代码

 

6.启动服务,设置开机自启,并检查服务开启状态

systemctl daemon-reload
systemctl enable prometheus

 

7.启动服务

systemctl start prometheus

 

8.检测服务状态

systemctl status prometheus

 

二.pushgateway

1.配置开机自启动

vim /etc/systemd/system/prometheus.service

加入以下内容和上面一样就是改了这个运行文件

ExecStart=/usr/local/bin/pushgateway------》指定文件里的可执行文件就行,我的是把他拎出来放bin目录下了
复制代码
[Unit]
Description=pushgateway
Documentation=https:https://github.com/prometheus/pushgateway
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/pushgateway   #pushgateway解压路径,
Restart=on-failure
[Install] WantedBy
=multi-user.target
复制代码

2.启动服务,设置开机自启,并检查服务开启状态

systemctl daemon-reload
systemctl enable pushgateway

 

3.启动服务

systemctl start pushgatway
systemctl status pushgatway

 三.node_exporter

vim /etc/systemd/system/node_exporter.service   

加入:(ExecStart=node_exporter解压后的可执行文件,9100的端口号得加上,#!/bin/bash脚本标识好像是)

复制代码
#!/bin/bash
[Unit]
Description=node_exporter
Documentation=node_exporter Monitoring System
After=network.target

[Service]
ExecStart=/usr/local/bin/node_exporter/node_exporter
–web.listen-address=:9100\

[Install]
WantedBy=multi-user.target
复制代码

2.启动服务,设置开机自启,并检查服务开启状态

systemctl daemon-reload
systemctl enable node_exporter

 

3.启动服务

systemctl start node_exporter
systemctl status node_exporter

 

grafana的安装配置

参考:https://www.cnblogs.com/sanduzxcvbnm/p/13606261.html

 

 


4.检测

posted @   老油条666  阅读(651)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
点击右上角即可分享
微信分享提示