Skip to content

Instantly share code, notes, and snippets.

@manoot
Created January 26, 2012 19:19
Show Gist options
  • Save manoot/1684496 to your computer and use it in GitHub Desktop.
Save manoot/1684496 to your computer and use it in GitHub Desktop.
ZabbixAPI::debugEnabled(TRUE);
ZabbixAPI::login($z_server,$z_user,$z_pass)
or die('Unable to login: '.print_r(ZabbixAPI::getLastError(),true));
$hosts = ZabbixAPI::fetch_array('host','get',array('extendoutput'=>1,'filter'=>array('host'=>$site,'select_graphs')))
or die('Unable to get hostids: '.print_r(ZabbixAPI::getLastError(),true));
echo "Hosts: ".print_r($hosts, true)."\n<br>";
# OUTPUT
Time Period: Hour
Please wait while I generate your report, you will be forwarded automatically upon completion
Hosts: Array ( [0] => Array ( [maintenances] => Array ( [0] => Array ( [maintenanceid] => 0 ) ) [hostid] => 10108 [proxy_hostid] => 0 [host] => HOST [dns] => [useip] => 1 [ip] => xx.xx.xx.xx [port] => 10050 [status] => 0 [disable_until] => 0 [error] => [available] => 0 [errors_from] => 0 [lastaccess] => 0 [inbytes] => 0 [outbytes] => 0 [useipmi] => 0 [ipmi_port] => 623 [ipmi_authtype] => -1 [ipmi_privilege] => 2 [ipmi_username] => [ipmi_password] => [ipmi_disable_until] => 0 [ipmi_available] => 0 [snmp_disable_until] => 0 [snmp_available] => 1 [maintenanceid] => 0 [maintenance_status] => 0 [maintenance_type] => 0 [maintenance_from] => 0 [ipmi_ip] => [ipmi_errors_from] => 0 [snmp_errors_from] => 0 [ipmi_error] => [snmp_error] => ) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment