自学内容网 自学内容网

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

原文地址:https://blog.csdn.net/dzl84394/article/details/142716587

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!