Nagios / NCPA Docker Check Script with Substates

Advertisements

I have extended the well-known Nagios Docker check script by Erik Kristensen and added comprehensive **substate monitoring**. The new version allows for much more accurate container health checks – perfect for production environments where “running / not running” is simply not enough.

### **What’s New?**

Compared to the original script, which only differentiated between *running*, *restarting*, *stopped*, and *unknown*, the updated version now supports several additional Docker substates:

Advertisements

๐Ÿ”น **WARNING states**

* Paused
* Restarting
* Removing
* Created (but not started)

๐Ÿ”น **CRITICAL states**

* Exited
* Dead
* OOMKilled (Out of Memory)
* Stopped (not running)

๐Ÿ”น **Improved Robustness**

* No more template errors thanks to dynamic state parsing
* Additional evaluation of the `.State.Status` field
* Fallback handling for missing fields
* Improved container existence checks
* Fully compatible with NRPE, NCPA, and local host checks

๐Ÿ”น **Additional Enhancements**

* Outputs container start time and IP address
* Licensed under **GPLv3**
* General code hardening (better error handling, safer Docker calls)

This makes the script an excellent choice for environments that require detailed container monitoring – such as debugging setups, monitoring pipelines, and sensitive production workloads.

๐Ÿ“„ **View / Download the script:**
https://gitba.se/tpries/check_docker_container/src/branch/main/check_docker_container.sh#

Advertisements

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top