Zabbix::API::Item -- Zabbix item objects
use Zabbix::API::Item qw/:item_types/; # fetch a single item... my $item = $zabbix->fetch('Item', params => { filter => { itemid => 22379 } })->[0]; # manipulate its properties... $item->data->{multiplier} = 3; # and update the properties on the server. $item->push; # fetch all items from a host my $host = $zabbix->fetch('Host', params => { filter => { hostid => 10105 } })->[0]; my $items = $host->items; # create a new item my $new_item = Zabbix::API::Item->new( root => $zabbix, data => { type => ITEM_TYPE_SNMPV2C, value_type => ITEM_VALUE_TYPE_UINT64, snmp_oid => ..., snmp_community => ..., # that's right, key_ key_ => 'mynewitem', # so far the following is the only way to create a "item belongs # to host" relationship hostid => $host->id, }); # an itemid will be generated if the item does not already exist $new_item->push;
Handles CRUD for Zabbix item objects.
This is a subclass of Zabbix::API::CRUDE; see there for inherited methods.
Zabbix::API::CRUDE
Returns true if the item exists with this key on this hostid, false otherwise.
Accessor for a local host attribute, which it also happens to set from the server data if it isn't set already. The host is an instance of Zabbix::API::Host.
host
Zabbix::API::Host
Like host(), returning an arrayref of Zabbix::API::Graph instances in which this item is involved.
host()
Zabbix::API::Graph
Accessor for the item's history data. Calling this method does not store the history data into the object, unlike other accessors. History data is an AoH:
[ { itemid => ITEMID, clock => UNIX_TIMESTAMP, value => VALUE }, ... ]
PARAMS should be a hash containing arguments for the history.get method (see here: http://www.zabbix.com/documentation/1.8/api/history/get). The time_from and time_till keys (with UNIX timestamps as values) are mandatory. The itemids and output parameters are already set and cannot be overwritten by the contents of PARAMS.
PARAMS
history.get
itemids
output
Mutator for the item's delay value; that is, the polling period in seconds. This is just a shortcut to set delay in the data hashref. The method doesn't call pull() or push(), you need to do it manually.
delay
data
pull()
push()
Returns the newly-set value.
Way too many constants, but for once they're documented (here: http://www.zabbix.com/documentation/1.8/api/item/constants).
Nothing is exported by default; you can use the tags :item_types, :value_types, :data_types and :status_types (or import by name).
:item_types
:value_types
:data_types
:status_types
This is probably because of the extremely smart way the Zabbix team has set up their database schema, but what you'd expect to be "key" in an item's data is actually "key_".
"key"
"key_"
Zabbix::API::CRUDE.
Fabrice Gabolde <fabrice.gabolde@uperto.com>
Copyright (C) 2011 SFR
This library is free software; you can redistribute it and/or modify it under the terms of the GPLv3.
To install Zabbix::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Zabbix::API
CPAN shell
perl -MCPAN -e shell install Zabbix::API
For more information on module installation, please visit the detailed CPAN module installation guide.