Page 1 of 1

Docker Remote API

Posted: Tue Oct 09, 2018 1:42 pm
by ragarwal
Hi Team,

I am trying to monitor containers on my OpenShift platform. For some reason, below curl command does not works from my nagios VM to the OpenShift VMs:

curl -f -g http://ip:port/containers/json?all=true

If I try to run below curl command locally from the OpenShift node, I get all details:
curl --unix-socket /var/run/docker.sock http:/containers/json

Please let me know how to fix this issue as after adding this to nagios, I'm getting "UNKNOWN: cURL call failed" under status.

Thanks,
Rahul Agarwal

Re: Docker Remote API

Posted: Tue Oct 09, 2018 1:49 pm
by cdienger
Try running the following:

curl -v -g http://ip:port/containers/json?all=true

The -f option tells the command to fail silently and -v will give us verbose output

Re: Docker Remote API

Posted: Tue Oct 09, 2018 1:49 pm
by scottwilkerson
You can do much of this with NCPA and the Docker Wizard built into the current version of Nagios XI

Re: Docker Remote API

Posted: Tue Oct 09, 2018 2:51 pm
by ragarwal
scottwilkerson wrote:You can do much of this with NCPA and the Docker Wizard built into the current version of Nagios XI
Hi Scott,

Thanks for the update. I tried NCPA but there is a field "Docker API Base URL" which is sort of confusing to me. As I said in my previous post, curl command "curl --unix-socket /var/run/docker.sock http:/containers/json" works from the node itself but in order for nagios to get those json updates, its trying to run "curl -f -g http://ip:port/containers/json?all=true" which fails with no route to the host.

Thanks,
Rahul

Re: Docker Remote API

Posted: Tue Oct 09, 2018 3:21 pm
by scottwilkerson
I'm not exactly sure if this works with Openshift, but in the Wizard there is a field "Docker API Base URL:" which you can use the single slash format, e.g.

Code: Select all

http:/containers/json