{"id":674,"date":"2019-02-06T19:29:40","date_gmt":"2019-02-06T16:29:40","guid":{"rendered":"https:\/\/artem.services\/?p=591"},"modified":"2019-02-20T00:06:56","modified_gmt":"2019-02-19T21:06:56","slug":"ssl-d0-bf-d1-80-d0-be-d0-b2-d0-b5-d1-80-d0-ba-d0-b0-d1-81-d1-d0-d0-b4-d0-b5-d0-b9-d1-81-d1-82-d0-b2-d0-b8-d1-8f-d1-81-d0-b5-d1-80-d1-82-d0-b8-d1-84-d0-b8-d0-ba-d0-b0-d1-82","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=674&lang=en","title":{"rendered":"SSL &#8212; Certificate Validity check"},"content":{"rendered":"<p>The script receives the value, after how many days the certificate expires and sends the values to &quot;<strong>Zabbix<\/strong>&quot; via &quot;<strong>zabbix-sender<\/strong>&quot;.<\/p>\n<p>Script content:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n#!\/bin\/bash\r\n\r\nDOMAIN=&quot;$(hostname -f)&quot;\r\nDEADLINE=&quot;$(echo | openssl s_client -servername $DOMAIN -connect $DOMAIN:443 2&gt;\/dev\/null | openssl x509 -noout -dates | grep &quot;notAfter&quot; | cut -d &quot;=&quot; -f2)&quot;\r\nSSL_LAST_DAY=&quot;$(date +%s -d &quot;$DEADLINE&quot;)&quot;\r\nTODAY=&quot;$(date +%s)&quot;\r\nlet &quot;SSL_LEFT_DAYS = ( $SSL_LAST_DAY - $TODAY ) \/ 86400&quot;\r\n\r\n# WRITE TO LOG OR SEND TO ZABBIX\r\necho $SSL_LEFT_DAYS &gt; \/var\/log\/ssl_payday\r\n<\/pre>\n<p>&nbsp;<\/p>\n<blockquote><p>You need to make sure that the required domain is set as the <strong>FQDN<\/strong> of the host. Or receive it in another way, for example, if you have more than one domain on your host.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>The script receives the value, after how many days the certificate expires and sends the values to &quot;Zabbix&quot; via &quot;zabbix-sender&quot;. Script content: &nbsp; You need to make sure that the required domain is set as the FQDN of the host. Or receive it in another way, for example, if you have more than one domain &hellip; <a href=\"https:\/\/artem.services\/?p=674&#038;lang=en\" class=\"more-link\">\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u044c<span class=\"screen-reader-text\"> &quot;SSL &#8212; Certificate Validity check&quot;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[405],"tags":[407,409,347],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/674"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=674"}],"version-history":[{"count":2,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/674\/revisions"}],"predecessor-version":[{"id":676,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/674\/revisions\/676"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}