[ZBX-7022] Group and host filter not working in screen elements Created: 2013 Sep 18  Updated: 2017 May 30  Resolved: 2013 Sep 24

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: None
Fix Version/s: 2.2.0

Type: Incident report Priority: Major
Reporter: Pavels Jelisejevs (Inactive) Assignee: Ivo Kurzemnieks
Resolution: Fixed Votes: 0
Labels: filters, screens
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I have a screen with a "Status of host group triggers" screen element without a host group selected. When I open it in the monitoring section, the group and host filters of the screen element are always set to "All" and I can't change them.



 Comments   
Comment by Pavels Jelisejevs (Inactive) [ 2013 Sep 18 ]

Regression, broken by

------------------------------------------------------------------------
r37990 | ivo | 2013-08-20 17:01:03 +0300 (Tue, 20 Aug 2013) | 1 line

..F....... ZBX-6816 improved error message display when provided incorrect group and host IDs
------------------------------------------------------------------------

Comment by Ivo Kurzemnieks [ 2013 Sep 18 ]

(1) Same example: create a screen with "Status of host group triggers" and no host group. Open it in Monitoring > Screens. When trying to select a host after page refresh, it redirects from /frontends/php/screens.php to /frontends/php/jsrpc.php producing an error

<table class="msgerr" cellpadding="0" cellspacing="0"><tr class=""><td class="msg_main msg" id="page_msg"><strong class="">ERROR: Wrong RPC call to JS RPC!</strong></td></tr></table>

When selecting host immediately, it at least stays on that link /frontends/php/screens.php.

iivs Adding back parameters "tr_groupid" and "tr_hostid" resolves also this issue.
RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-7022 r38604

jelisejev CLOSED.

Comment by Ivo Kurzemnieks [ 2013 Sep 18 ]

Actually it was already broken in dev branch ZBX-6816 r37637 due to removal of parameters "tr_groupid" and "tr_hostid". See ZBX-6816 (15).
Those parameters were required by those two screen element dropdowns.
RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-7022 r38604

Comment by Pavels Jelisejevs (Inactive) [ 2013 Sep 19 ]

(2) Permissions to the selected host and host group have to be validated the same way as for groupid and hostid.

iivs RESOLVED in r38642

jelisejev The validation of the tr_groupid and groupid parameters should be done in a single API request. Same for tr_hostid and hostid.

iivs RESOLVED in r38695

jelisejev

  • use the get_request() function instead of referring to $_REQUEST directly;
  • incorrect if statements in
    if (get_request('groupid')) {
    	$validateHostIds[] = $_REQUEST['hostid'];
    }
    if (get_request('tr_groupid')) {
    	$validateHostIds[] = $_REQUEST['tr_hostid'];
    }
    
  • changing a host group in a screen element causes a fatal error (most likely caused by an unnecessary array() constuctor when calling the isReadable() methods):
        array_flip(): Can only flip STRING and INTEGER values! [screens.php:70 → CAPIObject->isReadable() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CHostGroup->isReadable() → CHostGroup->get() → dbConditionInt() → array_flip() in /opt/lampp/htdocs/zabbix/trunk/frontends/php/include/db.inc.php:1058]
        Error in query [SELECT COUNT(DISTINCT g.groupid) AS rowscount FROM groups g WHERE ] [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
        mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given [screens.php:70 → CAPIObject->isReadable() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CHostGroup->isReadable() → CHostGroup->get() → DBfetch() → mysqli_fetch_assoc() in /opt/lampp/htdocs/zabbix/trunk/frontends/php/include/db.inc.php:616]
        mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given [screens.php:70 → CAPIObject->isReadable() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CHostGroup->isReadable() → CHostGroup->get() → DBfetch() → mysqli_free_result() in /opt/lampp/htdocs/zabbix/trunk/frontends/php/include/db.inc.php:618]
    

iivs RESOLVED in r38755

jelisejev Please review my changes in r38800.

iivs REVIEWED.
Thanks!
CLOSED.

Comment by Pavels Jelisejevs (Inactive) [ 2013 Sep 26 ]

TESTED.

If (2) is OK you can merge.

Comment by Ivo Kurzemnieks [ 2013 Sep 26 ]

Fixed in pre-2.1.6 (trunk) r38803

Generated at Fri Apr 26 21:25:33 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.