I'm working on a script to automatically create hosts. It works, and now I'm trying to get it to add the server to more than one group.
It only adds the server to the last group listed in the groups section.
Here is the code which is being used to create the host:
This is being done in bash
Json code is built up in a variable called $data:
{"jsonrpc":"2.0","method":"host.create","params":{ "host":"zabbix4loadtest.xxxxxxxxx.com","interfaces ":[{"type":1,"main":1,"ip":"192.168.102.222","dns":"z abbix4loadtest.kidbiz3000.com","port":10050,"useip ":0}],"groups":[{"groupid":7,"groupid":11,"groupid":4,"groupid":15 }],"templates":[{"templateid":10132}]},"auth":"0126382d673193f1759f6141275dbb91","id":0 }
and here is the code to do the call itself:
curl -i -X POST -H 'Content-Type: application/json-rpc' -d $data $API
Is this a limitation of the API? Or is it a bug?
Thanks in advance
JBB
It only adds the server to the last group listed in the groups section.
Here is the code which is being used to create the host:
This is being done in bash
Json code is built up in a variable called $data:
{"jsonrpc":"2.0","method":"host.create","params":{ "host":"zabbix4loadtest.xxxxxxxxx.com","interfaces ":[{"type":1,"main":1,"ip":"192.168.102.222","dns":"z abbix4loadtest.kidbiz3000.com","port":10050,"useip ":0}],"groups":[{"groupid":7,"groupid":11,"groupid":4,"groupid":15 }],"templates":[{"templateid":10132}]},"auth":"0126382d673193f1759f6141275dbb91","id":0 }
and here is the code to do the call itself:
curl -i -X POST -H 'Content-Type: application/json-rpc' -d $data $API
Is this a limitation of the API? Or is it a bug?
Thanks in advance
JBB
Comment