Prometheus 和 Grafana的简单学习

本文介绍Prometheus及Grafana的下载、安装步骤,并详细说明如何配置Prometheus.yml文件来监控不同主机,同时提供了node-exporter的安装方法及Grafana的基本配置流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 下载

暂时不采用 docker化部署

prometheus下载地址

https://github.com/prometheus/prometheus/releases/

prometheus的explorter的下载

https://github.com/prometheus/node_exporter/releases

下载一个合适的版本

5.03 MB node_exporter-0.16.0.linux-amd64.tar.gz

grafana的下载

2. 安装

安装前置需要的包

yum install -y git
yum install -y go

3. 安装prometheus

解压缩

然后添加环境变量

cd /prometheus
tar -zxvf prometheus-2.3.2.linux-amd64.tar.gz
cd prometheus-2.3.2.linux-amd64
cp * /usr/local/prometheus #没有的话创建目录

#添加环境变量
vi /etc/profile.d/prometheus.sh

添加内容
PATH=/usr/local/prometheus:$PATH export PATH

返回原来的目录
cd /prometheus
创建一个yml文件
vim prometheus.yml

增加内容为:

global:
    scrape_interval: 60s
    evaluation_interval: 60s

scrape_configs:
    - job_name: prometheus
static_configs:
    - targets: ['localhost:9090']
        labels:
            instance: prometheus

    - job_name: linux01
        static_configs:
            - targets: ['10.24.103.1:9100']
                labels:
                    instance: linux01
    - job_name: linux02
        static_configs:
            - targets: ['10.24.103.2:9100']
                labels:
                    instance: linux02

 

启动

nohup prometheus --config.file=prometheus.yml &

打开浏览器进行验证  

然后可以 status-> targets

查看设备

没有安装 node-exporter时 时 down的 需要安装下

 

 

node-exporter的安装。

方法:

 tar -zxvf node_exporter-0.16.0.linux-amd64.tar.gz 
 cd node_exporter-0.16.0.linux-amd64/
 nohup ./node_exporter &

等一分钟 然后查看就是可用状态了。

 

 能监控很多很多项目

 

当然了 我还没看懂。。。

 

安装grafana

将下载好的rpm包放到当前目录然后

yum localinstall -y grafana-5.2.2-1.x86_64.rpm
启动
systemctl enable grafana-server
systemctl start grafana-server
登陆的话 默认端口 3000
默认用户名 密码 admin admin

修改 grafana的配置文件

vi /etc/grafana/grafana.ini

 

转载于:https://www.cnblogs.com/jinanxiaolaohu/p/9413720.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值