Hello All,
I couldn't find anything related to hosts.exists or something similar on zabbix 3.0 api.
I am trying to automate something like creating new hosts ( adding ) - just wanted to check if hosts exists before adding - so that duplicates doesn't happen - i have had the cases where two ip's are added in the past.
Any pointers are greatly helpful. Below is the sample code i am trying - doing things using PHP , and then calling curl for the url.
Thanks
I couldn't find anything related to hosts.exists or something similar on zabbix 3.0 api.
I am trying to automate something like creating new hosts ( adding ) - just wanted to check if hosts exists before adding - so that duplicates doesn't happen - i have had the cases where two ip's are added in the past.
Any pointers are greatly helpful. Below is the sample code i am trying - doing things using PHP , and then calling curl for the url.
Code:
#check is ip is matching
$h_request = array(
'jsonrpc' => '2.0',
'method' => 'host.get',
'params' => array(
'search' => array(
'ip' => '172.17.70.1',
),
),
'auth' => $auth,
);
#Get this host name matching atleast
$h_request = array(
'jsonrpc' => '2.0',
'method' => 'host.get',
'params' => array(
'search' => array(
'host' => 'server',
),
),
'auth' => $auth,
);
#Get this host name matching atleast using filter
$h_request = array(
'jsonrpc' => '2.0',
'method' => 'host.get',
'params' => array(
'filter' => array(
'host' => 'server',
),
),
'auth' => $auth,
);
Comment