-
Notifications
You must be signed in to change notification settings - Fork 1
Home
mikeda edited this page Dec 19, 2011
·
3 revisions
Welcome to the ZabbixAPI.pm wiki!
Require: Zabbix 1.8 or later CPAN modules JSON LWP::UserAgent Data::Dumper
use ZabbixAPI;
### create an object and get authenticated
my $za = ZabbixAPI->new("http://127.0.0.1/zabbix/");
$za->auth("api_user", "api_password");
### To use "method.name" method, call method_name().
my $version = $za->apiinfo_version();
print "$version\n";
### The first argument is a reference of "params".
my $hosts = $za->host_get(
{
filter => {
host => [ 'test01', 'test02' ]
},
output => "extend"
}
);
for my $h (@$hosts){
print "host:". $h->{host} ." hostid:". $h->{hostid} ."\n";
}