文章目录
https://grafana.com/
https://www.elastic.co/downloads/kibana
https://prometheus.io/
https://github.com/jumpserver/jumpserver
prometheus
https://prometheus.io/download
https://grafana.com/grafana/download
https://grafana.com/grafana/dashboards
- 是一个时序数据库,主动取拉取数据. 这与influxDB不通(需要别人主动push数据给他)
- prometheus决定取哪些数据,以及取数据的频率
- Grafana或Kibana来实现数据可视化
Prometheus在收集数据时采用的’Pull’模型(服务端主动去客户端拉取数据). 而Zabbix等传统监控采用的’Push’模型(客户端发送数据给服务端)
Pull模型在云原生环境中有比较大的优势,原因是分布式系统中,一定是有中心节点知道整个集群信息的,那么通过中心节点就可以完成所有要监控节点的服务发现,去拉取数据就好了!
Push模型倒是省去了服务发现的步骤,但每个被监控的服务都需要内置客户端,还需要配置监控服务端的信息,这加大了部署的难度,Push模型在OpenStack和Kubernetes等环境中用的不多.
install
vim prometheus.yml
- job_name: linux
static_configs:
-targets: ['192.168.0.88:9100', '..']
labels:
instance: mypc1
yum install -y fontconfig freetype* urw-fonts
vim /etc/grafana/grafana.ini
[dashboards.json]
enabled = true
path = /var/lib/grafana/dashboards
[smtp] # 在Alerting里面配置邮件告警
host = ..:465
user = ..
[auth.anonymous]
enabled = true
org_name = xxx
org_role = Viewer
git clone https://github.com/percona/grafana-dashboards.git
cp -r grafana-dashboards/dashboards /var/lib/grafana
grafana-cli plugins install grafana-piechart-panel
systemctl start grafana-server
# 可以下载,然后grafana界面manage-import导入下载的json模板!
# exporter redis
redis_exporter redis//192... &
redis_exporter -redis.addr 192... -redis.password ..
# exporter mysql
grant replication client, process on *.* to 'exporter'@'localhost' identified by 'xxx';
grant select on performance_schema.* to 'exporter'@'localhost';
flush privileges;
vim my.conf
#[client]
#user=exporter
#password=xxx
mysqld_exporter -config.my-cnf="my.cnf" &
curl -XPOST localhost:9090/-/reload # 重新加载配置文件