Ad Widget

Collapse

Zabbix 1.7 Build 7334 -- web.nodes.switch_node Fix

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Palmertree
    Senior Member
    • Sep 2005
    • 746

    #1

    Zabbix 1.7 Build 7334 -- web.nodes.switch_node Fix

    In a DM environment, if a user switches between nodes, the current node keeps defaulting to value of 0 or the master node when a group is picked from the drop down list. Below is a patch to fix the issue.

    Code:
    diff -ruN php/include/profiles.inc.php php.updated/include/profiles.inc.php
    --- php/include/profiles.inc.php    2009-06-02 00:45:00.000000000 -0400
    +++ php.updated/include/profiles.inc.php    2009-06-02 00:44:31.000000000 -0400
    @@ -119,13 +119,13 @@
         if($value === false) return false;
     
         $sql_cond = '';
    -    if(zbx_numeric($idx2))     $sql_cond = ' AND idx2='.$idx2.' AND '.DBin_node('idx2');
    +    if(!$idx == "web.nodes.switch_node")     $sql_cond = ' AND '.DBin_node('profileid');
    +    if(zbx_numeric($idx2))     $sql_cond = $sql_cond.' AND idx2='.$idx2.' AND '.DBin_node('idx2');
     
         if(profile_type($type,'array')){
             $sql='DELETE FROM profiles '.
                 ' WHERE userid='.$USER_DETAILS['userid'].
                     ' AND idx='.zbx_dbstr($idx).
    -                ' AND '.DBin_node('profileid').
                     $sql_cond;
     
             DBstart();
    @@ -140,7 +140,6 @@
             $sql = 'SELECT profileid '.
                     ' FROM profiles '.
                     ' WHERE userid='.$USER_DETAILS['userid'].
    -                    ' AND '.DBin_node('profileid').
                         ' AND idx='.zbx_dbstr($idx).
                         $sql_cond;
                         
    @@ -176,7 +175,6 @@
                         ' source='.zbx_dbstr($src).
                     ' WHERE userid='.$USER_DETAILS["userid"].
                         ' AND idx='.zbx_dbstr($idx).
    -                    ' AND '.DBin_node('profileid').
                         $sql_cond;
     //if($idx == 'web.audit.filter.action') SDI($sql);
                 $result = DBexecute($sql);
    @@ -535,4 +533,4 @@
     return false;
     }
     /********** END USER FAVORITES ***********/
    -?>
    \ No newline at end of file
    +?>
  • Palmertree
    Senior Member
    • Sep 2005
    • 746

    #2
    Found an error in the latest trunk version 7383 for update_user_profile function.

    ' AND idx='.zbx_dbstr($idx).

    Code:
    diff -ruN zabbix-original/frontends/php/include/profiles.inc.php zabbix/frontends/php/include/profiles.inc.php
    --- zabbix-original/frontends/php/include/profiles.inc.php      2009-06-04 20:20:12.000000000 -0400
    +++ zabbix/frontends/php/include/profiles.inc.php       2009-06-08 23:04:17.000000000 -0400
    @@ -140,11 +139,11 @@
    
            }
            else{
    -               $sql = 'SELECT profileid '.
    -                               ' FROM profiles '.
    -                               ' WHERE userid='.$USER_DETAILS['userid'].
    -                                       ' AND '.DBin_node('profileid').
    -                                       $sql_cond;
    +                $sql = 'SELECT profileid '.
    +                                ' FROM profiles '.
    +                                ' WHERE userid='.$USER_DETAILS['userid'].
    +                                        ' AND idx='.zbx_dbstr($idx).
    +                                        $sql_cond;
    
                    $row = DBfetch(DBselect($sql));
    Last edited by Palmertree; 09-06-2009, 06:30.

    Comment

    • Aly
      ZABBIX developer
      • May 2007
      • 1126

      #3
      Yeap, it's fixed! Thank you.
      Zabbix | ex GUI developer

      Comment

      • Palmertree
        Senior Member
        • Sep 2005
        • 746

        #4
        Found an issue where the drops downs are not remember for a user if they are not on the primary node. To fix this we added the following patch so that select_profile reads in the right profileid for the correct nodeid.

        Code:
        diff -ruN zabbix-original/frontends/php/include/profiles.inc.php zabbix/frontends/php/include/profiles.inc.php
        --- zabbix-original/frontends/php/include/profiles.inc.php      2009-06-10 08:55:30.000000000 -0400
        +++ zabbix/frontends/php/include/profiles.inc.php       2009-06-11 22:06:22.000000000 -0400
        @@ -37,6 +37,7 @@
                        $sql = 'SELECT value_id, value_int, value_str, type '.
                                        ' FROM profiles '.
                                        ' WHERE userid='.$USER_DETAILS["userid"].
        +                                       ' AND '.DBin_node('profileid').
                                                ' AND idx='.zbx_dbstr($idx).
                                                $sql_cond.
                                        ' ORDER BY profileid ASC';
        @@ -79,6 +80,7 @@
                        $sql = 'SELECT value_id,value_int,value_str,source,type '.
                                        ' FROM profiles '.
                                        ' WHERE userid='.$USER_DETAILS["userid"].
        +                                       ' AND '.DBin_node('profileid').
                                                ' AND idx='.zbx_dbstr($idx).
                                                $sql_cond.
                                        ' ORDER BY profileid ASC';

        Comment

        Working...