VRx Posted July 28, 2021 Share Posted July 28, 2021 Overview: Support for Docker template of the zabbix-agent container Application: Zabbix-Agent - https://www.zabbix.com/ DockerHub: https://hub.docker.com/r/zabbix/zabbix-agent https://hub.docker.com/r/zabbix/zabbix-agent2 Agent Version: newest stable Minimum Server Version: 6.9.2 Please use this support for unraid/docker issues/questions only. Zabbix have its own community forums, when You can find lots of information. Privileged mode does need to be left as enabled. This allows the agent to see system resources Adding Disks for Monitoring: On the docker configuration page you will preconfigured /mnt/user and /mnt/cache (as array and cache pool). You can change it on Your own, for example by disk or maybe add some other pools. Access Mode can be just Read Only Note, In Zabbix WebGUI You must set disk monitoring like Container Paths. * Please specify which version is affected by the problem (Agent or Agent2) Quote Link to comment
VRx Posted July 28, 2021 Author Share Posted July 28, 2021 I have added branches, so You can choose which version will be installed: default is 5.4 (latest stable) 5.0 4.4 Officially newer agent shoudn't work with older server. Quote Link to comment
supawiz6991 Posted August 4, 2021 Share Posted August 4, 2021 Using https://hub.docker.com/r/zabbix/zabbix-agent Fix common problems is reporting: Template URL for docker application zabbix-agent is not the as what the template author specified.The template URL the author specified is https://raw.githubusercontent.com/vrx-666/unraid-xml/master/my-zabbix-agent.xml. The template can be updated automatically with the correct URL. Looking at the settings for the zabbix_agent docker I don't even seen an entry for the template url. Additionally I do not recall changing or removing it. Was this a new change or did the docker container possibly get damaged? Quote Link to comment
supawiz6991 Posted August 5, 2021 Share Posted August 5, 2021 Update: An update for the docker image came through this morning, was applied, had fix common problems rescan, and the error persists. Quote Link to comment
VRx Posted August 8, 2021 Author Share Posted August 8, 2021 TemplateURL is deprecated: You can simply ignore that error. Quote Link to comment
supawiz6991 Posted August 8, 2021 Share Posted August 8, 2021 Noted and your response is appreciated! Thanks for the work on the plugin as well! 1 Quote Link to comment
Squid Posted August 9, 2021 Share Posted August 9, 2021 Have you had FCP automatically fix that error? 2 hours ago, VRx said: TemplateURL is deprecated: It's deprecated for maintainers entering it. But it is still used behind the scenes. (No one ever gave it the correct value, so the appfeed automatically fills it out) 1 Quote Link to comment
supawiz6991 Posted August 9, 2021 Share Posted August 9, 2021 4 hours ago, Squid said: Have you had FCP automatically fix that error? It's deprecated for maintainers entering it. But it is still used behind the scenes. (No one ever gave it the correct value, so the appfeed automatically fills it out) Ah ok. Yeah I went ahead and applied the fix via FCP. Quote Link to comment
mattmill Posted August 19, 2021 Share Posted August 19, 2021 Nice work on this! Is there anyway to monitor docker containers with this plugin? I am passing /var/run/docker.sock to the container but Zabbix reports the Docker service as down. Anyone had success? Quote Link to comment
VRx Posted August 19, 2021 Author Share Posted August 19, 2021 Because zabbix-agent2 in this container is running by the user without permissions to docker socket. There is a possibility to run this, but You must have basic knowledge about linux shell systems. You must check GID of docker group on Host (Unraid Server). Log in to zabbix-agent2 container as root user (default running "Console" from Unraid GUI made it but as zabbix user) Add group docker (with same gid as on host/unraid server) inside zabbix-agent2 container. Add user zabbix to this group. Restart zabbix-agent2 container. Note: You must do this again after every container update. Quote Link to comment
jimmy898 Posted August 19, 2021 Share Posted August 19, 2021 6 hours ago, VRx said: Because zabbix-agent2 in this container is running by the user without permissions to docker socket. There is a possibility to run this, but You must have basic knowledge about linux shell systems. You must check GID of docker group on Host (Unraid Server). Log in to zabbix-agent2 container as root user (default running "Console" from Unraid GUI made it but as zabbix user) Add group docker (with same gid as on host/unraid server) inside zabbix-agent2 container. Add user zabbix to this group. Restart zabbix-agent2 container. Note: You must do this again after every container update. First of all great job! Thanks for the template and guidelines. I'm facing the same problem with the very same solution but I can't find a way to easily add the user "zabbix" into the group "docker" due to usermod command not installed. Am I missing something? I correctly create the group with: docker exec --user root zabbix-agent2 sh -c "addgroup -g 281 docker" Do you have any hint? Thank you! Quote Link to comment
VRx Posted August 19, 2021 Author Share Posted August 19, 2021 You can do this by logging in as root: docker exec -it --user=root zabbix-agent2 /bin/bash Next, edit group file (/etc/group) in vim or sed. If You not familiar with vim, sed will be easier: sed -i "s/docker:x:281:/docker:x:281:zabbix/g" /etc/group Next, type "exit" to exit container shell, then You can restart container from Unraid GUI BTW: Some trick could be used for things that not working from zabbix container, by setting up cron in User Scripts Plugin, this cron could monitor something, and write to file, which could be read by zabbix-agent, for example: my script read parameters from ups tools, writing output to file on cache pool, zabbix-agent read this file and parse output to different items in zabbix. Quote Link to comment
mattmill Posted August 19, 2021 Share Posted August 19, 2021 1 hour ago, VRx said: You can do this by logging in as root: docker exec -it --user=root zabbix-agent2 /bin/bash Next, edit group file (/etc/group) in vim or sed. If You not familiar with vim, sed will be easier: sed -i "s/docker:x:281:/docker:x:281:zabbix/g" /etc/group Next, type "exit" to exit container shell, then You can restart container from Unraid GUI BTW: Some trick could be used for things that not working from zabbix container, by setting up cron in User Scripts Plugin, this cron could monitor something, and write to file, which could be read by zabbix-agent, for example: my script read parameters from ups tools, writing output to file on cache pool, zabbix-agent read this file and parse output to different items in zabbix. Thanks for this, this was something I didn't do. However after doing this the docker service is still reported as down in Zabbix. Quote Link to comment
mattmill Posted August 19, 2021 Share Posted August 19, 2021 (edited) 58 minutes ago, mattmill said: Thanks for this, this was something I didn't do. However after doing this the docker service is still reported as down in Zabbix. Got it working now. For anyone who stumbles upon this I had to install nano (my prefered editor) apk add nano Then run to open the groups nano /etc/group I then manually added to the group file. Your GID (281 below) may differ on your host machine. docker:x:281:zabbix Save and reboot docker container and it now works Just note that your GID may differ from the one above (281). To find your docker group ID run the below on your host machine getent group docker | awk -F: '{printf "Group %s with GID=%d\n", $1, $3}' Thanks for the pointers @VRx Edited August 19, 2021 by mattmill Add GID instructions. 1 Quote Link to comment
VRx Posted August 19, 2021 Author Share Posted August 19, 2021 1 hour ago, mattmill said: I then manually added to the group file. Your GID (281 below) may differ on your host machine. Sed should do the same. Quote Link to comment
jimmy898 Posted August 19, 2021 Share Posted August 19, 2021 4 hours ago, VRx said: You can do this by logging in as root: docker exec -it --user=root zabbix-agent2 /bin/bash Next, edit group file (/etc/group) in vim or sed. If You not familiar with vim, sed will be easier: sed -i "s/docker:x:281:/docker:x:281:zabbix/g" /etc/group Next, type "exit" to exit container shell, then You can restart container from Unraid GUI BTW: Some trick could be used for things that not working from zabbix container, by setting up cron in User Scripts Plugin, this cron could monitor something, and write to file, which could be read by zabbix-agent, for example: my script read parameters from ups tools, writing output to file on cache pool, zabbix-agent read this file and parse output to different items in zabbix. I get the job done! thanks a lot. With [PLUGIN] CA APPLICATION AUTO UPDATE I've added a script that runs after the update at container start. It should automate the permissions fix. Core commands are: docker exec --user root zabbix-agent2 sh -c "addgroup -g 281 docker" docker exec --user root zabbix-agent2 sh -c "sed -i "s/docker:x:281:/docker:x:281:zabbix/g" /etc/group" About User Scripts I've already set up a script that populates files: sensors > /mnt/user/appdata/zabbix_agent/misc/scripts/temperatures_data apcaccess > /mnt/user/appdata/zabbix_agent/misc/scripts/ups_data Adding avolume binding "/var/local/:/var/local/" I'm able to use the template of @fabianonline (thans a lot!): https://git.schle.nz/fabian/unraid-zabbix_agent/raw/branch/main/zabbix_template.xml 1 Quote Link to comment
tessierp Posted November 15, 2021 Share Posted November 15, 2021 I have a userparameter config file I use on my servers to monitor the SMART info of my disks. It requires the use of an external script that has to execute on the server to collect the necessary information... Here is the USERPARAMETER : UserParameter=storage.discovery[*],sudo /opt/zabbix/smartctl-storage-discovery.sh UserParameter=storage.get[*],sudo smartctl -i -H -A -l error -l background $1 UserParameter=smartctl.version,smartctl --version | grep -Eo "^smartctl\s[0-9\.[:space:]\r-]+" | sed -e 's/^smartctl\s//' The content of the script file is a big long so I'll skip but my question is the following. I'm having a hard time to figure out how this would work since the agent is running in a container. Anyone has a clue? Quote Link to comment
VRx Posted November 15, 2021 Author Share Posted November 15, 2021 You can run script on host and write output to file, which could be read by zabbix container. This is the easiest way. Most of templates are not prepared for zabbix-agent contenerized. Quote Link to comment
tessierp Posted November 15, 2021 Share Posted November 15, 2021 Yeah but I see various issues with that... I'll have to run a service that will periodically run a script on the server, save it to a file and drop it in a place the zabbix-agent2 will see it, process it, etc. Involves a lot of changes to existing templates on top of producing new scripts and services. Ideally I could install the zabbix agent baremetal which I guess would have to reside on the USB key.... Same thing if I would use Prometheus... But not sure that is ideal, especially since it doesn't come as an addon with UNRAID so with new updates it could get in the way or just be wiped. Quote Link to comment
VRx Posted November 16, 2021 Author Share Posted November 16, 2021 [Here] is beta plugin, should work like baremetal I think, but it is only agent not agent2, so it can't monitor docker containers. Quote Link to comment
capitan_lawrence Posted January 4, 2022 Share Posted January 4, 2022 Thank you very much for the information provided here. I was able to run the zabbix-agent2 in a docker container, and monitor other containers. The only thing I'm missing to monitor is the free space on the root directory where the zabbix agent is running. I'm sending all of my monitored data to grafana, but it's not picking up the space utilization. In the localhost, the root directory is in /dev/xvda. Above you mentioned "Note, In Zabbix WebGUI You must set disk monitoring like Container Paths.", can you please elaborate a little bit on this last part? Quote Link to comment
VRx Posted January 11, 2022 Author Share Posted January 11, 2022 Sorry, I think I missed notification about reply. On 1/4/2022 at 6:23 PM, capitan_lawrence said: Above you mentioned "Note, In Zabbix WebGUI You must set disk monitoring like Container Paths.", can you please elaborate a little bit on this last part? On the docker configuration page you have preconfigured /mnt/user and /mnt/cache (as array and cache pool). You can change it on Your own, for example by disk or maybe add some other pools. Access Mode can be just Read Only For example: /mnt/user on host You can bind to /mnt/array in zabbix agent container /mnt/cache on host You can bind to /mnt/something in zabbix agent container In Zabbix GUI You must set container paths to monitor, so: /mnt/array and /mnt/something Quote Link to comment
TurboStreetCar Posted July 19, 2022 Share Posted July 19, 2022 On 11/14/2021 at 10:21 PM, tessierp said: I have a userparameter config file I use on my servers to monitor the SMART info of my disks. It requires the use of an external script that has to execute on the server to collect the necessary information... Here is the USERPARAMETER : UserParameter=storage.discovery[*],sudo /opt/zabbix/smartctl-storage-discovery.sh UserParameter=storage.get[*],sudo smartctl -i -H -A -l error -l background $1 UserParameter=smartctl.version,smartctl --version | grep -Eo "^smartctl\s[0-9\.[:space:]\r-]+" | sed -e 's/^smartctl\s//' The content of the script file is a big long so I'll skip but my question is the following. I'm having a hard time to figure out how this would work since the agent is running in a container. Anyone has a clue? Hello, im looking to add a user parameter to the agent docker aswell, by any chance did you figure out a way to insert it to the docker? Quote Link to comment
spyd4r Posted September 13, 2022 Share Posted September 13, 2022 I'm a bit confused, how do I modify the config file to enable plugins? is it possible to monitor docker on the unraid system? Quote Link to comment
VRx Posted September 15, 2022 Author Share Posted September 15, 2022 On 9/13/2022 at 8:25 PM, spyd4r said: I'm a bit confused, how do I modify the config file to enable plugins? Activating plugins may not have sense since the docker container does not have full access to the host operating system. First of all, you need to consider what plugins you want to activate, whether they will be able to collect any data You could try to configure path for agent conf file, and after this edit it. On 9/13/2022 at 8:25 PM, spyd4r said: is it possible to monitor docker on the unraid system? You must carefully read previous posts Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.