Ad Widget

Collapse

Certificate validation date check

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lado
    Junior Member
    • Sep 2017
    • 3

    #1

    Certificate validation date check

    I needed quite some time to figure out how to check certificate validity, but I am still not certain if this is correct. The goal is to be reminded 10 days before certificate expiration date.

    As item I use SSH agent and foloowing command to get epoch time of certificate expiration date:
    Code:
    date --date="$(openssl x509 -enddate -noout -in /root/mycert.pem | cut -d= -f 2)" +'%s'
    For trigger expression I use:
    Code:
    {KDD:ssh.run[certificate_validity_item].fuzzytime(86400)} = 0
    My question is if this is correct way to test validity of certificate. The documentation for fuzzytime just states that fuzzytime checks the difference between item timestamp value and Zabbix server timestamp. But what does this difference mean? Is server timestamp extracted from item timestamp or vice versa? Whill I get notification 10 days before the expiration date or 10 days after it? Are there any better ways to do this.
  • Ivo
    Junior Member
    • Aug 2017
    • 5

    #2
    I think "86400" seconds - it is one day no 10..

    Comment

    • lado
      Junior Member
      • Sep 2017
      • 3

      #3
      You are right. It should be 864000.

      Comment

      • Ivo
        Junior Member
        • Aug 2017
        • 5

        #4
        Not sure where is the problem..
        Create the item, create the trigger and set fuzzy time smaller than certificate's remaining time and you'll see -will it work or not...
        Last edited by Ivo; 04-09-2017, 13:00.

        Comment

        • lado
          Junior Member
          • Sep 2017
          • 3

          #5
          The problem is within understanding fuzzytime function.

          Should it be
          {KDD:ssh.run[certificate_validity_item].fuzzytime(86400)} = 0
          or
          {KDD:ssh.run[certificate_validity_item].fuzzytime(-86400)} = 0

          I would like to be notified 10 days before certificate expires, not 10 days after that.

          Comment

          • Ivo
            Junior Member
            • Aug 2017
            • 5

            #6
            D'oh..
            Create few test items with past and future unix timestamps values, add the fuzzytime triggers an you will see then how it works

            Comment

            Working...