Here is the debug message, that appears after I turn on debuging for Zabbix API user:
In create_host: Error: {"debug":[
{"function":"exception","args":[120,"You do not have permission to perform this operation"],"file":"/usr/share/zabbix/api/classes/class.ctriggerprototype.php","type":"::","class":"CZBXAPI","line":1581}
,{"function":"syncTemplates","args":[
{"templateids":"10049","hostids":"10052"}
],"file":"/usr/share/zabbix/api/classes/class.ctemplate.php","type":"->","class":"CTriggerPrototype","line":1892},
{"function":"link","args":[["10049"],["10052"]],"file":"/usr/share/zabbix/api/classes/class.ctemplate.php","type":"->","class":"CTemplate","line":1299}
,{"function":"massAdd","args":[{"hosts":[{"interfaces":[
{"dns":"noname_1.mysite.org","useip":1,"ip":"10.1.2.3","type":1,"port":10050,"main":1}
,
{"dns":"noname_1.mysite.org","useip":1,"ip":"10.1.2.3","type":2,"port":161,"main":1}
],"name":"noname_1.mysite.org","groups":[
{"groupid":"11"}
],"hostid":"10052","host":"noname_1.mysite.org","templates":[
{"templateid":"10049"}
]}],"templates":[
{"templateid":"10049"}
]}],"file":"/usr/share/zabbix/api/classes/class.chost.php","type":"->","class":"CTemplate","line":1630},{"function":"massAdd","args":[{"hosts":{"interfaces":[
{"dns":"noname_1.mysite.org","useip":1,"ip":"10.1.2.3","type":1,"port":10050,"main":1}
,
{"dns":"noname_1.mysite.org","useip":1,"ip":"10.1.2.3","type":2,"port":161,"main":1}
],"name":"noname_1.mysite.org","groups":[
{"groupid":"11"}
],"hostid":"10052","host":"noname_1.mysite.org","templates":[
{"templateid":"10049"}
]},"interfaces":[
{"dns":"noname_1.mysite.org","useip":1,"ip":"10.1.2.3","type":1,"port":10050,"main":1}
,
{"dns":"noname_1.mysite.org","useip":1,"ip":"10.1.2.3","type":2,"port":161,"main":1}
],"templates":[
{"templateid":"10049"}
]}],"file":"/usr/share/zabbix/api/classes/class.chost.php","type":"->","class":"CHost","line":1512},{"function":"create","args":[{"interfaces":[
{"dns":"noname_1.mysite.org","useip":1,"ip":"10.1.2.3","type":1,"port":10050,"main":1}
,
{"dns":"noname_1.mysite.org","useip":1,"ip":"10.1.2.3","type":2,"port":161,"main":1}
],"groups":[
{"groupid":"11"}
],"host":"noname_1.mysite.org","templates":[
{"templateid":"10049"}
]}],"type":"->","class":"CHost"},{"function":"call_user_func","args":[[{},"create"],{"interfaces":[
{"dns":"noname_1.mysite.org","useip":1,"ip":"10.1.2.3","type":1,"port":10050,"main":1}
,
{"dns":"noname_1.mysite.org","useip":1,"ip":"10.1.2.3","type":2,"port":161,"main":1}
],"groups":[
{"groupid":"11"}
],"host":"noname_1.mysite.org","templates":[
{"templateid":"10049"}
]}],"file":"/usr/share/zabbix/api/rpc/class.czbxrpc.php","line":105},{"function":"callAPI","args":["host.create",{"interfaces":[
{"dns":"noname_1.mysite.org","useip":1,"ip":"10.1.2.3","type":1,"port":10050,"main":1}
,
{"dns":"noname_1.mysite.org","useip":1,"ip":"10.1.2.3","type":2,"port":161,"main":1}
],"groups":[
{"groupid":"11"}
],"host":"noname_1.mysite.org","templates":[
{"templateid":"10049"}
]}],"file":"/usr/share/zabbix/api/rpc/class.czbxrpc.php","type":"::","class":"czbxrpc","line":63},{"function":"call","args":["host.create",{"interfaces":[
{"dns":"noname_1.mysite.org","useip":1,"ip":"10.1.2.3","type":1,"port":10050,"main":1}
,
{"dns":"noname_1.mysite.org","useip":1,"ip":"10.1.2.3","type":2,"port":161,"main":1}
],"groups":[
{"groupid":"11"}
],"host":"noname_1.mysite.org","templates":[
{"templateid":"10049"}
]},"7cc6b770a861fed3bb5a5363247741c7"],"file":"/usr/share/zabbix/api/rpc/class.cjsonrpc.php","type":"::","class":"czbxrpc","line":66},
{"function":"execute","args":[],"file":"/usr/share/zabbix/api_jsonrpc.php","type":"->","class":"CJSONrpc","line":54}
],"data":"You do not have permission to perform this operation","message":"Application error.","code":-32500}
|
I have tried to log in with API user account to Zabbix web interface and create a host with the same parameters. Here is the error message:
- Created: Item "ICMP Ping: задержка" on "myhost".
- Created: Trigger "Доступность по IP" on "myhost".
- pg_escape_string() expects parameter 1 to be string, array given [include/db.inc.php:631]
- pg_escape_string() expects parameter 1 to be string, array given [include/db.inc.php:631]
- pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: syntax error at or near "," LINE 1: ...name,oldvalue,newvalue) VALUES (9,77,'','hosts',Array,Array) ^ [include/db.inc.php:500]
- Error in query [INSERT INTO auditlog_details (auditdetailid,auditid,table_name,field_name,oldvalue,newvalue) VALUES (9,77,'','hosts',Array,Array)] [ERROR: syntax error at or near "," LINE 1: ...name,oldvalue,newvalue) VALUES (9,77,'','hosts',Array,Array) ^]
- Updated: Trigger "Доступность по IP" on "myhost".
- pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block [include/db.inc.php:430]
- Error in query [SELECT DISTINCT h.*,f.triggerid FROM hosts h,functions f,items i WHERE h.hostid BETWEEN 000000000000000 AND 099999999999999 AND h.status=3 AND (f.triggerid IN ('13215')) AND h.hostid=i.hostid AND f.itemid=i.itemid AND f.triggerid BETWEEN 000000000000000 AND 099999999999999] [ERROR: current transaction is aborted, commands ignored until end of transaction block]
- pg_fetch_assoc() expects parameter 1 to be resource, boolean given [include/db.inc.php:565]
- pg_free_result(): supplied argument is not a valid PostgreSQL result resource [include/db.inc.php:566]
- pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block [include/db.inc.php:430]
- Error in query [SELECT t.triggerid,t.description FROM triggers t WHERE t.triggerid BETWEEN 000000000000000 AND 099999999999999 AND ( (t.templateid IN ('13215')) AND (t.flags IN ('0','4')) )] [ERROR: current transaction is aborted, commands ignored until end of transaction block]
- pg_fetch_assoc() expects parameter 1 to be resource, boolean given [include/db.inc.php:565]
- pg_free_result(): supplied argument is not a valid PostgreSQL result resource [include/db.inc.php:566]
- pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block [include/db.inc.php:430]
- Error in query [SELECT DISTINCT h.hostid,h.name,f.triggerid FROM hosts h,functions f,items i WHERE 1=0 AND h.hostid=i.hostid AND f.itemid=i.itemid AND f.triggerid BETWEEN 000000000000000 AND 099999999999999 AND h.status I * Created: Item "ICMP Ping: задержка" on "myhost".
- Created: Trigger "Доступность по IP" on "myhost".
- pg_escape_string() expects parameter 1 to be string, array given [include/db.inc.php:631]
- pg_escape_string() expects parameter 1 to be string, array given [include/db.inc.php:631]
- pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: syntax error at or near "," LINE 1: ...name,oldvalue,newvalue) VALUES (9,77,'','hosts',Array,Array) ^ [include/db.inc.php:500]
- Error in query [INSERT INTO auditlog_details (auditdetailid,auditid,table_name,field_name,oldvalue,newvalue) VALUES (9,77,'','hosts',Array,Array)] [ERROR: syntax error at or near "," LINE 1: ...name,oldvalue,newvalue) VALUES (9,77,'','hosts',Array,Array) ^]
- Updated: Trigger "Доступность по IP" on "myhost".
- pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block [include/db.inc.php:430]
- Error in query [SELECT DISTINCT h.*,f.triggerid FROM hosts h,functions f,items i WHERE h.hostid BETWEEN 000000000000000 AND 099999999999999 AND h.status=3 AND (f.triggerid IN ('13215')) AND h.hostid=i.hostid AND f.itemid=i.itemid AND f.triggerid BETWEEN 000000000000000 AND 099999999999999] [ERROR: current transaction is aborted, commands ignored until end of transaction block]
- pg_fetch_assoc() expects parameter 1 to be resource, boolean given [include/db.inc.php:565]
- pg_free_result(): supplied argument is not a valid PostgreSQL result resource [include/db.inc.php:566]
- pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block [include/db.inc.php:430]
- Error in query [SELECT t.triggerid,t.description FROM triggers t WHERE t.triggerid BETWEEN 000000000000000 AND 099999999999999 AND ( (t.templateid IN ('13215')) AND (t.flags IN ('0','4')) )] [ERROR: current transaction is aborted, commands ignored until end of transaction block]
- pg_fetch_assoc() expects parameter 1 to be resource, boolean given [include/db.inc.php:565]
- pg_free_result(): supplied argument is not a valid PostgreSQL result resource [include/db.inc.php:566]
- pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block [include/db.inc.php:430]
- Error in query [SELECT DISTINCT h.hostid,h.name,f.triggerid FROM hosts h,functions f,items i WHERE 1=0 AND h.hostid=i.hostid AND f.itemid=i.itemid AND f.triggerid BETWEEN 000000000000000 AND 099999999999999 AND h.status IN (0,1,3)] [ERROR: current transaction is aborted, commands ignored until end of transaction block]
- pg_fetch_assoc() expects parameter 1 to be resource, boolean given [include/db.inc.php:565]
- pg_free_result(): supplied argument is not a valid PostgreSQL result resource [include/db.inc.php:566]
- pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block [include/db.inc.php:430]
- Error in query [SELECT DISTINCT t.triggerid,t.templateid,i.hostid FROM triggers t,functions f,items i WHERE t.triggerid BETWEEN 000000000000000 AND 099999999999999 AND (i.hostid IN ('10049')) AND f.triggerid=t.triggerid AND f.itemid=i.itemid AND ( (t.flags IN ('0','4')) )] [ERROR: current transaction is aborted, commands ignored until end of transaction block]
- pg_fetch_assoc() expects parameter 1 to be resource, boolean given [include/db.inc.php:565]
- pg_free_result(): supplied argument is not a valid PostgreSQL result resource [include/db.inc.php:566]
- pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block [include/db.inc.php:430]
- Error in query [SELECT td.triggerid_up,td.triggerid_down FROM trigger_depends td WHERE 1=0 ] [ERROR: current transaction is aborted, commands ignored until end of transaction block]
- pg_fetch_assoc() expects parameter 1 to be resource, boolean given [include/db.inc.php:565]
- pg_free_result(): supplied argument is not a valid PostgreSQL result resource [include/db.inc.php:566]
- pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block [include/db.inc.php:430]
- Error in query [SELECT DISTINCT t.triggerid,h.name AS hostname,h.host,h.hostid FROM triggers t,functions f,items i,hosts h WHERE t.triggerid BETWEEN 000000000000000 AND 099999999999999 AND 1=0 AND ( (t.flags IN ('0','4')) ) AND f.triggerid=t.triggerid AND f.itemid=i.itemid AND h.hostid=i.hostid] [ERROR: current transaction is aborted, commands ignored until end of transaction block]
- pg_fetch_assoc() expects parameter 1 to be resource, boolean given [include/db.inc.php:565]
- pg_free_result(): supplied argument is not a valid PostgreSQL result resource [include/db.inc.php:566]
- pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block [include/db.inc.php:430]
- Error in query [SELECT h.hostid FROM hosts h WHERE (h.hostid IN ('10052')) AND h.hostid BETWEEN 000000000000000 AND 099999999999999 AND h.status IN (0,1,3)] [ERROR: current transaction is aborted, commands ignored until end of transaction block]
- pg_fetch_assoc() expects parameter 1 to be resource, boolean given [include/db.inc.php:565]
- pg_free_result(): supplied argument is not a valid PostgreSQL result resource [include/db.inc.php:566]
- You do not have permission to perform this operation [CHost.create -> CHost.massAdd -> CTemplate.massAdd -> CTemplate.link -> CTriggerPrototype.syncTemplates]N (0,1,3)] [ERROR: current transaction is aborted, commands ignored until end of transaction block]
- pg_fetch_assoc() expects parameter 1 to be resource, boolean given [include/db.inc.php:565]
- pg_free_result(): supplied argument is not a valid PostgreSQL result resource [include/db.inc.php:566]
- pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block [include/db.inc.php:430]
- Error in query [SELECT DISTINCT t.triggerid,t.templateid,i.hostid FROM triggers t,functions f,items i WHERE t.triggerid BETWEEN 000000000000000 AND 099999999999999 AND (i.hostid IN ('10049')) AND f.triggerid=t.triggerid AND f.itemid=i.itemid AND ( (t.flags IN ('0','4')) )] [ERROR: current transaction is aborted, commands ignored until end of transaction block]
- pg_fetch_assoc() expects parameter 1 to be resource, boolean given [include/db.inc.php:565]
- pg_free_result(): supplied argument is not a valid PostgreSQL result resource [include/db.inc.php:566]
- pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block [include/db.inc.php:430]
- Error in query [SELECT td.triggerid_up,td.triggerid_down FROM trigger_depends td WHERE 1=0 ] [ERROR: current transaction is aborted, commands ignored until end of transaction block]
- pg_fetch_assoc() expects parameter 1 to be resource, boolean given [include/db.inc.php:565]
- pg_free_result(): supplied argument is not a valid PostgreSQL result resource [include/db.inc.php:566]
- pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block [include/db.inc.php:430]
- Error in query [SELECT DISTINCT t.triggerid,h.name AS hostname,h.host,h.hostid FROM triggers t,functions f,items i,hosts h WHERE t.triggerid BETWEEN 000000000000000 AND 099999999999999 AND 1=0 AND ( (t.flags IN ('0','4')) ) AND f.triggerid=t.triggerid AND f.itemid=i.itemid AND h.hostid=i.hostid] [ERROR: current transaction is aborted, commands ignored until end of transaction block]
- pg_fetch_assoc() expects parameter 1 to be resource, boolean given [include/db.inc.php:565]
- pg_free_result(): supplied argument is not a valid PostgreSQL result resource [include/db.inc.php:566]
- pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block [include/db.inc.php:430]
- Error in query [SELECT h.hostid FROM hosts h WHERE (h.hostid IN ('10052')) AND h.hostid BETWEEN 000000000000000 AND 099999999999999 AND h.status IN (0,1,3)] [ERROR: current transaction is aborted, commands ignored until end of transaction block]
- pg_fetch_assoc() expects parameter 1 to be resource, boolean given [include/db.inc.php:565]
- pg_free_result(): supplied argument is not a valid PostgreSQL result resource [include/db.inc.php:566]
- You do not have permission to perform this operation [CHost.create -> CHost.massAdd -> CTemplate.massAdd -> CTemplate.link -> CTriggerPrototype.syncTemplates]
Host creation succeeds without linking a host to template both through JSON RPC and web interface. So the problem actually is linking templates to hosts.
|