SYNOPSIS

  use Zabbix::API::Graph;

  # TODO write the rest

DESCRIPTION

Handles \s-1CRUD\s0 for Zabbix graph objects.

This is a subclass of \*(C`Zabbix::API::CRUDE\*(C'.

METHODS

items([\s-1ITEMS\s0])

Trivial mutator for the gitems array.

push()

This method handles extraneous \*(C`item => Zabbix::API::Item\*(C' attributes in the gitems array, transforming them into \*(C`itemid\*(C' attributes, and pushing the items to the server if they don't exist already. The original item attributes are kept but hidden from the \*(C`CRUDE\*(C' \*(C`push\*(C' method, and restored after the \*(C`pull\*(C' method is called. This means you can put \*(C`Zabbix::API::Item\*(C' 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 \*(C`Zabbix::API::CRUDE\*(C'.

url([width => \s-1WIDTH\s0], [period => \s-1PERIOD\s0], [start_time => \s-1START_TIME\s0])

This method returns a \s-1URL\s0 to an image on the Zabbix server. The image of width \*(C`WIDTH\*(C' will represent the current graph, plotted for data starting at \*(C`START_TIME\*(C' (a \s-1UNIX\s0 timestamp) over \*(C`PERIOD\*(C' seconds. It uses the current connection's host name to guess what path to base the \s-1URL\s0 on. All three parameters are optional. If the current user agent has cookies enabled, you can even fetch the image directly, since your \s-1API\s0 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;

RELATED TO Zabbix::API::Graph…

Zabbix::API::CRUDE.

AUTHOR

Fabrice Gabolde <[email protected]>

COPYRIGHT AND LICENSE

Copyright (C) 2011 \s-1SFR\s0

This library is free software; you can redistribute it and/or modify it under the terms of the GPLv3.