Closed mariaczi closed 6 years ago
Did you use provided template - https://github.com/monitoringartist/zabbix-docker-monitoring/blob/master/template/Zabbix-Template-App-Docker.xml ?
Yes, I use them. Without changing #HCONTAINERID to #FCONTAINERID in key values on item prototype it can't work, because #HCONTAINERID have only the first 12 digits and it will be not possible to read statistic data for container(s). I try use it on slackware distro, where docker use #FCONTAINERID for /sys/fs/cgroup for example:
# ls -la /sys/fs/cgroup/memory/docker/
drwxr-xr-x 2 root root 0 Jan 26 13:12 00339b5dc4a9b82152ebcd9ad21674085ec23d0be549206ad2202bea448c532f
drwxr-xr-x 2 root root 0 Jan 26 13:21 04a4da86dc84f8238eb9b72e8d3e0665542d898a04e75c7775596c8e5b5bf01e
drwxr-xr-x 2 root root 0 Jan 25 18:40 3063e1a931ee6b70aebe0dfde485e9578e56568e9395f34a2d230a947fb2223d
drwxr-xr-x 2 root root 0 Jan 25 18:39 3c5f44761b9e3b586886eb3819856a24cb6e22faf1c3221cd9d935a5c0c01270
drwxr-xr-x 2 root root 0 Jan 26 07:27 650fad137d188b02c018a19ce4d9d03d1974847b9847fc055ca00c9132736a67
drwxr-xr-x 2 root root 0 Nov 13 16:36 86b26a8d9855ac5ab5b5d75e2d9de301d605aa024f841a4df9a7d4eae3bc2dad
drwxr-xr-x 2 root root 0 Jan 25 18:32 a77e179eafe29907237fa41b42fe3b2162bb84ac885ff937753b83a41431820d
drwxr-xr-x 2 root root 0 Dec 29 15:59 b32df8d0b4bd41773eb4b59e275c5b4d02e54aa3514f1a7c97a657c7b17e5276
[sorry for the plain text for output, but I can't find how to insert code for multiple line]
Nope - https://github.com/monitoringartist/zabbix-docker-monitoring#available-metrics
Note: cid - container ID, two options are available:
OR
So for example:
docker.cpu[2599a1d88f75ea2de7283cbf469ea00f0e5d42aaace95f90ffff615c16e8fade,user]
is equivalent of
docker.cpu[/2599a1d88f75,user]
or docker.cpu[/containerhumanname,user]
-> module will try to expand used short container id (#SCONTAINERID) or human container name (#HCONTAINERID) into full container ID (#FCONTAINERID).
# docker ps --format "table {{.ID}}\t{{.Status}}"
CONTAINER ID STATUS
f345d3196969 Up About an hour
04a4da86dc84 Up 3 days
650fad137d18 Up 3 days
3063e1a931ee Up 3 days
3c5f44761b9e Up 3 days
# docker inspect --format="{{.Id}}" 3c5f44761b9e
3c5f44761b9e3b586886eb3819856a24cb6e22faf1c3221cd9d935a5c0c01270
# zabbix_agentd -t docker.up[/3c5f44761b9e]
docker.up[/3c5f44761b9e] [u|1]
# zabbix_agentd -t docker.up[/3c5f44761b9e3b586886eb3819856a24cb6e22faf1c3221cd9d935a5c0c01270]
docker.up[/3c5f44761b9e3b586886eb3819856a24cb6e22faf1c3221cd9d935a5c0c01270] [u|1]
Eh, now it's work as you wrote. But earlier it can't. I will check it tomorrow once again if I got correct values for macros and back with feedback. Thanks for your time :)
Edit: With increased log level on agent I see in his log file:
3931:20180129:152154.862 Additional permission of Zabbix Agent are not detected - only basic docker metrics are available
3931:20180129:152154.862 Default fci will be used, because zbx_module_docker_inspect_exec FAIL: Docker's socket API is not available
3931:20180129:152154.862 Metric source file: /sys/fs/cgroup/cpuacct/docker//f345d3196969d05cde0bdbd46ca3ea090ac07c30fb8eb24d872b4ec28a33051a/cpuacct.stat
I changed key for "Item prototype" in "Container xxx is running" to have as is in template
I'm wait for discovery and after it in frontend i can see:
When I check it manually on server, I have:
# zabbix_agentd -t docker.up[/04a4da86dc84]
docker.up[/04a4da86dc84] [u|1]
# docker inspect --format="{{.Id}}" 04a4da86dc84
04a4da86dc84f8238eb9b72e8d3e0665542d898a04e75c7775596c8e5b5bf01e
# zabbix_agentd -t docker.up[/04a4da86dc84f8238eb9b72e8d3e0665542d898a04e75c7775596c8e5b5bf01e]
docker.up[/04a4da86dc84f8238eb9b72e8d3e0665542d898a04e75c7775596c8e5b5bf01e] [u|1]
# docker ps --format "table {{.ID}}\t{{.Status}}"
CONTAINER ID STATUS
52102a8b5dce Up 15 hours
636c0a882f85 Up 16 hours
f345d3196969 Up 19 hours
**04a4da86dc84 Up 3 days**
3063e1a931ee Up 4 days
3c5f44761b9e Up 4 days
b32df8d0b4bd Up 4 weeks
86b26a8d9855 Up 2 months
I add macros in Description field on "Container is running": In result I receive: It is not prepared image, it is screenshot from zabbix web panel :)
Edit: I will try to update my zabbix server and agents to the latest version 3.4.6 and check what's happen.
I don't understand. What is a problem?
For example:
When I run:
# zabbix_agentd -t docker.discovery
on the server when zabbix agent work, I get (one from all):
"{#FCONTAINERID}":"b32df8d0b4bd41773eb4b59e275c5b4d02e54aa3514f1a7c97a657c7b17e5276","{#SCONTAINERID}":"b32df8d0b4bd","{#SYSTEM.HOSTNAME}":"hostname.eu","{#HCONTAINERID}":"loadbalancer_1"
but in zabbix web frontend the value for macro #HCONTAINERID and #SCONTAINERID is the same and it is the short CONTAINERID, not the HCONTAINERID.
I understand that, if in zabbix agent discovery we have different data for mentioned macros, the same values we should have in the zabbix server and in web frontend. It's true?
Edit:
After update zabbix to the 3.4.6 version the situation is the same.
And the next thing regarding to you question "What is a problem?":
On monitored server when agent zabbix work, when I manually try to check the container status I got that container is up:
docker.up[/04a4da86dc84] [u|1]
but in zabbix web forntend I have status down for the same container:
1.) Pls. test it from the zabbix server with the zabbix_get
utility
2.) If you are using modified template, then support for that template is not in the scope of this project - pls use http://zabbix.org/wiki/Getting_help
3.) Pls use provided default Docker template and monitor device play.monitoringartist.com
, just to see if it's working fine. That's a my public test Docker host:
$ zabbix_get -s play.monitoringartist.com -k docker.discovery
{"data":[{"{#FCONTAINERID}":"842a8251a6e88d30da4a5d58fae61525558b85b4f939436eaef5a9dd455a566c","{#SCONTAINERID}":"842a8251a6e8","{#SYSTEM.HOSTNAME}":"demo-monitoring-art","{#HCONTAINERID}":"dockbix-agent-xxl"},{"{#FCONTAINERID}":"25f595a29965221818471db9b9d096495638ee2b7c79a86e2aafaf63f828c064","{#SCONTAINERID}":"25f595a29965","{#SYSTEM.HOSTNAME}":"demo-monitoring-art","{#HCONTAINERID}":"grafana-xxl"}]}
For all results and test presented here I'm using your oryginal template from this repository. zabbix_get command from the my zabbix server to monitored server with docker:
# zabbix_get -s hostname.eu -k docker.discovery
{"data":[{"{#FCONTAINERID}":"3c5f44761b9e3b586886eb3819856a24cb6e22faf1c3221cd9d935a5c0c01270","{#HCONTAINERID}":"3c5f44761b9e","{#SCONTAINERID}":"3c5f44761b9e","{#SYSTEM.HOSTNAME}":"hostname.eu"}]}
# zabbix_get -s hostname.eu -k docker.up[/3c5f44761b9e]
0
# zabbix_get -s hostname.eu -k docker.up[/3c5f44761b9e3b586886eb3819856a24cb6e22faf1c3221cd9d935a5c0c01270]
1
From your server everything is OK:
# zabbix_get -s play.monitoringartist.com -k docker.discovery
{"data":[{"{#FCONTAINERID}":"842a8251a6e88d30da4a5d58fae61525558b85b4f939436eaef5a9dd455a566c","{#SCONTAINERID}":"842a8251a6e8","{#SYSTEM.HOSTNAME}":"demo-monitoring-art","{#HCONTAINERID}":"dockbix-agent-xxl"},{"{#FCONTAINERID}":"25f595a29965221818471db9b9d096495638ee2b7c79a86e2aafaf63f828c064","{#SCONTAINERID}":"25f595a29965","{#SYSTEM.HOSTNAME}":"demo-monitoring-art","{#HCONTAINERID}":"grafana-xxl"}]}
so, how I can debug where is the problem? I should start a docker containers with extra options? btw. Big thanks for your time and support. Best regards.
OK. I'm closing this issue. It's your configuration issue, which is not within the scope of this project.
For the others who could have the same issue: Despite the AllowRoot option on zabbix agent configuration I have set to "1" but zabbix agent was run as "zabbix" user (without root privileges) then it not having possibility to communicate with docker via their socket. [When I doing this all tests, I have docker running as root. I will switch them.]
Sorry for writing in this Closed ticket, but I have the same problem of Mariaczi and I don't understand if I have a wrong configuration or something else that can be resolved with your help. Returned values in frontend for HCONTAINERID and SCONTAINERID are the same, instead of having the human readable name of the container. What I have to do to have the human readable name of the container in frontend?
HCONTAINERID and SCONTAINERID are the same when the agent doesn't have permission to use Docker API - https://github.com/monitoringartist/zabbix-docker-monitoring#additional-docker-permissions
Just the thing I was missing. Thanks a lot for your help!
On discovery (
zabbix_agentd -t docker.discovery
) we have correct value for macro #HCONTAINERID and #SCONTAINERID but in frontend of zabbix we got the same value for this macros. I checked it putting all macros in Description field. Zabbix version 3.4.5 Docker version 17.03.2-ce