-
Incident report
-
Resolution: Workaround proposed
-
Critical
-
None
-
3.2.6
-
None
-
Ubuntu Server 2016 LTS, Poweshell, Windows 10
Hi everybody,
I've made an script in powershell to add a automatically Host, Host Group, and more when I install zabbix agent in a server, that it is automated as well.
The problem is when I try to create a new host, specially when the API gets the ID of hostgroup, zabbix api only gets one number of the ID, for example if you put: groupid='40' the api will take only 4...
This problem restric to use only 1 digit (1 to 9).
Here is the code of the JSON request:
$params = @{
body = @{
jsonrpc= "2.0"
method= "host.create"
params= @{
host="test001"
interfaces = @
"groups"= @
}
"id"= 7
"auth"= $auth
} | ConvertTo-Json
uri = "example.zabix.com/api_jsonrpc.php"
headers = @
method = "Post"
}
$result = Invoke-WebRequest @params
echo $result | ConvertFrom-Json
And I Added a variable in the error to display the value of the ID received and this is the result:
PS C:\Users\user> echo $result | ConvertFrom-Json
jsonrpc
id error
------- ----- –
2.0 @
4
I sent 40 and I recived *GroupValue: 4*
Thanks people!