When I start the Check
/usr/local/nagios/libexec/check_ncpa.py -H servername-t 'ncpatoken' -P 5693 -M plugins/check_docker.py and so on
from nagios server, I get this Error
UNKNOWN: cURL call failed
when i start with the same argument localy on the server to check:
python check_docker.py -H localhost-s /var/run/docker.sock --check-type=containers_running
it gives me an OK
OK: 0 running, 6 not running
I found that
curl --unix-socket /var/run/ 'http://theurl/containers/json?&filters= ... %5D}&all=1' -g -f
makes the problem, so I changed to
curl --unix-socket /var/run/docker.sock 'http://theurl/containers/json?&filters= ... %5D}&all=1' -g -f
and gives me:
[]
running fine. But when I start this from Nagios, it still gives me UNKNOWN: cURL call failed.
Docker, check_docker.py UNKNOWN: cURL call failed
Re: Docker, check_docker.py UNKNOWN: cURL call failed
You should be able to edit the nagios service configuration and change the --socket='path/to/docker.sock' part.
If you need help, please post your nagios service definition.
If you need help, please post your nagios service definition.
Re: Docker, check_docker.py UNKNOWN: cURL call failed
What do u mean exactly?
I am sure able to change the configuration, otherwise I could not test it.
The Problem is that a call from Nagios Server gives the Error, but localy from the Target not!
The Service Configuration is the official default check_docker.py from Nagios XI Docker Wizard... I did not change any Code.
You can change the arguments line in the Service Management of the service of the host....
But I think I have found another Problem:
Edit or cat the check_ncpa.py:
parser.add_option("-s", "--secure", action='store_true', default=False,
help='Require successful certificate verification. Does not work on Python < 2.7.9.')
This Option requires Python > 2.7.9. = means python3 ? But with Python3 Errors come:
File "check_ncpa.py", line 255
print stdout
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(stdout)?
But I dont need this Option -s anyway, just maybe it doesnt work cause check_docker.py needs higher version, but does not work with higher version of Python? I dont know... I dont want to change every line of Code with prints or whatever comes next...
So I guess I cant run check_docker.py from Nagios check_ncpa.py?
Everything else works fine, no problems with other checks. Only this one.
I am sure able to change the configuration, otherwise I could not test it.
The Problem is that a call from Nagios Server gives the Error, but localy from the Target not!
The Service Configuration is the official default check_docker.py from Nagios XI Docker Wizard... I did not change any Code.
You can change the arguments line in the Service Management of the service of the host....
But I think I have found another Problem:
Edit or cat the check_ncpa.py:
parser.add_option("-s", "--secure", action='store_true', default=False,
help='Require successful certificate verification. Does not work on Python < 2.7.9.')
This Option requires Python > 2.7.9. = means python3 ? But with Python3 Errors come:
File "check_ncpa.py", line 255
print stdout
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(stdout)?
But I dont need this Option -s anyway, just maybe it doesnt work cause check_docker.py needs higher version, but does not work with higher version of Python? I dont know... I dont want to change every line of Code with prints or whatever comes next...
So I guess I cant run check_docker.py from Nagios check_ncpa.py?
Everything else works fine, no problems with other checks. Only this one.
Re: Docker, check_docker.py UNKNOWN: cURL call failed
Looks like the fix is to do this (validated on mine):
https://coderleaf.wordpress.com/2017/02 ... n-centos7/
OR you can do this (not recommended for security reason but does work):
https://coderleaf.wordpress.com/2017/02 ... n-centos7/
OR you can do this (not recommended for security reason but does work):
Code: Select all
chmod 666 /var/run/docker.sockRe: Docker, check_docker.py UNKNOWN: cURL call failed
Hello ssax,
thank you very much for these, chmod on the run files did not do anything, but adding the /etc/docker/daemon.json did something.
I added the users "nagios" and "nrpe" to the docker group "docker" -> docker
985:nagios,nrpe
Now 3 of 5 checks are working more or less.
Containers Are Healthy
Containers Are Running
dont do anything right. But it seems these are not implemented yet?
parser.add_option("--check-type",
help="Choose the type of check. Currently implemented: containers_exist, "
"containers_running, containers_healthy, containers_cpu, containers_memory")
So I think in a future update it will be working? containers_cpu and containers_memory seem to work, but when there is something to warn or critical, it is showing in nagstamon only that there is something, but without text - only "CRITICAL:" and nothing more.
thank you very much for these, chmod on the run files did not do anything, but adding the /etc/docker/daemon.json did something.
I added the users "nagios" and "nrpe" to the docker group "docker" -> docker
Now 3 of 5 checks are working more or less.
Containers Are Healthy
Containers Are Running
dont do anything right. But it seems these are not implemented yet?
parser.add_option("--check-type",
help="Choose the type of check. Currently implemented: containers_exist, "
"containers_running, containers_healthy, containers_cpu, containers_memory")
So I think in a future update it will be working? containers_cpu and containers_memory seem to work, but when there is something to warn or critical, it is showing in nagstamon only that there is something, but without text - only "CRITICAL:" and nothing more.
Re: Docker, check_docker.py UNKNOWN: cURL call failed
Hello again,
oh no it does not work again.
Seems it has to do with the /var/run/docker.sock
I have 3 cloned same VM's with the same Docker versions and the same Docker App.
on one of them I changed chmod 666 to the docker.sock
on the other two i didnt.
2 of them worked with check_docker, one not.
I so I changed chmod 660 back again to docker.sock.
srw-rw----. 1 root docker docker.sock=
and it the check does not work anymore on this server too.
Now, 3 Servers, and only on one the check is working.
But all have same config, same docker, same chmod...
I despair...
worked after chmod and added deamon.json, but not working anymore after chmod back:
root@nagiosserver / # /usr/local/nagios/libexec/check_ncpa.py -H serverwithdocker1-t 'xxxx' -P 5693 -M plugins/check_docker.py -q "argsxxxx"
UNKNOWN: cURL call failed
never worked:
root@nagiosserver / # /usr/local/nagios/libexec/check_ncpa.py -H serverwithdocker2 -t 'xxxx' -P 5693 -M plugins/check_docker.py -q "args=xxxxxx"
UNKNOWN: cURL call failed
always worked after added daemon.json
root@nagiosserver / # /usr/local/nagios/libexec/check_ncpa.py -H serverwithdocker3 -t 'xxxx' -P 5693 -M plugins/check_docker.py -q "args=xxxx"
OK: |
xxxxxreturned OK (value 0.0306194%)
xxxxxreturned OK (value 0.913192275%)
oh no it does not work again.
Seems it has to do with the /var/run/docker.sock
I have 3 cloned same VM's with the same Docker versions and the same Docker App.
on one of them I changed chmod 666 to the docker.sock
on the other two i didnt.
2 of them worked with check_docker, one not.
I so I changed chmod 660 back again to docker.sock.
srw-rw----. 1 root docker docker.sock=
and it the check does not work anymore on this server too.
Now, 3 Servers, and only on one the check is working.
But all have same config, same docker, same chmod...
I despair...
worked after chmod and added deamon.json, but not working anymore after chmod back:
root@nagiosserver / # /usr/local/nagios/libexec/check_ncpa.py -H serverwithdocker1-t 'xxxx' -P 5693 -M plugins/check_docker.py -q "argsxxxx"
UNKNOWN: cURL call failed
never worked:
root@nagiosserver / # /usr/local/nagios/libexec/check_ncpa.py -H serverwithdocker2 -t 'xxxx' -P 5693 -M plugins/check_docker.py -q "args=xxxxxx"
UNKNOWN: cURL call failed
always worked after added daemon.json
root@nagiosserver / # /usr/local/nagios/libexec/check_ncpa.py -H serverwithdocker3 -t 'xxxx' -P 5693 -M plugins/check_docker.py -q "args=xxxx"
OK: |
xxxxxreturned OK (value 0.0306194%)
xxxxxreturned OK (value 0.913192275%)