[ZBX-10155] Trigger prototype without host:key references is saved in database Created: 2015 Dec 11  Updated: 2017 May 30  Resolved: 2016 Apr 04

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.2.12rc1, 2.4.8rc1, 3.0.0alpha5
Fix Version/s: 2.2.12rc1, 3.0.2rc1, 3.2.0alpha1

Type: Incident report Priority: Trivial
Reporter: Glebs Ivanovskis (Inactive) Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: frontend, triggerprototypes
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 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.



 Comments   
Comment by vitalijs.cemeris (Inactive) [ 2015 Dec 16 ]

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

Comment by Oleg Egorov (Inactive) [ 2016 Jan 27 ]

(1) String changes?

vitalijs.cemeris No translation strings changed
CLOSED

Comment by Oleg Egorov (Inactive) [ 2016 Jan 28 ]

TESTED for 2.2

But please close first sub-issue

Comment by vitalijs.cemeris (Inactive) [ 2016 Jan 29 ]

Fixed in:

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

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

Comment by vitalijs.cemeris (Inactive) [ 2016 Jan 29 ]

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

gunarspujats CLOSED

Comment by Oleg Egorov (Inactive) [ 2016 Jan 29 ]

(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

Comment by Oleg Egorov (Inactive) [ 2016 Feb 03 ]

TESTED for 2.4

Comment by vitalijs.cemeris (Inactive) [ 2016 Feb 18 ]

RESOLVED for 3.0 in r58512

oleg.egorov CLOSED

Comment by Alexander Vladishev [ 2016 Feb 19 ]

(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

sasha 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 iivs. 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

sasha 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)

gunarspujats CLOSED

Comment by Gunars Pujats (Inactive) [ 2016 Mar 30 ]

(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]
    

sasha Thanks! RESOLVED in r59189, r59190 and r59198.

gunarspujats Minor code fix in r59211.

sasha Thanks! CLOSED

Comment by Gunars Pujats (Inactive) [ 2016 Mar 31 ]

Tested, but close (5) before merging.

Comment by Alexander Vladishev [ 2016 Apr 01 ]

(6) Updated documentation:

gunarspujats Updated documentation style.

sasha Thanks! CLOSED

Comment by Alexander Vladishev [ 2016 Apr 01 ]

Fixed in:

  • pre-2.2.12 r59217
  • pre-3.0.2 r59219
  • pre-3.1.0 (trunk) r59220
Comment by Alexander Vladishev [ 2016 Apr 01 ]

(7) Please review changes in 3.0 branch

gunarspujats CLOSED

Generated at Thu Apr 25 20:59:05 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.