zabbix&prometheuss+Grafana监控系列容器版

1.首先安装zabbix

docker run --name some-zabbix-appliance -p 80:80 -p 10051:10051 -d zabbix/zabbix-appliance:latest

官网连接

https://hub.docker.com/r/zabbix/zabbix-appliance/

客户端安装agent之后可以获取以下信息

[root@cc126 ~]# docker exec some-zabbix-appliance zabbix_get -s 192.168.8.120 -p 10050 -k "system.hostname" 
cc120
[root@cc126 ~]# docker exec some-zabbix-appliance zabbix_get -s 192.168.8.120 -p 10050 -k "system.cpu.load[all,avg1]"
0.030000

2.安装prometheus (storage.tsdb.retention=100d 数据保留100天,不写参数默认15天)
配置文件

[root@cc126 ~]# egrep -v "#|^$" /opt/prometheus/prometheus1.yml 
global:
alerting:
  alertmanagers:
  - static_configs:
    - targets: ['localhost:9093']
rule_files:
  - "/opt/*.yml"
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
    - targets: ['localhost:9090']
  - job_name: 'win7'
    static_configs:
    - targets: ['192.168.8.188:9182']

启动prometheus

docker run  -d \
  -p 9090:9090 --name prometheus \
  -v /opt/prometheus/prometheus1.yml:/etc/prometheus/prometheus.yml \
  -v /opt/prometheus/data:/prometheus \
  -v /rule:/opt #告警规则
  prom/prometheus:latest \
  --config.file=/etc/prometheus/prometheus.yml \
  --storage.tsdb.retention.time=100d \
  --web.enable-lifecycle #配置支持热加载

语法检查

[root@cc126 ~]# docker exec prometheus promtool check config /etc/prometheus/prometheus.yml
Checking /etc/prometheus/prometheus.yml
  SUCCESS: 0 rule files found

3.grafana安装

chmod 777 -R /opt/grafana
docker run -d \
 -p 3000:3000 --name grafana \
 -v /opt/grafana:/var/lib/Grafana grafana/grafana:latest

zabbix插件安装

grafana-cli plugins install alexanderzobnin-zabbix-app
官网连接
https://grafana.com/grafana/plugins/alexanderzobnin-zabbix-app/installation

zabbix&prometheuss+Grafana监控系列容器版_第1张图片

你可能感兴趣的:(Prometheus)