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

Allow using hash in combination with macro as trigger function parameter (#{$MACRO})

XMLWordPrintable

    • Icon: Change Request Change Request
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • None
    • Frontend (F)
    • None

      Currently it's not allowed to use combination of hash symbol and a macro as trigger function parameter:

      host:service.status.count(#{$ERRORS.FROM},1,eq)}=0

      In this example I'd like to receive an alert if service is down for some variable number of subsequent checks.

      The server already supports this, the only blocking point is the Frontend that does not allow using both the hash symbol and a macro. The example fix (tested) for 5.0 looks pretty simple:

      --- ui/include/classes/validators/CFunctionValidator.php        2020-05-27 13:05:48.959208824 +0300
      +++ ui/include/classes/validators/CFunctionValidator.php.new    2020-05-27 12:50:32.718485922 +0300
      @@ -470,11 +470,6 @@
                              return (substr($param, 1) > 0);
                      }
       
      -               // allow hash symbol (#) prior to macro
      -               if (preg_match('/^#\{\$[A-Z0-9_\.]+\}$/', $param)) {
      -                       return true;
      -               }
      -
                      return ($this->validateSecValue($param) && $param > 0);
              }
      
      

       

            vmurzins Valdis Murzins
            dimir dimir
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: