Ad Widget

Collapse

Bug in Availability Report

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cioris
    Member
    • Oct 2008
    • 30

    #1

    Bug in Availability Report

    Availability report is not working propoerly due to a bug in report2.php.
    Line 242 should be updated as there is no groupid field in the filter. The name of the field is hostgroupid. So, $_REQUEST['groupid'] should be updated to $_REQUEST['hostgroupid']. Be aware to update the sql sentence in line 244, too.

    here is the code:

    if($_REQUEST['hostgroupid'] > 0){
    $sql_from .= ',hosts_groups hg ';
    $sql_where.= ' AND hg.hostid=h.hostid AND hg.groupid='.$_REQUEST['hostgroupid'];
    }

    I know, I'm playing w/ semantics..
  • cioris
    Member
    • Oct 2008
    • 30

    #2
    not fixed yet...

    looks like my fix is not fully ok. I still need to lokk over.
    Maybe the Zabbix developer can find a fix faster as they are more familiar w/ the code... Sorry... be back soon...

    Comment

    • Aly
      ZABBIX developer
      • May 2007
      • 1126

      #3
      Originally posted by cioris
      Availability report is not working propoerly due to a bug in report2.php.
      Line 242 should be updated as there is no groupid field in the filter. The name of the field is hostgroupid. So, $_REQUEST['groupid'] should be updated to $_REQUEST['hostgroupid']. Be aware to update the sql sentence in line 244, too.

      here is the code:

      if($_REQUEST['hostgroupid'] > 0){
      $sql_from .= ',hosts_groups hg ';
      $sql_where.= ' AND hg.hostid=h.hostid AND hg.groupid='.$_REQUEST['hostgroupid'];
      }

      I know, I'm playing w/ semantics..
      What do you exactly mean?
      Zabbix | ex GUI developer

      Comment

      • cioris
        Member
        • Oct 2008
        • 30

        #4
        more details

        ok, so here is the problem:
        the report2.php uses 2 configurations, one for "by Host" and another one for "by trigger template". Unfurtunately, there is a common identifier 'groupid', used in both configurations, but it has different meaning in the 2 configurations. More exactly, the value $_REQUEST['groupid'] gives you the host_groups.groupid for $config=0 and it returns the groups.groupid for $config=1. In the second case the SQL sentence should use the $_REQUEST['hostgroupid'], otherwise the filtering based on host_group is not applied.

        if(0 == $config){
        .......
        //this part is ok as $REQUEST['groupid'] is the valid host_groups.groupid for config=0
        if($_REQUEST['groupid'] > 0){
        $sql_where .= ' AND hg.groupid = '.$_REQUEST['groupid'];
        }
        }
        else{
        // here are the changes
        // check if $_REQUEST['hostgroupid'] is valid
        if(isset($_REQUEST['hostgroupid']))
        // if valid use it in sql sentence!!!!
        // for config=1 $_REQUEST['hostgroupid'] identifies the host_groups.groupid
        if($_REQUEST['hostgroupid'] > 0){
        $sql_whre.= 'AND hg.groupid = '.$_REQUEST['hostgroupid'];
        }

        I hope is more clear now.

        Comment

        Working...