-
Notifications
You must be signed in to change notification settings - Fork 1
/
example1.pl
40 lines (33 loc) · 832 Bytes
/
example1.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use ZabbixAPI;
my $za = ZabbixAPI->new("http://127.0.0.1/zabbix/");
$za->login("USER", "PASSWORD");
#$ZabbixAPI::DEBUG = 1;
print Dumper $za->apiinfo_version();
#@response
#$VAR1 = '1.3';
print Dumper $za->hostgroup_get({output => "extend"});
#@response
#$VAR1 = [
# {
# 'name' => 'Templates',
# 'groupid' => '1',
# 'internal' => '0'
# },
# ...
print Dumper $za->hostgroup_get({output => "extend"}, 'name');
#@response
#$VAR1 = [
# 'Templates',
# 'Linux servers',
# ...
print Dumper $za->hostgroup_get({output => "extend"}, 'groupid', 'name');
#@response
#$VAR1 = {
# '3' => 'Windows servers',
# '2' => 'Linux servers',
# '1' => 'Templates',
# ...