Zabbix::API::Graph -- Zabbix graph objects
use Zabbix::API::Graph; # TODO write the rest
Handles CRUD for Zabbix graph objects.
This is a subclass of Zabbix::API::CRUDE.
Zabbix::API::CRUDE
Trivial mutator for the gitems array.
This method handles extraneous item => Zabbix::API::Item attributes in the gitems array, transforming them into itemid attributes, and pushing the items to the server if they don't exist already. The original item attributes are kept but hidden from the CRUDE push method, and restored after the pull method is called.
item => Zabbix::API::Item
itemid
CRUDE
push
pull
This means you can put Zabbix::API::Item objects in your data and the module will Do The Right Thing (assuming you agree with my definition of the Right Thing). Items that have been created this way will not be removed from the server if they are removed from the graph, however.
Zabbix::API::Item
Overriden from Zabbix::API::CRUDE.
This method returns a URL to an image on the Zabbix server. The image of width WIDTH will represent the current graph, plotted for data starting at START_TIME (a UNIX timestamp) over PERIOD seconds. It uses the current connection's host name to guess what path to base the URL on.
WIDTH
START_TIME
PERIOD
All three parameters are optional.
If the current user agent has cookies enabled, you can even fetch the image directly, since your API session is completely valid for all regular requests:
my $zabbix = Zabbix::API->new(server => ..., ua => LWP::UserAgent->new(cookie_jar => { file => 'cookie.jar' }), ...); my $graph = $zabbix->fetch_single('Graph', ...); my $response = $zabbix->{ua}->get($graph->url); open my $image, '>', 'graph.png' or die $!; $image->print($response->decoded_content); $image->close;
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.