树莓派Prometheus+grafana安装教程最新版
一、环境准备:查看电脑的系统结构
我之前在网上花了1000左右大洋买的一台树莓派,然后重装系统为Centos7
可以看到下面的命令,我的系统架构:Architecture: aarch64,有些在官网上找不到,可以去GITHUB找编译好的包下载安装。
[root@localhost yum.repos.d]# rpm -qi centos-releaseName : centos-release
Version : 7
Release : 9.2009.0.el7.centos
Architecture: aarch64
Install Date: Fri 30 Oct 2020 09:27:45 AM CST
Group : System Environment/Base
Size : 50635
License : GPLv2
Signature : RSA/SHA256, Mon 26 Oct 2020 09:24:53 PM CST, Key ID 6c7cb6ef305d49d6
Source RPM : centos-release-7-9.2009.0.el7.centos.src.rpm
Build Date : Fri 23 Oct 2020 11:00:29 PM CST
Build Host : aarch64-02.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
Summary : CentOS Linux release file
Description :
CentOS Linux release files
二、Prometheus安装
1、下载地址https://prometheus.io/download/选择Architecture: armv7,否则会安装不上。2、创建启动用户[root@prometheus-service prometheus]# groupadd prometheus[root@prometheus-service prometheus]# useradd -g prometheus -s /sbin/nologin prometheus3、解压并迁移改名[root@prometheus-service opt]# tar xf prometheus-2.36.0.linux-armv7.tar.gz[root@prometheus-service opt]# mv prometheus-2.36.0.linux-armv7 /usr/local/prometheus4、授权用户chown -R prometheus.prometheus /usr/local/prometheus5、创建数据存储目录mkdir -p /usr/local/prometheus/data6、启动添加到systemdcd /etc/systemd/system/touch prometheus.service[Unit]Description=Prometheus Monitoring SystemDocumentation=Prometheus Monitoring System[Service] ExecStart=/usr/local/prometheus/prometheus \--config.file=/usr/local/prometheus/prometheus.yml \--storage.tsdb.path=/usr/local/prometheus/data \--web.listen-address=:9090[Install]WantedBy=multi-user.target7、启动服务service prometheus restart./prometheus --config.file=prometheus.yml8、测试结果http://192.168.84.192:9090/graph9、检查配置命令/usr/local/prometheus/promtool check config /usr/local/prometheus/prometheus.yml10、web页面查询暴露数据http://192.168.84.192:9100/metrics
三、node_exporter安装
1、下载地址https://prometheus.io/download/选择Architecture: armv7,否则会安装不上。2、创建启动用户[root@prometheus-service prometheus]# groupadd prometheus[root@prometheus-service prometheus]# useradd -g prometheus -s /sbin/nologin prometheus3、下载地址https://prometheus.io/download/#node_exporter4、解压并且改名[root@node-exporters opt]# tar xf node_exporter-1.3.1.linux-armv7.tar.gz -C /usr/local/[root@node-exporters opt]# mv /usr/local/node_exporter-1.3.1.linux-armv7/ /usr/local/node_exporter5、添加node_exproter至systemdcd /etc/systemd/system/touch node_exporter.service[Unit]Description=node_exporterDocumentation=https://prometheus.io/After=network.target[Service]Type=simpleUser=prometheusGroup=prometheusExecStart=/usr/local/node_exporter/node_exporter \--web.listen-address=0.0.0.0:9100 \--collector.systemd \--collector.systemd.unit-whitelist=(sshd|nginx).serviceRestart=on-failure[Install]WantedBy=multi-user.target6、启动服务service node_exporter restart7、查看服务是否启动命令netstat -lntup
四、grafana安装
1、下载地址2、安装命令sudo yum install grafana-8.5.5-1.aarch64.rpm3、启动命令systemctl restart grafana-server.service4、登录帐号:admin 密码:admin1235、页面地址(IP根据实际而定)http://192.168.84.192:3000
五、导入模板及常用模板ID
1、监控容器,推荐ID3146:Kubernetes Pods8685:K8s Cluster Summary10000:Cluster Monitoring for Kubernetes8588:Kubernetes Deployment Statefulset Daemonset metrics315:Kubernetes cluster monitoring (via Prometheus)2、Linux服务器监控模板ID:8919:1 Node Exporter Dashboard 22/04/13 ConsulManager自动同步版9276:1.主机基础监控(cpu,内存,磁盘,网络)3、Windows服务器监控模板ID:104674、监控协议http/icmp/tcp/dns/9965:Blackbox Exporter Dashboard5、mysql监控7362:6、nginx9614
正文到此结束
- 本文标签: Grafana prometheus Linux
- 版权声明: 本站原创文章,于2022年07月16日由小蜜蜂社区发布,转载请注明出处