ZABBIX BUGS AND ISSUES
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-10155

Trigger prototype without host:key references is saved in database

    Details

      Description

      Frontend allows user to successfully save trigger prototype with expression that does not contain any host:item references (for example "0=0"). Such trigger does not show up in frontend in connection to any host or template, obviously, but still can be seen in database (with expression "{}0=0").

      In similar situation with triggers we show error message:

      Cannot add trigger
      Details: Trigger expression must contain at least one host:key reference.

        Activity

        Hide
        vitalijs.cemeris added a comment -

        RESOLVED in development branch svn://svn.zabbix.com/branches/dev/ZBX-10155

        Show
        vitalijs.cemeris added a comment - RESOLVED in development branch svn://svn.zabbix.com/branches/dev/ZBX-10155
        Hide
        Oleg Egorov added a comment - - edited

        (1) String changes?

        vitalijs.cemeris No translation strings changed
        CLOSED

        Show
        Oleg Egorov added a comment - - edited (1) String changes? vitalijs.cemeris No translation strings changed CLOSED
        Hide
        Oleg Egorov added a comment - - edited

        TESTED for 2.2

        But please close first sub-issue

        Show
        Oleg Egorov added a comment - - edited TESTED for 2.2 But please close first sub-issue
        Hide
        vitalijs.cemeris added a comment - - edited

        Fixed in:

        • pre-2.2.12rc1 r58076
        • pre-2.4.8rc1 r58507
        • pre-3.0.1rc1 r58568
        • pre-3.1.0 r58569

        Alexander Vladishev these changes are REVERTED in r58571, r58572, r58573 and r58574. See (4) for more details.

        Show
        vitalijs.cemeris added a comment - - edited Fixed in: pre-2.2.12rc1 r58076 pre-2.4.8rc1 r58507 pre-3.0.1rc1 r58568 pre-3.1.0 r58569 Alexander Vladishev these changes are REVERTED in r58571, r58572, r58573 and r58574. See (4) for more details.
        Hide
        vitalijs.cemeris added a comment - - edited

        (2) different fix for 2.4 and trunk should be provided
        RESOLVED in development branch svn://svn.zabbix.com/branches/dev/ZBX-10155
        r58085

        Gunars Pujats CLOSED

        Show
        vitalijs.cemeris added a comment - - edited (2) different fix for 2.4 and trunk should be provided RESOLVED in development branch svn://svn.zabbix.com/branches/dev/ZBX-10155 r58085 Gunars Pujats CLOSED
        Hide
        Oleg Egorov added a comment - - edited

        (3) 2.4 issue
        Create trigger prototype with expression "0"

        Result:
        Trigger prototype added

        Undefined index: [trigger_prototypes.php:188 → CFrontendApiWrapper->create() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CTriggerPrototype->create() → CTriggerPrototype->createReal() → implode_exp() in C:\xampp\htdocs\ZBX-10155\frontends\php\include\triggers.inc.php:917]

        Created: Trigger prototype "0" on "".

        vitalijs.cemeris RESOLVED in r58087

        Oleg Egorov CLOSED

        Show
        Oleg Egorov added a comment - - edited (3) 2.4 issue Create trigger prototype with expression "0" Result : Trigger prototype added Undefined index: [trigger_prototypes.php:188 → CFrontendApiWrapper->create() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CTriggerPrototype->create() → CTriggerPrototype->createReal() → implode_exp() in C:\xampp\htdocs\ZBX-10155\frontends\php\include\triggers.inc.php:917] Created: Trigger prototype "0" on "". vitalijs.cemeris RESOLVED in r58087 Oleg Egorov CLOSED
        Hide
        Oleg Egorov added a comment -

        TESTED for 2.4

        Show
        Oleg Egorov added a comment - TESTED for 2.4
        Hide
        vitalijs.cemeris added a comment - - edited

        RESOLVED for 3.0 in r58512

        Oleg Egorov CLOSED

        Show
        vitalijs.cemeris added a comment - - edited RESOLVED for 3.0 in r58512 Oleg Egorov CLOSED
        Hide
        Alexander Vladishev added a comment - - edited

        (4) I reverted all changes in stable branches because it must be fixed by other way. The method checkDiscoveryRuleCount() should be rewritten to prohibit such cases.

        vitalijs.cemeris RESOLVED for 2.2
        in development branch svn://svn.zabbix.com/branches/dev/ZBX-10155
        r58700, r58798

        Oleg Egorov CLOSED

        Alexander Vladishev it is possible to create trigger prototype with lld-created item

        array_flip() must be replaced by array_uniq(). Such code will be more clear.

        REOPENED

        vitalijs.cemeris RESOLVED in r58967

        Oleg Egorov As discussed with Ivo Kurzemnieks. Function getExpressionItems should be removed. And try to use API request instead SQL queries.

        vitalijs.cemeris RESOLVED for 2.2
        in development branch svn://svn.zabbix.com/branches/dev/ZBX-10155
        r59164, r59168, r59170

        Alexander Vladishev Another solution. Please take a look.

        Also added validation of permissions to hosts in the trigger expression.

        RESOLVED in r59178 (minor code improvements in r59179)

        Gunars Pujats CLOSED

        Show
        Alexander Vladishev added a comment - - edited (4) I reverted all changes in stable branches because it must be fixed by other way. The method checkDiscoveryRuleCount() should be rewritten to prohibit such cases. vitalijs.cemeris RESOLVED for 2.2 in development branch svn://svn.zabbix.com/branches/dev/ZBX-10155 r58700, r58798 Oleg Egorov CLOSED Alexander Vladishev it is possible to create trigger prototype with lld-created item array_flip() must be replaced by array_uniq() . Such code will be more clear. REOPENED vitalijs.cemeris RESOLVED in r58967 Oleg Egorov As discussed with Ivo Kurzemnieks . Function getExpressionItems should be removed. And try to use API request instead SQL queries. vitalijs.cemeris RESOLVED for 2.2 in development branch svn://svn.zabbix.com/branches/dev/ZBX-10155 r59164, r59168, r59170 Alexander Vladishev Another solution. Please take a look. Also added validation of permissions to hosts in the trigger expression. RESOLVED in r59178 (minor code improvements in r59179) Gunars Pujats CLOSED
        Hide
        Gunars Pujats added a comment - - edited

        (5)

        • Create trigger prototype with expression "0=0"
          Result:
          Undefined index: items [trigger_prototypes.php:182 → CAPIObject->create() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CTriggerPrototype->create() → CTriggerPrototype->checkDiscoveryRuleCount() in api/classes/CTriggerPrototype.php:945]
          array_keys() expects parameter 1 to be array, null given [trigger_prototypes.php:182 → CAPIObject->create() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CTriggerPrototype->create() → CTriggerPrototype->checkDiscoveryRuleCount() → array_keys() in api/classes/CTriggerPrototype.php:945]
          Trigger prototype "Trigger prototype 01" contains item prototypes from multiple discovery rules. [trigger_prototypes.php:182 → CAPIObject->create() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CTriggerPrototype->create() → CTriggerPrototype->checkDiscoveryRuleCount() → CZBXAPI::exception() in api/classes/CTriggerPrototype.php:965]
          
        • Cannot add new trigger prototype to template
          Incorrect trigger expression. Host "Template OS Linux 2" does not exist or you have no access to this host. [trigger_prototypes.php:182 → CAPIObject->create() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CTriggerPrototype->create() → CTriggerPrototype->checkDiscoveryRuleCount() → CZBXAPI::exception() in api/classes/CTriggerPrototype.php:937]
          

        Alexander Vladishev Thanks! RESOLVED in r59189, r59190 and r59198.

        Gunars Pujats Minor code fix in r59211.

        Alexander Vladishev Thanks! CLOSED

        Show
        Gunars Pujats added a comment - - edited (5) Create trigger prototype with expression "0=0" Result : Undefined index: items [trigger_prototypes.php:182 → CAPIObject->create() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CTriggerPrototype->create() → CTriggerPrototype->checkDiscoveryRuleCount() in api/classes/CTriggerPrototype.php:945] array_keys() expects parameter 1 to be array, null given [trigger_prototypes.php:182 → CAPIObject->create() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CTriggerPrototype->create() → CTriggerPrototype->checkDiscoveryRuleCount() → array_keys() in api/classes/CTriggerPrototype.php:945] Trigger prototype "Trigger prototype 01" contains item prototypes from multiple discovery rules. [trigger_prototypes.php:182 → CAPIObject->create() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CTriggerPrototype->create() → CTriggerPrototype->checkDiscoveryRuleCount() → CZBXAPI::exception() in api/classes/CTriggerPrototype.php:965] Cannot add new trigger prototype to template Incorrect trigger expression. Host "Template OS Linux 2" does not exist or you have no access to this host. [trigger_prototypes.php:182 → CAPIObject->create() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CTriggerPrototype->create() → CTriggerPrototype->checkDiscoveryRuleCount() → CZBXAPI::exception() in api/classes/CTriggerPrototype.php:937] Alexander Vladishev Thanks! RESOLVED in r59189, r59190 and r59198. Gunars Pujats Minor code fix in r59211. Alexander Vladishev Thanks! CLOSED
        Hide
        Gunars Pujats added a comment -

        Tested, but close (5) before merging.

        Show
        Gunars Pujats added a comment - Tested, but close (5) before merging.
        Hide
        Alexander Vladishev added a comment - - edited
        Show
        Alexander Vladishev added a comment - - edited (6) Updated documentation: Zabbix API changes in 2.2#triggerprototype Zabbix API changes in 3.0#triggerprototype Gunars Pujats Updated documentation style. Alexander Vladishev Thanks! CLOSED
        Hide
        Alexander Vladishev added a comment -

        Fixed in:

        • pre-2.2.12 r59217
        • pre-3.0.2 r59219
        • pre-3.1.0 (trunk) r59220
        Show
        Alexander Vladishev added a comment - Fixed in: pre-2.2.12 r59217 pre-3.0.2 r59219 pre-3.1.0 (trunk) r59220
        Hide
        Alexander Vladishev added a comment - - edited

        (7) Please review changes in 3.0 branch

        Gunars Pujats CLOSED

        Show
        Alexander Vladishev added a comment - - edited (7) Please review changes in 3.0 branch Gunars Pujats CLOSED

          People

          • Assignee:
            Unassigned
            Reporter:
            Glebs Ivanovskis
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: