/nagios-plugin

Nagios plugin - check docker (cpu / mem / bandwidth)

Primary LanguageShellGNU General Public License v3.0GPL-3.0

Nagios Pugins

check_docker.sh

Description

This script check stats and health Docker (writing for nagios/nrpe)

Requierements

Minimum Docker version -> 1.10.0
Nagios user need permission to use Docker, please add user nagios in docker group

usermod -aG docker ${USER}

For use this scipt nagios user need shell "/bin/bash", please execute next command

chsh -s /bin/bash ${USER}

Usage

Usage: ./check_docker_stats.sh [-v] [-h] [-n [-s -c -m -N]]
-h, --help
print this help message
-v, --version
print version program
-n, --name
name docker to check
-c, --cpulimitperc PERC_WARNING_CPU,PERC_CRITCAL_CPU
number in percent alert for CPU
-m, --memlimitperc PERC_WARNING_MEM,PERC_CRITICAL_MEM
number in percent alert for MEM usage
-N, --ntwlimit WARNING_NET_RX,WARNING_NET_TX,CRITCAL_NET_RX,CRITCAL_NET_TX
bandwidth (RX -> DL,TX -> UL) in kBps for docker selected
-s, --status
check if docker is alive

./check_docker.sh -n <container name> -c <PERC_WARNING_CPU>,<PERC_CRITCAL_CPU> \
 -m <PERC_WARNING_MEM>,<PERC_CRITICAL_MEM> \
 -N <WARNING_NET_RX,WARNING_NET_TX,CRITCAL_NET_RX,CRITCAL_NET_TX>

Troubleshooting

If docker stats have zero value for current|limit memory stats :
Alt text
Please execute this command :

cd help_script; ./enable_memswap_stats.sh