Provided by: libzabbix-api-perl_0.009-1_all
NAME
Zabbix::API::Graph -- Zabbix graph objects
SYNOPSIS
use Zabbix::API::Graph; # TODO write the rest
DESCRIPTION
Handles CRUD for Zabbix graph objects. This is a subclass of "Zabbix::API::CRUDE".
METHODS
items([ITEMS]) Trivial mutator for the gitems array. push() 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. 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. Overriden from "Zabbix::API::CRUDE". url([width => WIDTH], [period => PERIOD], [start_time => START_TIME]) 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. 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;
SEE ALSO
Zabbix::API::CRUDE.
AUTHOR
Fabrice Gabolde <fabrice.gabolde@uperto.com>
COPYRIGHT AND LICENSE
Copyright (C) 2011 SFR This library is free software; you can redistribute it and/or modify it under the terms of the GPLv3.