zabbix 6 监控 docker 容器
zabbix 6 监控 docker 容器
1.安装zabbix_agent2
curl -s http://10.26.211.56:8080/centos7-agent2-install.sh | bash
2.在zabbix server 端测试
zabbix_get -s 10.26.219.180 -k docker.infoZBX_NOTSUPPORTED: Cannot fetch data: Get "http://1.28/info": dial unix /var/run/docker.sock: connect: permission denied.
3./var/run/docker.sock 的权限
ll /var/run/docker.sock
srw-rw---- 1 root root 0 Feb 6 2024 /var/run/docker.sock
4.授权
usermod -aG root zabbix
usermod -aG docker zabbix
systemctl restart zabbix-agent2
5.测试
zabbix_get -s 10.26.219.180 -k docker.info{"Id":"NMED:MDQB:4OIK:VROS:4PL2:GQW7:EQMA:XQ4O:XFRO:SW3P:4T3E:BQDE","Containers":22,"ContainersRunning":13,"ContainersPaused":0,"ContainersStopped":9,"Images":20,"Driver":"overlay2","MemoryLimit":true,"SwapLimit":true,"KernelMemory":true,"KernelMemoryTCP":true,"CpuCfsPeriod":true,"CpuCfsQuota":true,"CPUShares":true,"CPUSet":true,"PidsLimit":true,"IPv4Forwarding":true,"BridgeNfIptables":false,"BridgeNfIP6tables":false,"Debug":false,"NFd":88,"OomKillDisable":true,"NGoroutines":95,"LoggingDriver":"json-file","CgroupDriver":"systemd","NEventsListener":1,"KernelVersion":"3.10.0-1160.105.1.el7.x86_64","OperatingSystem":"CentOS Linux 7 (Core)","OSVersion":"","OSType":"linux","Architecture":"x86_64","IndexServerAddress":"https://index.docker.io/v1/","NCPU":8,"MemTotal":16656068608,"DockerRootDir":"/wg/docker","Name":"u1anetmxp01","ExperimentalBuild":false,"ServerVersion":"19.03.6","ClusterStore":"","ClusterAdvertise":"","DefaultRuntime":"runc","LiveRestoreEnabled":false,"InitBinary":"docker-init","SecurityOptions":["name=seccomp,profile=default"],"Warnings":["WARNING: bridge-nf-call-iptables is disabled","WARNING: bridge-nf-call-ip6tables is disabled"]}
6.界面配置
7.查看数据