首页 > 系统相关 >Centos 二进制安装 Prometheus

Centos 二进制安装 Prometheus

时间:2023-01-12 18:45:38浏览次数:38  
标签:Centos 二进制 interval 9090 prometheus scrape -- Prometheus configs

二进制下载地址:https://prometheus.io/download/

下载以 linux-amd64.tar.gz 结尾的文件。

1.下载二进制压缩包

wget -P /home https://github.com/prometheus/prometheus/releases/download/v2.41.0/prometheus-2.41.0.linux-amd64.tar.gz

2.解压

cd /home && mkdir prometheus && tar -zxvf prometheus-2.41.0.linux-amd64.tar.gz --strip-components 1 -C /home/prometheus
mv /home/prometheus /usr/local/bin

3.编辑启动的配置文件

# 我的全局配置
global:
  scrape_interval: 15s # 将刮擦间隔设置为每15秒钟,默认为每1分钟.
  evaluation_interval: 15s # 每 15 秒评估一次规则。 默认为每 1 分钟一次.
  # scrape_timeout 设置为全局默认值(10s).

# 警报管理器配置
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

# 加载一次规则并根据全局“evaluation_interval”定期评估它们.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# 一个仅包含一个要抓取的端点的抓取配置:
# 这是 Prometheus 本身。.
scrape_configs:
  # 作业名称将作为标签“job=”添加到此配置中刮取的任何时间序列.
  - job_name: "prometheus"

    # metrics_path 默认为“/metrics”
    # 方案默认为“http”.

    static_configs:
      - targets: ["localhost:9090"]

修改为如下内容:

global:
  scrape_interval: 15s
  evaluation_interval: 15s

alerting:
  alertmanagers:
    - static_configs:
        - targets:

rule_files:

scrape_configs:
  - job_name: "prometheus"
    static_configs:
      - targets: ["192.168.182.128:9090"]

4.开放防火墙端口

firewall-cmd --zone=public --add-port=9090/tcp --permanent //添加端口
firewall-cmd --reload    //重载
firewall-cmd --zone=public --query-port=9090/tcp    //查询端口开放是否成功

5.启动测试

./prometheus --config.file=prometheus.yml

6.注册为服务,用于自启动

  1.编写service文件

cat > /usr/lib/systemd/system/prometheus.service << EOF
[Unit]
Description=Prometheus Server
After=network.target
Documentation=https://prometheus.io/docs/introduction/overview/

[Service]
Type=simple
ExecStart=/usr/local/bin/prometheus/prometheus
  --config.file=/usr/local/bin/prometheus/prometheus.yml 
  --web.read-timeout=5m 
  --web.max-connections=512 
  --storage.tsdb.retention=15d 
  --storage.tsdb.path=/home/data/prometheus 
  --query.timeout=2m

Restart=on-failure

[Install]
WantedBy=multi-user.target
EOF

 

  2.设置自启动

systemctl daemon-reload
systemctl enable prometheus
systemctl start prometheus

 

标签:Centos,二进制,interval,9090,prometheus,scrape,--,Prometheus,configs
From: https://www.cnblogs.com/fanqisoft/p/17047641.html

相关文章

  • centos7.9 安装ddddocr验证码识别模块
    正常安装pipinstallddddocr 但是因为会使用国外源,很慢,所以我们使用国内源 首先先安装opencv-python-headless注意要使用小于4.3版本的,否则按照不上,windows忽略这一......
  • 使用UltraISO制作U盘CentOS启动盘
    1、下载安装UltraISO,下载地址:https://cn.ultraiso.net/xiazai.html2、准备centos系统镜像,下载地址:https://mirrors.aliyun.com/centos/7.9.2009/isos/x86_64/3、打开UltraI......
  • Centos 7 搭建DNS服务器
    1.DNS原理看这篇文章https://www.cnblogs.com/kubixuesheng/p/6260195.html2.服务器准备192.168.1.100 DNS服务器192.168.1.101 DNS客户端192.168.1.102 DNS客......
  • Centos SSH 免密操作
    1. 在本机生成公钥+私钥   ssh-keygen-trsa2.发送密钥到目标服务器   [email protected].尝试登录目标服务器  ssh 192.168.137.1......
  • LeetCode刷题(46)~颠倒二进制位【循环/分治】
    题目描述颠倒给定的32位无符号整数的二进制位。示例1:输入:00000010100101000001111010011100输出:00111001011110000010100101000000解释:输入的二进制串0000......
  • Centos7防火墙常用命令
    https://blog.csdn.net/xyy1028/article/details/104787061一.系统防火墙1.启动防火墙systemctlstartfirewalld2.关闭防火墙systemctlstopfirewalld3.查看状态systemc......
  • linux 关闭防火墙firewall,centos中关闭防火墙(firewall)及SELinux
    https://blog.csdn.net/weixin_30983965/article/details/116864967centos在不断的版本更新迭代过程中,在centos7中默认使用的是firewall作为防火墙。centos7关闭firewall......
  • Centos 6.x 更新内核 2.6->4.13
    最近搭建SS感觉上网很慢,想起了网络加速,锐速没找到,知道到了Google开源的TCPBBR拥塞控制算法,效果非常不错。本帖记录升级内核的过程。下载 更新内核rpm--importhttps:......
  • 问题盘点|使用 Prometheus 监控 Kafka,我们该关注哪些指标
    作者:阿里云可观测Kafka作为当前广泛使用的中间件产品,承担了重要/核心业务数据流转,其稳定运行关乎整个业务系统可用性。本文旨在分享阿里云Prometheus在阿里云Kafka......
  • 偶数位(熟悉二进制)
    几天没写了,今天写一个简单的小题  这道题乍一看,有点没有头绪,但是仔细考虑,也不是毫无头绪.思路1:只要会十进制和二进制之间的转换,将十进制转二......