View on
MetaCPAN
Anton Alekseyev > Zabbix-ServerScript-0.13 > Zabbix::ServerScript::API

Download:
Zabbix-ServerScript-0.13.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Source   Latest Release: Zabbix-ServerScript-0.14

NAME ^

Zabbix::ServerScript::API - Implementation of Zabbix JSON-RPC 2.0 API.

SYNOPSIS ^

    #!/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();

DESCRIPTION ^

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.

SUBROUTINES ^

init($config_credential_section_name)

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.

LICENSE ^

Copyright (C) Anton Alekseyev.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR ^

Anton Alekseyev <akint.wr+github@gmail.com>

syntax highlighting: