Uploaded image for project: 'ZABBIX FEATURE REQUESTS'
  1. ZABBIX FEATURE REQUESTS
  2. ZBXNEXT-5835

Preprocessin rule: Numeric hash

    XMLWordPrintable

    Details

    • Type: New Feature Request
    • Status: Closed
    • Priority: Trivial
    • Resolution: Duplicate
    • Affects Version/s: 4.4.6
    • Fix Version/s: 5.0 (plan)
    • Component/s: Templates (T)
    • Labels:
      None

      Description

      Hi,

      I had to configure a new template in order to monitor some http redirections, they should change every 24h or an alarm has to raise.

      I did not find how do do this trough the web gui, I could't create a trigger to comparte the actual item text value to the one 24h ago (didn't find an easy way to compare strings),  but was able to do it via UserParameters:

      UserParameter=curl.get.redirecturl.hash[*],perl -le 'print shift()/1e27' $(printf "%f\n" 0x$(curl -m 5 -sI $1 | sed -n '/^Location:/ s/^Location:\s//p' | md5sum | cut -d ' ' -f1)) 

      So basically I get the URL of the redirection with curl, hash it with md5, that gives a hex number, which  is converted to decimal.

      That number is too big to be stored on a item as a float, so it is divided by 1e27.

      I thought that a preprocessing option to convert any text to a numeric hash value (probably using a more suitable hash function) can come very handy, as a easy way to compare strings in order to create triggers.

      Thank you.

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              Héctor Héctor Sánchez
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: