{"id":1090,"date":"2019-07-17T11:53:42","date_gmt":"2019-07-17T09:53:42","guid":{"rendered":"http:\/\/dety.net.ua\/?p=1090"},"modified":"2019-07-17T11:53:42","modified_gmt":"2019-07-17T09:53:42","slug":"zabbix-certificates-monitoring","status":"publish","type":"post","link":"https:\/\/dety.net.ua\/?p=1090","title":{"rendered":"Zabbix + certificates monitoring"},"content":{"rendered":"<p>There is the fine script and template for certificates monitoring.<\/p>\n<p>Just create the script, import the template and link it to the host.<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"fgwVlogNeX\"><p><a href=\"https:\/\/www.null-byte.org\/development\/monitoring-ssl-certificates-with-zabbix\/\">Monitoring SSL Certificates with Zabbix<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Monitoring SSL Certificates with Zabbix&#8221; &#8212; Null Byte\" src=\"https:\/\/www.null-byte.org\/development\/monitoring-ssl-certificates-with-zabbix\/embed\/#?secret=KyXUVfQSUu#?secret=fgwVlogNeX\" data-secret=\"fgwVlogNeX\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<blockquote>\n<pre>#! \/bin\/sh\r\nSERVER=$1\r\nTIMEOUT=25\r\nRETVAL=0\r\nTIMESTAMP=`echo | date`\r\nif [ -z \"$2\" ]\r\nthen\r\nPORT=443;\r\nelse\r\nPORT=$2;\r\nfi\r\nEXPIRE_DATE=`echo | openssl s_client -connect $SERVER:$PORT 2&gt;\/dev\/null | openssl x509 -noout -dates 2&gt;\/dev\/null | grep notAfter | cut -d'=' -f2`\r\nEXPIRE_SECS=`date -d \"${EXPIRE_DATE}\" +%s`\r\nEXPIRE_TIME=$(( ${EXPIRE_SECS} - `date +%s` ))\r\nif test $EXPIRE_TIME -lt 0\r\nthen\r\nRETVAL=0\r\nelse\r\nRETVAL=$(( ${EXPIRE_TIME} \/ 24 \/ 3600 ))\r\nfi\r\n\r\necho \"$TIMESTAMP | $SERVER:$PORT expires in $RETVAL days\" &gt;&gt; \/etc\/zabbix\/externalscripts\/ssl_check.log\r\necho ${RETVAL}<\/pre>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>There is the fine script and template for certificates monitoring. Just create the script, import the template and link it to the host. Monitoring SSL Certificates with Zabbix #! \/bin\/sh SERVER=$1 TIMEOUT=25 RETVAL=0 TIMESTAMP=`echo | date` if [ -z &#8220;$2&#8221; ] then PORT=443; else PORT=$2; fi EXPIRE_DATE=`echo | openssl s_client -connect $SERVER:$PORT 2&gt;\/dev\/null | openssl [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,16],"tags":[],"class_list":["post-1090","post","type-post","status-publish","format-standard","hentry","category-novosti","category-zabbix"],"_links":{"self":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/1090","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1090"}],"version-history":[{"count":1,"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/1090\/revisions"}],"predecessor-version":[{"id":1091,"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/1090\/revisions\/1091"}],"wp:attachment":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1090"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1090"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1090"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}