Ad Widget

Collapse

Issue when using external script to monitor certificate expiration

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Scrabbi
    Junior Member
    • Jan 2025
    • 10

    #1

    Issue when using external script to monitor certificate expiration

    Hello,

    I have created a small script to check how many days I have left before my website certificates expires. When I execute my script using the user "zabbix" (which is the one used when an external script is used if I understood well) on my zabbix server, the script works fine and I get the number of days before expiration. However, once I create a host with a template, I get " Could not read certificate from /tmp/tmp.xxxxxx unable to load certificate 0".


    Here you can find the script and the item :
    The name of the host is "mysite.com" and is monitored by my zabbix server :
    I found the script here : https://askubuntu.com/questions/1198...s-in-a-website

    Click image for larger version

Name:	image.png
Views:	18
Size:	42.8 KB
ID:	512053
    Click image for larger version

Name:	image.png
Views:	11
Size:	32.8 KB
ID:	512054
    I did a bit of troubleshooting, and when I execute the script form my server, the tmp file is created and contains the certificate, but if it's from the item, the tmp file is empty.

    I don't really know how to go from here, any help would be greatly appreciated.

    Scrabbi
  • Answer selected by Scrabbi at Today, 17:50.
    Scrabbi
    Junior Member
    • Jan 2025
    • 10

    Hello,
    I have found the problem, I did not use the right macro for the template (I have a different visible hostname and hostname) so that's why the script did not work !

    Comment

    • Donkey
      Junior Member
      • Jun 2024
      • 24

      #2
      I don't really know, but certificate monitoring has been covered here:

      Handy Tips #9: Native SSL/TLS certificate monitoring - Zabbix Blog

      Monitoring Website SSL/TLS Certificate Expiration with Zabbix | Windows OS Hub (woshub.com)

      Comment

      • Scrabbi
        Junior Member
        • Jan 2025
        • 10

        #3
        Hello,
        I have found the problem, I did not use the right macro for the template (I have a different visible hostname and hostname) so that's why the script did not work !

        Comment

        Working...