prometheus安装及使用
  VR9Dw1m0vHLi 2023年11月19日 15 0

一、官网下载地址

https://prometheus.io/download/

1、选择操作系统Linux,默认架构amd64即可。

 

 

 

prometheus安装及使用_vim

 

 

2、主程序下载链接点击此处

https://github.com/prometheus/prometheus/releases/download/v2.35.0/prometheus-2.35.0.linux-amd64.tar.gz

3、警告工具

https://github.com/prometheus/alertmanager/releases/download/v0.24.0/alertmanager-0.24.0.linux-amd64.tar.gz

二、安装

1、解压缩到/usr/loca/

tar xf prometheus-2.35.0.linux-amd64.tar.gz -C /usr/local/

2、采用软链接方式(因为版本会更新,软链接方便以后使用)

ln -s prometheus-2.35.0.linux-amd64 /usr/local/prometheu

3、查看配置文件

vim prometheus.yml

默认只有一个监控,监控本机的9090端口

- job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

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

4,默认开启Prometheus (前台执行)

./prometheus

5、通过浏览器端打开主机IP地址(服务器时间一定要准时)

http://172.16.1.100:9090/

 6、查看程序收集的自己信息

http://172.16.1.100:9090/metrics

 7、使用

#7.1在搜索处输入下列命令

prometheus_http_requests_total{code="302"}

返回如下:

prometheus_http_requests_total { code = " 302 " , handler = " / " , instance = " localhost:9090 " , job = " prometheus " }

##  prometheus_http_requests_total { code = " 302 " ,

job =prometheus 表示普罗米修斯监控的程序

prometheus安装及使用_配置文件_02

 8、操作系统原生是不支持promutheus,需要安装包

 

tar xf node_exporter-1.3.1.linux-amd64.tar.gz -C /usr/local/

 9、直接运行解压文件中的node_exporter文件即可

## 这里直接复制到bin下

cp node_exporter /usr/local/bin/

 

node_exporte ## 前台运行

 ##  node_exporte 监控主机自身信息,如收集MySQL数据库的就安装mysql_exporte

10、修改普罗米修斯的配置文件

vim /usr/local/prometheus/prometheus.yml

## 在配置文件的末尾添加如下:(缩进非常重要,可以和自带的- job : "prometheus"对齐)

## ALL nodes
  - job_name: "nodes "
    static_configs:
    - targets:
      - 172.16.1.100:9100
      - 172.16.1.101:9100

 11、通过网页端访问查看

prometheus安装及使用_配置文件_03

 

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月19日 0

暂无评论

推荐阅读
  6YY0QMPUXEwu   2023年12月10日   11   0   0 linux网卡
  nIt0XG0acU8j   2023年12月11日   15   0   0 linuxhtop
  nIt0XG0acU8j   2023年12月09日   18   0   0 linuxsort
  9JCEeX0Eg8g4   2023年12月11日   19   0   0 mysql配置文件