Zabbix::ServerScript::API - Implementation of Zabbix JSON-RPC 2.0 API.
#!/usr/bin/perl use strict; use warnings; use utf8; use Getopt::Long qw(:config bundling); use Zabbix::ServerScript; my $opt = { unique => 1, api => q(rw), }; my @opt_specs = qw( verbose|v+ debug console ); sub main { GetOptions($opt, @opt_specs); Zabbix::ServerScript::init($opt); my $host = $zx_api->host_get({ filter => { host => q(Zabbix server), }, }); Zabbix::ServerScript::return_value($host->[0]->{hostid}); } main();
Zabbix::ServerScript::API is a pure-perl implementation of Zabbix JSON-RPC 2.0 API. It is meant to be used as a part of Zabbix::ServerScript module.
Performs login to Zabbix with choosen credentials and returns an object of Zabbix::ServerScript::API.
Any "foo_bar" method of this object will be transformed to "foo.bar" request to Zabbix API and return result of this request as a Perl structure.
Copyright (C) Anton Alekseyev.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Anton Alekseyev <akint.wr+github@gmail.com>
To install Zabbix::ServerScript, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Zabbix::ServerScript
CPAN shell
perl -MCPAN -e shell install Zabbix::ServerScript
For more information on module installation, please visit the detailed CPAN module installation guide.