You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?php
require_once("../src/ZabbixApi.php");
use IntelliTrend\Zabbix\ZabbixApi;
use IntelliTrend\Zabbix\ZabbixApiException;
print "Zabbix API Example\n";
print " Connect to API, ignore certificate/hostname and get number of hosts\n";
print "=====================================================\n";
$zabUrl ='https://blah/zabbix';
$zabToken = '123456';
$zbx = new ZabbixApi();
try {
// disable verification of certificate and hostname
$options = array('sslVerifyPeer' => false, 'sslVerifyHost' => false);
$zbx->login($zabUrl, $zabToken,$options); <---- This looks like it only wants a password because of the $options.
$result = $zbx->getApiVersion();
print "Remote Zabbix API Version:$result\n";
// Get number of host available to this useraccount
$result = $zbx->call('host.get',array("countOutput" => true));
print "Number of Hosts:$result\n";
} catch (ZabbixApiException $e) {
print "==== Zabbix API Exception ===\n";
print 'Errorcode: '.$e->getCode()."\n";
print 'ErrorMessage: '.$e->getMessage()."\n";
exit;
} catch (Exception $e) {
print "==== Exception ===\n";
print 'Errorcode: '.$e->getCode()."\n";
print 'ErrorMessage: '.$e->getMessage()."\n";
exit;
}
Zabbix API Example
Connect to API, ignore certificate/hostname and get number of hosts
=====================================================
Remote Zabbix API Version:6.0.22
==== Zabbix API Exception ===
Errorcode: -32602
ErrorMessage: Invalid params. [Invalid parameter "/password": a character string is expected.]
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: