Checking Docker Container with NCPA/NRDP
Posted: Wed Jan 17, 2018 12:58 pm
I installed NCPA on a remote host that have Docker installed. I want to check if one of the containers is running .
I'm using this https://gist.github.com/ekristen/11254304 that work on the remote host:
but Nagios is showing an error:
Since this is run as the Nagios user that doesn't have permissions to run Docker, I modified the scrip to run the docker commands as sudo (e.g. sudo docker inspect.. and so on) and it still runs good when I run it as Nagios user.
ncpa command under /usr/local/ncpa/etc/ncpa.conf.d/example
1) How can I test the passive check from Nagios?
2) What would be the issue here?
Thanks!
I'm using this https://gist.github.com/ekristen/11254304 that work on the remote host:
Code: Select all
./docker_container.sh <container_id>
OK - <container_id> is running. IP: xxx.xx.x.x, StartedAt: 2018-01-11T14:43:17.538550851Z
Code: Select all
Current Status: UNKNOWN (for 0d 1h 57m 33s)
Status Information: /usr/local/ncpa/plugins/docker_container.sh: 25: [: <container_id>: unexpected operator
/usr/local/ncpa/plugins/docker_container.sh: 30: [: x/usr/bin/docker: unexpected operator
UNKNOWN - Unable to talk to the docker daemon
ncpa command under /usr/local/ncpa/etc/ncpa.conf.d/example
Code: Select all
[passive checks]
%HOSTNAME%|__HOST__ = system/agent_version
%HOSTNAME%|Disk Usage = disk/logical/|/used_percent --warning 80 --critical 90 --units Gi
%HOSTNAME%|CPU Usage = cpu/percent --warning 60 --critical 80 --aggregate avg
%HOSTNAME%|Swap Usage = memory/swap --warning 60 --critical 80 --units Gi
%HOSTNAME%|Memory Usage = memory/virtual --warning 80 --critical 90 --units Gi
%HOSTNAME%|Process Count = processes --warning 300 --critical 400
%HOSTNAME%|Docker = services --service docker --status running
%HOSTNAME%|ES Head Container = plugins/docker_container.sh/<container_id>
2) What would be the issue here?
Thanks!