Prometheus+node_exporter+grafana部署安装
本次redis3.2.13版本集群搭建采用一台虚机,以192.168.190.148虚机为例
虚机配置:
机器IP | CPU&内存 | 系统盘 | 备注 |
192.168.190.148Flink1 | 2C4G | 50GB | 建议最低配置 |
目前以192.168.190.148虚机为例:
systemctl status firewalld |
如果没有关闭:
①、临时关闭:systemctl stop firewalld ②、永久关闭:systemctl disable firewalld |
mkdir /pro |
yum -y install go |
网址:https://prometheus.io/download/
tar -xvf prometheus-2.53.1.linux-amd64.tar.gz mv prometheus-2.53.1.linux-amd64 prometheus |
②、进入Prometheus目录下,编辑prometheus.yml文件:
将localhost:9090修改为192.168.190.148:9090 |
./prometheus --config.file=/usr/local/prometheus/prometheus.yml |
vi /etc/systemd/system/prometheus.service
[Unit] Description=Prometheus Documentation=https://prometheus.io/ After=network.target [Service] Type=simple User=root ExecStart=/pro/prometheus/prometheus --config.file=/pro/prometheus/prometheus.yml Restart=on-failure [Install] WantedBy=multi-user.target |
详情参照附件:
[prometheus.service]
编辑完成后按顺序执行:
A、pkill prometheus ##终止Prometheus进程(因为第③步启动了Prometheus) B、systemctl daemon-reload ##重新加载systemd服务 C、systemctl enable prometheus.service ##设置开机启动 D、systemctl start prometheus.service ##启动Prometheus E、systemctl status prometheus.service ##查看Prometheus状态 |
全部执行完成之后可打开网页:http://192.168.190.148:9090(http://本机IP:9090)
下载网址:https://prometheus.io/download/
tar -xvf node_exporter-1.8.2.linux-amd64.tar.gz mv node_exporter-1.8.2.linux-amd64 node_exporter |
cd node_exporter ./node_exporter |
[Unit] Description=prometheus server daemon [Service] ExecStart=/pro/node_exporter/node_exporter Restart=on-failure [Install] WantedBy=multi-user.target |
详情请参考附件:
[node_exporter.service]
编辑完成后按顺序执行:
A、systemctl daemon-reload ##重新加载systemd服务 B、systemctl enable node_exporter.service ##设置开机启动 C、systemctl start node_exporter.service ##启动Prometheus D、systemctl status node_exporter.service ##查看Prometheus状态 |
④、node监控的端口为9100,配置Prometheus的yml文件:
vi /pro/prometheus/prometheus.yml - job_name: "主机节点" static_configs: - targets: ["192.168.190.148:9100"] labels: instance: node |
详情请参考附件:
[prometheus.yml]
systemctl stop prometheus systemctl start prometheus |
网址:
wget https://dl.grafana.com/enterprise/release/grafana-enterprise-8.5.2-1.x86_64.rpm
yum -y install chkconfig |
rpm -ivh grafana-enterprise-8.5.2-1.x86_64.rpm |
systemctl start grafana-server.service ##启动grafana systemctl status grafana-server.service ##查看grafana状态 |
启动成功之后,前往网页输入:http:192.168.190.148:3000(http://本机ip:3000)