{"id":327,"date":"2025-11-18T08:32:05","date_gmt":"2025-11-18T08:32:05","guid":{"rendered":"https:\/\/linuxbase.io\/?p=327"},"modified":"2025-11-18T08:32:05","modified_gmt":"2025-11-18T08:32:05","slug":"nagios-ncpa-docker-check-script-with-substates","status":"publish","type":"post","link":"https:\/\/netguide.io\/linux\/en\/nagios-ncpa-docker-check-script-with-substates\/","title":{"rendered":"Nagios \/ NCPA Docker Check Script with Substates"},"content":{"rendered":"\n<p>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 &#8211; perfect for production environments where &#8220;running \/ not running&#8221; is simply not enough.<\/p>\n\n\n\n<p>### **What&#8217;s New?**<\/p>\n\n\n\n<p>Compared to the original script, which only differentiated between *running*, *restarting*, *stopped*, and *unknown*, the updated version now supports several additional Docker substates:<\/p>\n\n\n\n<p>\ud83d\udd39 **WARNING states**<\/p>\n\n\n\n<p>* Paused<br>* Restarting<br>* Removing<br>* Created (but not started)<\/p>\n\n\n\n<p>\ud83d\udd39 **CRITICAL states**<\/p>\n\n\n\n<p>* Exited<br>* Dead<br>* OOMKilled (Out of Memory)<br>* Stopped (not running)<\/p>\n\n\n\n<p>\ud83d\udd39 **Improved Robustness**<\/p>\n\n\n\n<p>* No more template errors thanks to dynamic state parsing<br>* Additional evaluation of the `.State.Status` field<br>* Fallback handling for missing fields<br>* Improved container existence checks<br>* Fully compatible with NRPE, NCPA, and local host checks<\/p>\n\n\n\n<p>\ud83d\udd39 **Additional Enhancements**<\/p>\n\n\n\n<p>* Outputs container start time and IP address<br>* Licensed under **GPLv3**<br>* General code hardening (better error handling, safer Docker calls)<\/p>\n\n\n\n<p>This makes the script an excellent choice for environments that require detailed container monitoring &#8211; such as debugging setups, monitoring pipelines, and sensitive production workloads.<\/p>\n\n\n\n<p>\ud83d\udcc4 **View \/ Download the script:**<br><a href=\"https:\/\/gitba.se\/tpries\/check_docker_container\/src\/branch\/main\/check_docker_container.sh#\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/gitba.se\/tpries\/check_docker_container\/src\/branch\/main\/check_docker_container.sh#<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have extended the well-known Nagios Docker check script by Erik Kristensen and added comprehensive **substate monitoring**. The new version [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":340,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[7],"tags":[437,439],"class_list":["post-327","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized-en","tag-check-en","tag-monitoring-en-en"],"uagb_featured_image_src":{"full":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2025\/11\/nagios.png",1920,1080,false],"thumbnail":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2025\/11\/nagios-150x150.png",150,150,true],"medium":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2025\/11\/nagios-300x169.png",300,169,true],"medium_large":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2025\/11\/nagios-768x432.png",768,432,true],"large":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2025\/11\/nagios-1024x576.png",1024,576,true],"1536x1536":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2025\/11\/nagios-1536x864.png",1536,864,true],"2048x2048":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2025\/11\/nagios.png",1920,1080,false]},"uagb_author_info":{"display_name":"tobias.pries","author_link":"https:\/\/netguide.io\/linux\/author\/tobias-pries\/"},"uagb_comment_info":0,"uagb_excerpt":"I have extended the well-known Nagios Docker check script by Erik Kristensen and added comprehensive **substate monitoring**. The new version [&hellip;]","_links":{"self":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/posts\/327","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/comments?post=327"}],"version-history":[{"count":0,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/posts\/327\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/media\/340"}],"wp:attachment":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/media?parent=327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/categories?post=327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/tags?post=327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}