Prometheus+Grafana备忘

Grafana安装

官网
https://grafana.com/grafana/download
官网提供了几种安装方式,我用最简单的

yum install -y https://dl.grafana.com/enterprise/release/grafana-enterprise-11.2.2-1.x86_64.rpm
  • 启动
//如果需要在系统启动时自动启动Grafana,可以使用以下命令开启自启动
systemctl enable --now grafana-server

systemctl stop grafana-server
systemctl restart grafana-server
systemctl start grafana-server

service grafana-server stop
service grafana-server restart
service grafana-server start

默认密码
按说是/var/log/grafana/grafana.log 这个文件里面
但是我只找到了账号,密码没看到,其实账号密码都一样,都是默认admin

prometheus官网

https://prometheus.io/download/
参考https://blog.csdn.net/carefree2005/article/details/139241267
下载一个linux的版本的
github的下载并不容易,悲催

//先把服务端解压
tar -zxvf prometheus-2.55.0-rc.0.linux-amd64.tar.gz 
//复制到目标文件夹
mv prometheus-2.55.0-rc.0.linux-amd64 /usr/local/prometheus
 cd /usr/local/prometheus/
 ./prometheus --version 
 //启动
 ./prometheus
systemctl restart prometheus 
systemctl enable prometheus
ss -antp|grep 9090

通过浏览器访问http:// IP:9090 就可以访问到 Prometheus 的主界面:

  • 默认可以看到本机的情况,可以在ststus 下拉的tagert里面看到

现在另一台机器安装安装监控节点,还是刚才的页面下载
地址:https://prometheus.io/download/

node_exporter-1.8.2.linux-amd64.tar.gz
mysqld_exporter-0.15.1.linux-amd64.tar.gz

tar -zxvf node_exporter-1.8.2.linux-amd64.tar.gz 
tar -zxvf mysqld_exporter-0.15.1.linux-amd64.tar.gz 
mv node_exporter-1.8.2.linux-amd64 /usr/local/node_exporter
mv mysqld_exporter-0.15.1.linux-amd64 /usr/local/mysqld_exporter


网上都在叫写node_exporter.service 这东西,大家各自去抄吧
这个还是最简单的启动
nohup ./node_exporter &
在server端配置文件加

 - job_name: "node"
    static_configs:
      - targets:
        - XX:9100
        labels:
          service: node_exporter
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值