Hi everyone,
I got a problem using the api to add a host entry.
I am using the pyZabbix api for python.
My problem is the host seems to be created but he is not.
I receive the JSON response with a return code 200 (OK) and the hostid of the (normally) created host. But it doesn't appear in the zabbix frontend. If i try to execute my python script several times it always return the same hostid (normal, because he can't create it he doesn't increment it).
Here is the Json sent :
and the json received :
Did someone encounter a similar problem ?
Thank you for you help.
I got a problem using the api to add a host entry.
I am using the pyZabbix api for python.
My problem is the host seems to be created but he is not.
I receive the JSON response with a return code 200 (OK) and the hostid of the (normally) created host. But it doesn't appear in the zabbix frontend. If i try to execute my python script several times it always return the same hostid (normal, because he can't create it he doesn't increment it).
Here is the Json sent :
Code:
Sending: {
"params": {
"interfaces": [
{
"ip": "x.x.x.x",
"useip": 0,
"dns": "srv.my.domain",
"main": 1,
"type": 1,
"port": "10050"
}
],
"host": "srv.my.domain",
"name": "srv",
"groups": [
{
"groupid": "9"
}
],
"inventory": [
{
"inventory_mode": 1
}
]
},
"jsonrpc": "2.0",
"method": "host.create",
"auth": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"id": 2
}
Code:
Response Code: 200
Response Body: {
"jsonrpc": "2.0",
"result": {
"hostids": [
"10255"
]
},
"id": 2
}
Did someone encounter a similar problem ?
Thank you for you help.
Comment