Ad Widget

Collapse

Returned values from system.run script? Can they be referenced in Operations?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jmrice
    Member
    • Aug 2019
    • 33

    #31
    I could try something like:
    {zabbix.mydomain.com:system.run[/usr/local/bin/checkissuer.sh mydomain.com 443].strlen()}>0

    But the actual string value might not be available, just the number of characters.

    Then, what would {{HOST.HOST}:{ITEM.KEY2}.last()} evaluate to be?

    Comment

    • tim.mooney
      Senior Member
      • Dec 2012
      • 1427

      #32
      I think in that case (if you have to use .strlen()>0 in the trigger) using {ITEM.KEY2}.last() is the correct thing to do. Give it a try.

      Comment

      • jmrice
        Member
        • Aug 2019
        • 33

        #33
        Interesting tidbit from the docs:

        https://www.zabbix.com/documentation...ers/expression

        Functions

        Trigger functions allow to reference the collected values, current time and other factors.
        A complete list of supported functions is available.
        All functions return numeric values only. String comparison is not supported.
        If you want string comparison, upgrade to Zabbix 5.0. <<<<<<<<<<<<<<<<<<<<< !!!

        https://www.zabbix.com/documentation...ers/expression (5.0)

        Functions

        Trigger functions allow to reference the collected values, current time and other factors.
        A complete list of supported functions is available.
        Typically functions return numeric values.
        However, returning strings for string comparison is also possible with = and <> operators;
        see operators and trigger examples for more details.

        Although, I didn't find string comparisons to be possible. We are currently running 5.0

        Comment

        • jmrice
          Member
          • Aug 2019
          • 33

          #34
          Good news!

          Testing: SSL Certificate from Let's Encrypt on zabbix.mydomain.com expires in 30 days !

          Thank you!

          Comment

          • tim.mooney
            Senior Member
            • Dec 2012
            • 1427

            #35
            Originally posted by jmrice
            Good news!
            Testing: SSL Certificate from Let's Encrypt on zabbix.mydomain.com expires in 30 days !
            Excellent. To help out the next person, will you post both the trigger expression you ended up using and the message template from the message?

            Comment

            • jmrice
              Member
              • Aug 2019
              • 33

              #36
              Trigger expression:

              {zabbix.mydomain.com:system.run[/usr/local/bin/checkssl.sh mydomain.com 443].last()}<=90 and
              {zabbix.mydomain.com:system.run[/usr/local/bin/checkissuer.sh mydomain.com 443].strlen()}>0

              Operations message:

              Problem name: {EVENT.NAME}
              Severity: {EVENT.SEVERITY}
              SSL Certificate from {ITEM.VALUE2} expires in {ITEM.VALUE1} days !
              Last edited by jmrice; 28-09-2020, 18:20.

              Comment

              • jmrice
                Member
                • Aug 2019
                • 33

                #37
                For those that are curious, I found the checkssl.sh script at: https://medium.com/@sean_bradley/mon...x-860279519238

                I modified that to make the checkissuer.sh script:

                data=`echo | openssl s_client -servername $1 -connect $1:$2 2>/dev/null | openssl x509 -noout -issuer | grep -oP '^.*O=\K(.*?)(?:\/)' | awk -F/ '{print $1}'`
                echo $data

                Comment

                Working...