The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Zabbix2::API::Screen -- Zabbix screen objects

SYNOPSIS

  use Zabbix2::API::Screen;
  # initialize a screen object...
  my $screen = Zabbix2::API::Screen->new(root => $zabber,
                                         data => { name => 'This screen brought to you by Zabbix2::API' });
  
  # fetch a graph...
  my $graph = $zabber->fetch_single('Graph', params => { search => { name => 'CPU load' },
                                                         filter => { host => 'Zabbix Server' } });
  
  # put the graph in the screen...
  $screen->set_item_at($graph, 'x' => 0, 'y' => 0);
  
  # create the screen on the server
  $screen->create;

DESCRIPTION

Handles CRUD for Zabbix screen objects.

This is a subclass of Zabbix2::API::CRUDE; see there for inherited methods.

METHODS

get_item_at

  my $thing = $screen->get_item_at(x => $x, y => $y);

Returns the resource at the coordinates provided. If the resource's type is one of

Graph
Item
Map
Screen
HostGroup
Host

then this will cause the API to fetch the screen item's data and return it as a Zabbix2::API object (i.e. Zabbix2::API::Graph, etc.). Otherwise, a hashref of screen item properties will be returned; see the screen item documentation for details.

items

  my $all_the_things = $screen->items;

Like get_item_at, but for all of the screen's items. This causes one API method call for each resource that can be mapped.

set_item_at

  $screen->set_item_at($thing, x => $x, y => $y, %other_opts);
  $screen->update;

Sets the resource to be displayed at the coordinates provided. The first argument should be either a hashref of screen item properties (see the screen item documentation) or an object of a class for which we have a mapping. The rest of the arguments should be a hash of screen item properties. The screen's horizontal and vertical sizes will be modified to accomodate the new item's coordinates.

EXPORTS

A bunch of constants:

  SCREEN_RESOURCE_GRAPH
  SCREEN_RESOURCE_SIMPLE_GRAPH
  SCREEN_RESOURCE_MAP
  SCREEN_RESOURCE_PLAIN_TEXT
  SCREEN_RESOURCE_HOSTS_INFO
  SCREEN_RESOURCE_TRIGGERS_INFO
  SCREEN_RESOURCE_SERVER_INFO
  SCREEN_RESOURCE_CLOCK
  SCREEN_RESOURCE_SCREEN
  SCREEN_RESOURCE_TRIGGERS_OVERVIEW
  SCREEN_RESOURCE_DATA_OVERVIEW
  SCREEN_RESOURCE_URL
  SCREEN_RESOURCE_ACTIONS
  SCREEN_RESOURCE_EVENTS
  SCREEN_RESOURCE_HOSTGROUP_TRIGGERS
  SCREEN_RESOURCE_SYSTEM_STATUS
  SCREEN_RESOURCE_HOST_TRIGGERS

These are used to specify the type of resource to use in a screenitem. They are not exported by default, only on request; or you could import the :resources tag.

SEE ALSO

Zabbix2::API::CRUDE.

AUTHOR

Fabrice Gabolde <fga@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2011, 2014 SFR

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