[ZBX-16619] SQL statement execution when call item.create method via API Created: 2019 Sep 10 Updated: 2019 Sep 24 |
|
Status: | Need info |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | API (A) |
Affects Version/s: | 4.0.12 |
Fix Version/s: | None |
Type: | Incident report | Priority: | Trivial |
Reporter: | Dmitry | Assignee: | Zabbix Development Team |
Resolution: | Unresolved | Votes: | 0 |
Labels: | None | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
OS: Centos 7.x |
Description |
When I'm trying to create item for the host via API, I'm get the following error: {{{}} I try to do it via bash script with POST curl request. I use the following curl cmd options: curl -s -k -X POST -H "Content-Type:application/json" --data "$ZabbixAPIRequest" "$ZBX_API_URL" where: $ZabbixAPIRequest - variable, which contain the following JSON {{{}} $ZBX_API_URL - https://zabbix.....com/api_jsonrpc.php - URL to zabbix API on our server I've successfully created host, application for newly created host, user's macroses , first, before attempt of create item.
|
Comments |
Comment by Dmitry [ 2019 Sep 11 ] |
Update. Using json for request, such as post before cause the following SQL error: 2019-09-11 05:46:28.445 UTC >ОШИБКА: нулевое значение в столбце "params" нарушает ограничение NOT NULL
In other words, API when it generates SQL request, substitutes on "null" instead of "empty string" for undefined clearly params.
|
Comment by Alexander Vladishev [ 2019 Sep 24 ] |
PostgreSQL DB schema contain default value for "params" field. Perhaps your database schema is different. Please check. CREATE TABLE items ( itemid bigint NOT NULL, type integer DEFAULT '0' NOT NULL, snmp_community varchar(64) DEFAULT '' NOT NULL, snmp_oid varchar(512) DEFAULT '' NOT NULL, hostid bigint NOT NULL, name varchar(255) DEFAULT '' NOT NULL, key_ varchar(255) DEFAULT '' NOT NULL, ... params text DEFAULT '' NOT NULL, <-- Default value for this field is empty string ... allow_traps integer DEFAULT '0' NOT NULL, PRIMARY KEY (itemid) ); |