Prometheus开始教程:https://blog.csdn.net/Coffin_monkey/article/details/90404639
对systemctl不熟的可以了解鸟哥的Linux私房菜
// prometheus系统服务配置 vim /etc/systemd/system/prometheus.service [Unit] Description=prometheus After=network.target [Service] Type=simple User=prometheus ExecStart=/usr/local/prometheus/prometheus -config.file=/usr/local/prometheus/prometheus.yml -storage.local.path=/var/lib/prometheus Restart=on-failure [Install] WantedBy=multi-user.target // 启动prometheus systemctl start prometheus systemctl status prometheus node_exporter setup // 安装node_exporter wget https://github.com/prometheus/node_exporter/releases/download/v0.18.0/node_exporter-0.18.0.linux-amd64.tar.gz tar -zxvf node_exporter-0.18.0.linux-amd64.tar.gz mv node_exporter-0.18.0.linux-amd64 /usr/local/node_exporter // 系统服务配置node_exporter vim /etc/systemd/system/node_exporter.service [Unit] Description=node_exporter After=network.target [Service] Type=simple User=prometheus ExecStart=/usr/local/node_exporter/node_exporter Restart=on-failure [Install] WantedBy=multi-user.target systemctl start node_exporter systemctl status node_exporter3. add node_exporter to prometheus.yaml
vim /usr/local/prometheus/prometheus.yml - job_name: 'linux' static_configs: - targets: ['localhost:9100'] labels: instance: node1 systemctl restart prometheus systemctl status prometheus grafana setup // 安装grafana wget https://dl.grafana.com/oss/release/grafana-6.1.6-1.x86_64.rpm yum localinstall grafana-6.1.6-1.x86_64.rpm // 启动grafana-server systemctl start grafana-server systemctl status grafana-serverprometheus默认端口为9090,可以在浏览器中输入http://localhost:9090/
granafa默认端口为3000,可以在浏览器中输入http://localhost:3000/
granafa首次登录账户名和密码admin/admin,可以修改配置数据源Data sources->Add data source -> Prometheus,输入prometheus数据源的信息,主要是输入name和url 添加DashboardNew Dashboard->Import Dashboard->输入8919,配置数据源为Prometheus,即上一步中的name 配置完保存后即可看到逼格非常高的系统主机节点监控信息,包括CPU、IO、网络等信息。Prometheus官网地址:https://prometheus.io/ 我的Github:https://github.com/Alrights/prometheus