-
Incident report
-
Resolution: Fixed
-
Minor
-
None
-
1.6.6
-
None
-
zabbix server: CentOS5.6
zabbix agent: CentOS5.6
MySQL
I displayed screen, but it was not displayed after having upgraded it from 1.4.6 with 1.6.6 even if it passed for 30 minutes.
Because a CPU useage of MySQL was high, I confirmed what run.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
mysql> show processlist;
-------------------------------------------------------------------------------------------------------------------------------------------------------------+
Id | User | Host | db | Command | Time | State | Info |
-------------------------------------------------------------------------------------------------------------------------------------------------------------+
3 | zabbix | localhost | zabbix | Query | 0 | end | UPDATE ids SET nextid=nextid+1 WHERE nodeid=0 AND table_name='profiles' AND field_name='profileid' |
4 | zabbix | localhost | zabbix | Sleep | 78 | NULL | |
5 | zabbix | localhost | zabbix | Query | 0 | Updating | UPDATE ids SET nextid=nextid+1 WHERE nodeid=0 AND table_name='profiles' AND field_name='profileid' |
6 | zabbix | localhost | zabbix | Sleep | 23 | NULL | |
7 | zabbix | localhost | zabbix | Sleep | 205 | NULL | |
8 | zabbix | localhost | zabbix | Sleep | 13 | NULL | |
9 | zabbix | localhost | zabbix | Sleep | 317 | NULL | |
10 | zabbix | localhost | zabbix | Sleep | 706 | NULL | |
11 | zabbix | localhost | zabbix | Sleep | 5 | NULL | |
12 | zabbix | localhost | zabbix | Sleep | 76 | NULL | |
13 | zabbix | localhost | zabbix | Sleep | 3 | NULL | |
14 | zabbix | localhost | zabbix | Sleep | 868 | NULL | |
15 | zabbix | localhost | zabbix | Sleep | 868 | NULL | |
16 | zabbix | localhost | zabbix | Sleep | 3 | NULL | |
17 | zabbix | localhost | zabbix | Sleep | 3 | NULL | |
18 | zabbix | localhost | zabbix | Sleep | 5 | NULL | |
19 | zabbix | localhost | zabbix | Sleep | 2 | NULL | |
20 | zabbix | localhost | zabbix | Query | 1 | Copying to tmp table | select i.itemid,i.key_,h.host,h.port,i.delay,i.description,i.nextcheck,i.type,i.snmp_community,i.snm |
23 | zabbix | localhost | zabbix | Sleep | 2 | NULL | |
25 | zabbix | localhost | zabbix | Sleep | 267 | NULL | |
27 | zabbix | localhost | zabbix | Sleep | 1 | NULL | |
28 | zabbix | localhost | zabbix | Sleep | 4 | NULL | |
31 | zabbix | localhost | zabbix | Query | 0 | Updating | UPDATE ids SET nextid=nextid+1 WHERE nodeid=0 AND table_name='profiles' AND field_name='profileid' |
33 | zabbix | localhost | zabbix | Query | 0 | Updating | UPDATE ids SET nextid=nextid+1 WHERE nodeid=0 AND table_name='profiles' AND field_name='profileid' |
34 | zabbix | localhost | zabbix | Sleep | 23 | NULL | |
35 | zabbix | localhost | zabbix | Query | 0 | Updating | UPDATE ids SET nextid=nextid+1 WHERE nodeid=0 AND table_name='profiles' AND field_name='profileid' |
67 | zabbix | localhost | zabbix | Query | 0 | Updating | UPDATE ids SET nextid=nextid+1 WHERE nodeid=0 AND table_name='profiles' AND field_name='profileid' |
163 | root | localhost | NULL | Query | 0 | NULL | show processlist |
-------------------------------------------------------------------------------------------------------------------------------------------------------------+
28 rows in set (0.01 sec)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
I think that DBstart() and DBend() are necessary.
\frontends\php\include\profiles.inc.php
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//----------- ADD/EDIT USERPROFILE -------------
function update_profile($idx,$value,$type=PROFILE_TYPE_UNKNOWN,$idx2=null,$source=null){
global $USER_DETAILS;
if($USER_DETAILS["alias"]==ZBX_GUEST_USER) return false;
if(profile_type($type,'unknown')) $type = profile_type_by_value($value);
else $value = profile_value_by_type($value,$type);
if($value === false) return false;
$sql_cond = '';
if(zbx_numeric($idx2)) $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).
$sql_cond;
DBstart(); <---- Here is DBstart()
DBexecute($sql);
foreach($value as $id => $val)
$result = DBend(); <---- Here is DBEnd()
}
else{
$sql = 'SELECT profileid '.
' FROM profiles '.
' WHERE userid='.$USER_DETAILS['userid'].
' AND idx='.zbx_dbstr($idx).
$sql_cond;
<---- DBstart() is necessary for here!
$row = DBfetch(DBselect($sql));
if(!$row)
{ $result = insert_profile($idx,$value,$type,$idx2,$source); } else{
$val = array();
$value_type = profile_field_by_type($type);
$val['value_id'] = 0;
$val['value_int'] = 0;
$val['value_str'] = '';
$val[$value_type] = $value;
$idx2 = zbx_numeric($idx2)?$idx2:0;
$src = is_null($source)?'':$source;
if(is_array($value))
{ $val[$value_type] = isset($value['value'])?$value['value']:''; $src = isset($value['source'])?$value['source']:$src; }if(is_null($val[$value_type])) return false;
$sql='UPDATE profiles '.
' SET value_id='.$val['value_id'].','.
' value_int='.$val['value_int'].','.
' value_str='.zbx_dbstr($val['value_str']).','.
' type='.$type.','.
' source='.zbx_dbstr($src).
' WHERE userid='.$USER_DETAILS["userid"].
' AND idx='.zbx_dbstr($idx).
$sql_cond;
$result = DBexecute($sql);
}
<---- DBend() is necessary for here!
}
return $result;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////