效果图
安装教程
先安装运行Prometheus(docker版)
先确认系统安装有docker
启动node-exporter
docker run -d -p 9100:9100 \ -v "/proc:/host/proc:ro" \ -v "/sys:/host/sys:ro" \ -v "/:/rootfs:ro" \ --net="host" \ prom/node-exporter
访问url:ip:9100
打开有界面显示就没问题
ps:打不开的看下防火墙
启动prometheus
新建目录prometheus,编辑配置文件prometheus.yml
mkdir /opt/prometheus cd /opt/prometheus/ 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: linux static_configs: - targets: ['ip:9100'] labels: instance: localhost
把上面的ip:9100换成你的机器ip
启动docker
docker run -d \ -p 9090:9090 \ -v /opt/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml \ prom/prometheus
访问:http://ip:9090/graph
NOTE:安装并启动grafana(此处我们使用非docker安装方式 实测docker可能会出现server无法访问内部ip现象)
引用下官方文档https://grafana.com/docs/grafana/latest/installation/
引用下官方文档https://grafana.com/docs/grafana/latest/installation/
介绍下centos安装
vi /etc/yum.repos.d/grafana.repo
添加如下语句
[grafana] name=grafana baseurl=https://packages.grafana.com/oss/rpm repo_gpgcheck=1 enabled=1 gpgcheck=1 gpgkey=https://packages.grafana.com/gpg.key sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt
然后就可以愉快地yum了
sudo yum install grafana
启动程序
sudo systemctl daemon-reload sudo systemctl start grafana-server sudo systemctl status grafana-server
对于debian系
sudo apt-get install -y apt-transport-https sudo apt-get install -y software-properties-common wget wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add - # Alternatively you can add the beta repository, see in the table above sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main" sudo apt-get update sudo apt-get install grafana
没有问题的话就可以通过ip访问了
http://IP:3000/
初始账号密码都是admin
会要求更改密码
然后会要求你连接后端
url填写http://yourip:9090
快速创建图标
左端➕选择import 引用
可以到官方dashboard
https://grafana.com/grafana/dashboards
这里推荐下https://grafana.com/grafana/dashboards/8919
就是作者用的这一款,有能力的大佬可以自己开发
-End-
本文转载自MJJ microlz
大佬的博客
原文链接 : >>>点击访问<<<
6 Comments
屌屌屌~!
@RXG 基本的
233 你这排名比我都高 绑定 zsbd
嘻嘻嘻
@microlz emmmm 一定是百度有问题! 大佬多发原创一定会火的!
@风影OvO 哈哈 我没怎么提交 大佬主题挺好看的阿
@microlz 我也没提交 不会弄..就是蹭友链的流量哈哈哈哈
主题是lolimoe 然后自己改了改