Ad Widget

Collapse

API problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rom1
    Junior Member
    • Feb 2020
    • 2

    #1

    API problem

    Zabbix (4.4.0rc1) worked in MySQL, and there was a script adding devices via API. Everything was working fine.
    I migrated from Mysql to PostgreSQL and the API stopped working properly.
    It gives out an error: Application error. SQL statement execution has failed

    Code:
    zabbix_add_object('Коммутаторы 01 мкрн [4]', 'TEST1228-8 [2086]', '', '0', '10.1.0.100', 'public', 'DES-1228')
    
    >>>>> To Zabbix >>> {"jsonrpc":"2.0","method":"hostgroup.get","params":{"filter":{"name":["\u041a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440\u044b 01 \u043c\u043a\u0440\u043d [4]"]},"output":"refer"},"id":1,"auth":"3b9c5abd4727e221a95c715c52b10
    <<< From Zabbix <<< {"jsonrpc":"2.0","result":[{"groupid":"66"}],"id":1}
    
    >>>>> To Zabbix >>> {"jsonrpc":"2.0","method":"host.get","params":{"filter":{"name":["TEST1228-8 [2086]"]},"output":"refer"},"id":2,"auth":"3b9c5abd4727e221a95c715c52b10868"}
    <<< From Zabbix <<< {"jsonrpc":"2.0","result":[],"id":2}
    
    >>>>> To Zabbix >>> {"jsonrpc":"2.0","method":"host.create","params":{"host":"10.1.0.100","name":"TEST1228-8 [2086]","interfaces":[{"type":1,"main":1,"useip":1,"ip":"10.1.0.100","dns":"","port":10050}],"groups":[{"groupid":"66"},{"groupid":99}]},"id":3,"a
    <<< From Zabbix <<< {"jsonrpc":"2.0","error":{"code":-32500,"message":"Application error.","data":"SQL statement execution has failed \"INSERT INTO hosts (host,name,hostid) VALUES ('10.1.0.100','TEST1228-8 [2086]','13684')\"."},"id":3}
    Application error. SQL statement execution has failed "INSERT INTO hosts (host,name,hostid) VALUES ('10.1.0.100','TEST1228-8 [2086]','13684')"
    Last edited by Rom1; 13-02-2020, 06:36.
  • Rom1
    Junior Member
    • Feb 2020
    • 2

    #2
    Resolved.

    Code:
                                               Таблица "zabbixdb.hosts"
          Столбец       |           Тип           | Правило сортировки | Допустимость NULL |     По умолчанию      
    --------------------+-------------------------+--------------------+-------------------+-----------------------
     description        | text                    |                    | not null          | 
    
    ALTER TABLE hosts ALTER COLUMN description SET DEFAULT '';

    Comment

    Working...