NAME

Zabbix2::API::HostInterface -- Zabbix host interface objects

SYNOPSIS

# create it with the host
my $new_host = Zabbix2::API::Host->new(
    root => $zabbix,
    data => {
        host => 'the internal zabbix hostname',
        name => 'the name displayed in most places',
        groups => [ { groupid => 4 } ],
        interfaces => [
            { dns => 'some hostname',
              ip => '',
              useip => 0,
              main => 1,
              port => 10000,
              type => Zabbix2::API::HostInterface::INTERFACE_TYPE_AGENT,
            } ] });
$new_host->create;

# create it later
my $new_interface = Zabbix2::API::HostInterface->new(
    dns => 'some other hostname',
    ip => '',
    useip => 0,
    main => 1,
    port => 10001,
    type => Zabbix2::API::HostInterface::INTERFACE_TYPE_AGENT,
    hostid => $new_host->id);
$new_interface->create;

DESCRIPTION

While technically a subclass of Zabbix2::API::CRUDE, this class does not actually implement all methods necessary to behave as a full-fledged Zabbix object. Instead, we recommend using Zabbix2::API::HostInterface objects via their parent Zabbix2::API::Host object. Calls to unimplemented methods will throw an exception.

Unlike Zabbix2::API::GraphItem objects, for which the usual API methods are not all implemented on the server, this is mostly a case of laziness of our part, so patches are welcome.

Zabbix2::API::HostInterface objects will be automatically created from a Zabbix2::API::Host object's properties whenever it is pulled from the server. Conversely, if you add interfaces manually to a Zabbix2::API::Host object, the Zabbix2::API::HostInterface objects will be automatically turned into properties just before a call to create or update, causing the relevant host interface objects to be created or updated on the server.

EXPORTS

Some constants:

INTERFACE_TYPE_UNKNOWN
INTERFACE_TYPE_AGENT
INTERFACE_TYPE_SNMP
INTERFACE_TYPE_IPMI
INTERFACE_TYPE_JMX
INTERFACE_TYPE_ANY

They are not exported by default, only on request; or you could import the :interface_types tag.

SEE ALSO

Zabbix2::API::CRUDE, Zabbix2::API::Host

AUTHOR

Fabrice Gabolde <fga@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2014 Fabrice Gabolde

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.