服务监控就是你的眼睛,当你对服务器运行状况一无所知时,你应该感到坐立不安。

<!--more-->

glances安装

glances是由python编写的,因此可以使用pip直接安装


pip3 install glances

influxdb安装


wget https://dl.influxdata.com/influxdb/releases/influxdb-1.8.2.x86_64.rpm

sudo yum localinstall influxdb-1.8.2.x86_64.rpm

收集数据到influxdb

配置 glances

vim /etc/glances/glances.conf


[influxdb]

# Configuration for the --export influxdb option

# https://influxdb.com/

host=localhost

port=8086

user=root

password=root

db=glances

prefix=localhost

#tags=foo:bar,spam:eggs

pip3 install influxdb

glances --export influxdb

执行 glances --export influxdb 测试下,报错

InfluxDB database 'glances' did not exist. Please create it需要新建数据库。

执行shell influx


CREATE DATABASE glances #创建数据

SHOW DATABASES # 查看数据库

再次执行glances --export influxdb ,可显示如下代表目前一切正常

granfana安装


wget https://dl.grafana.com/oss/release/grafana-7.1.5-1.x86_64.rpm

sudo yum install grafana-7.1.5-1.x86_64.rpm

启动


systemctl daemon-reload

systemctl start grafana-server

systemctl status grafana-server

  

systemctl enable grafana-server.service

配置数据源

grafana 还支持zipkin

博客内容遵循 署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0) 协议

本文永久链接是:http://visonforcoding.github.io/2020/08/25/glances-influxdb-granfana%E6%89%93%E9%80%A0%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%9B%91%E6%8E%A7%E7%B3%BB%E7%BB%9F/

请我喝杯咖啡


麦田348462402
78 声望4 粉丝