Page 1 of 1

about monitor docker

Posted: Sat Aug 25, 2018 5:51 am
by Olin
Hi
I read the pdf via https://assets.nagios.com/downloads/nag ... ios-XI.pdf
and start configure . it's type 'No Docker API base URL specified'.
And I do not how to use check_docker.py script .
Can you provides some check_docker.py use example for me ?

thanks !!

Re: about monitor docker

Posted: Sun Aug 26, 2018 1:28 pm
by rkennedy
Did you specify a URL, or are you reading the socket locally over an agent?

This documentation should help for check_docker.py specifically - https://github.com/timdaman/check_docker

Re: about monitor docker

Posted: Mon Aug 27, 2018 10:37 am
by lmiltchev
Thanks @rkennedy!

@Olin, let us know if the link, posted above helped. You can usually view the usage of most of the plugins by passing the "-h" or "--help" flag from the command line.

Code: Select all

/usr/local/nagios/libexec/check_docker.py -h

Re: about monitor docker

Posted: Mon Aug 27, 2018 9:19 pm
by Olin
thank you @rkennedy and @lmiltchev

reading the socket And install ncpa in remote host .

Code: Select all

-bash-4.2$ ./check_docker.py  -h
Usage: check_docker.py [options]

Options:
  -h, --help            show this help message and exit
  -H HOST, --host=HOST  The host URL for your Docker daemon. If this plugin is
                        run locally, it should be something like
                        'http:/v1.35/'. If it's run remotely, it should be of
                        the form 'http[s]://ip.ip.ip.ip[:port]/'
  -s SOCKET, --socket=SOCKET
                        The docker unix socket (local connection only). This
                        should be of the form '/var/run/docker.sock'
  -t TIMEOUT, --timeout=TIMEOUT
                        Set the timeout duration in seconds. Defaults to never
                        timing out.
  -C CONTAINERS, --containers=CONTAINERS
                        A (quote-enclosed, comma-delimited) list of container
                        names/ids. If --networks is set, this will be ignored.
  -N NETWORKS, --networks=NETWORKS
                        A (quote-enclosed, comma-delimited) list of network
                        names/ids. If this is set, --containers will be
                        ignored.
  -w WARNING, --warning=WARNING
                        Set the warning threshold.
  -c CRITICAL, --critical=CRITICAL
                        Set the critical threshold.
  --perfdata-max=PERFDATA_MAX
                        Set the maximum value (used by performance data
                        grapher).
  --perfdata-min=PERFDATA_MIN
                        Set the minimimum value (used by performance data
                        grapher).
  --check-type=CHECK_TYPE
                        Choose the type of check. Currently implemented:
                        containers_exist, containers_running,
                        containers_healthy, containers_cpu, containers_memory
  --cert=CERT           The full path to the TLS v1.0 cert to access your
                        secure docker port (remote connection only).
  --key=KEY             The full path to the TLS v1.0 key to access your
                        secure docker port (remote connection only).
  --cacert=CACERT       The full path to the TLS v1.0 cacert to access your
                        secure docker port (remote connection only).
  --memory-unit=MEMORY_UNIT
                        Allows you to set a unit of measure for memory
                        calculation. Valid inputs: B, KiB, MiB, GiB
  -v, --verbose         Print more verbose error messages.
  -V, --version         Print the version number and exit.
  -a, --all             Instead of specifying names or IDs, perform checks on
                        all containers (even ones that aren't running). If
                        this is set, --containers and --networks are ignored.
  -l, --list-bad-containers
                        List the containers that aren't running/healthy/under-
                        usage-limits in long output.
  --total-usage         Calculate total usage in addition to per-container
                        usage. Uses the first warning and critical thresholds
  --total-average       Calculate average usage for all containers/networks.
                        Uses the first warning and critical thresholds, or the
                        second if total-usage is used.
  --networks-use-avg    Calculate the average (mean) usage for networks
                        instead of total usage.
  -p, --percentage      Calculate running/healthy as a percentage of all
                        selected containers rather than a strict count.
  --no-check-is-healthy
                        Treat containers without healthchecks as passing.
  --ignore-no-healthcheck
                        Exclude containers without healthchecks from the
                        tally.
  --no-individual-checks
                        For usage statistics, only calculate warning/critical
                        off aggregate metrics like total/average usage.
  --timeout-is-critical
                        When the check times out before completing, plugin
                        returns CRITICAL status instead of UNKNOWN
  --debug

Re: about monitor docker

Posted: Tue Aug 28, 2018 9:40 am
by lmiltchev
The full path to your docker socket is usually "/var/run/docker.sock". You can verify by running:

Code: Select all

netstat -a | grep -i docker.sock
The instructions on installing the NCPA agent on the remote machine can be found here:

https://www.nagios.org/ncpa/#downloads

Let us know if you have any more questions.