Zabbix2::API::Host -- Zabbix host objects
use Zabbix2::API::Host; # fetch a single host by ID my $host = $zabbix->fetch_single('Host', params => { hostids => [ 10105 ] }); # and delete it $host->delete; # helpers -- these all fire an API call my $items = $host->items; my $hostgroups = $host->hostgroups; my $graphs = $host->graphs; my $templates = $host->templates; # this one doesn't my $interfaces = $host->interfaces; # create a new host and its interfaces in one fell swoop 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;
Handles CRUD for Zabbix host objects.
This is a subclass of Zabbix2::API::CRUDE; see there for inherited methods.
Zabbix2::API::CRUDE
(read-only arrayref of Zabbix2::API::Graph objects)
This attribute is lazily populated with the host's graphs from the server.
(read-only arrayref of Zabbix2::API::HostGroup objects)
This attribute is lazily populated with the host's hostgroups from the server.
(read-write arrayref of Zabbix2::API::HostInterface instances)
This attribute is populated automatically from the "interfaces" server property when the Perl object is updated (i.e. when the pull method is called).
pull
Likewise, it is automatically used to populate the "interfaces" property before either create or update are called.
create
update
Note that "interfaces" is a required property as far as the server is concerned, so you must define it one way or another.
You can add interfaces by pushing new Zabbix2::API::HostInterface objects onto this arrayref and then calling $host->update, or by instantiating interface objects with the hostid property set and calling $interface->create.
$host->update
hostid
$interface->create
(read-only arrayref of Zabbix2::API::Item objects)
This attribute is lazily populated with the host's items from the server.
(read-write arrayref of Zabbix2::API::Template instances)
This attribute is lazily-populated with the host's templates from the server.
Zabbix2::API::CRUDE.
Fabrice Gabolde <fga@cpan.org>, Sujit Sali <sali.sujit@gmail.com>
Copyright (C) 2011, 2014 SFR
This library is free software; you can redistribute it and/or modify it under the terms of the GPLv3.
To install Zabbix2::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Zabbix2::API
CPAN shell
perl -MCPAN -e shell install Zabbix2::API
For more information on module installation, please visit the detailed CPAN module installation guide.