Hello Everyone,
The problem is with the users in operations(in the Action).
This is the third time I am encountering this problem and at this point I do not know what is going on. The only way I found to fix it is to make fresh new Zabbix server install. Deleting all hosts,users,actions .. is not fixing the problem. Only fresh new install is fixing it.
I am developing small PHP app/module which uses Zabbix API. And at some point something is getting messed up inside the Zabbix DB. Any new user that I create cannot be assigned to any Action/Operations. When I try to associate the user with an Action, instead this user. it tries to add user Admin(id:1). I know that this sounds non-sense, but some association somewhere is getting messed up in the DB. If I have more than one user it fails to enter the record in the db, because it is duplicate(for user Admin(id:1)):
Application error. [data] => SQL statement execution has failed "INSERT INTO opmessage_usr (operationid,userid,opmessage_usrid) VALUES ('52','1','52')". ) [id] => 1 )
The API call is fine, because initially it works fine. But during the development and some errors here and there something in the DB is getting messed up and from there only fresh new install is fixing it.
Here is the call(but it fails for 'action.update' too):
$json=array(
"method"=>'action.create',
"params"=>array(
'name'=>$this->name,
'eventsource'=>$this->eventsource,
'esc_period'=>$this->esc_period,
'def_shortdata'=>$this->def_shortdata,
'def_longdata'=>$this->def_longdata,
'status'=>$this->status,
'filter'=>$this->filter,
'operations'=>$this->operations
),
"id"=>1
);
When the problem starts , it starts to fail in 'operations' -> 'opmessage_usr' part : $this->operations is :
Array (
[operationtype] => 0
[esc_period] => 0
[esc_step_from] => 1
[esc_step_to] => 2
[evaltype] => 0
[opmessage_usr] => Array ( [0] => 4 [1] => 5 [2] => 6 [3] => 15 [4] => 16 )
[opmessage] => Array ( [default_msg] => 1 [mediatypeid] => 1 ) )
So even that I am specifying that I want to use users with IDs 4,5,6,15,16 it tries to add only user with ID:1 and after the second entry fails with the SQL statement error , because the user is duplicate.
Any ideas why it would try to add user Admin(id:1) (instead the user with ID 4 as am I specifying)) ? Any ideas are very welcome.
Note: Like I said it must be some relationship in the DB, because after fresh new Zabbix server install everything works fine for a while, so the problem is not the API calls.
Thank you for any suggestions or ideas.
The problem is with the users in operations(in the Action).
This is the third time I am encountering this problem and at this point I do not know what is going on. The only way I found to fix it is to make fresh new Zabbix server install. Deleting all hosts,users,actions .. is not fixing the problem. Only fresh new install is fixing it.
I am developing small PHP app/module which uses Zabbix API. And at some point something is getting messed up inside the Zabbix DB. Any new user that I create cannot be assigned to any Action/Operations. When I try to associate the user with an Action, instead this user. it tries to add user Admin(id:1). I know that this sounds non-sense, but some association somewhere is getting messed up in the DB. If I have more than one user it fails to enter the record in the db, because it is duplicate(for user Admin(id:1)):
Application error. [data] => SQL statement execution has failed "INSERT INTO opmessage_usr (operationid,userid,opmessage_usrid) VALUES ('52','1','52')". ) [id] => 1 )
The API call is fine, because initially it works fine. But during the development and some errors here and there something in the DB is getting messed up and from there only fresh new install is fixing it.
Here is the call(but it fails for 'action.update' too):
$json=array(
"method"=>'action.create',
"params"=>array(
'name'=>$this->name,
'eventsource'=>$this->eventsource,
'esc_period'=>$this->esc_period,
'def_shortdata'=>$this->def_shortdata,
'def_longdata'=>$this->def_longdata,
'status'=>$this->status,
'filter'=>$this->filter,
'operations'=>$this->operations
),
"id"=>1
);
When the problem starts , it starts to fail in 'operations' -> 'opmessage_usr' part : $this->operations is :
Array (
[operationtype] => 0
[esc_period] => 0
[esc_step_from] => 1
[esc_step_to] => 2
[evaltype] => 0
[opmessage_usr] => Array ( [0] => 4 [1] => 5 [2] => 6 [3] => 15 [4] => 16 )
[opmessage] => Array ( [default_msg] => 1 [mediatypeid] => 1 ) )
So even that I am specifying that I want to use users with IDs 4,5,6,15,16 it tries to add only user with ID:1 and after the second entry fails with the SQL statement error , because the user is duplicate.
Any ideas why it would try to add user Admin(id:1) (instead the user with ID 4 as am I specifying)) ? Any ideas are very welcome.
Note: Like I said it must be some relationship in the DB, because after fresh new Zabbix server install everything works fine for a while, so the problem is not the API calls.
Thank you for any suggestions or ideas.
Comment