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

NAME

Zabbix2::API::Action -- Zabbix action objects

SYNOPSIS

  use Zabbix2::API::Action qw/ACTION_EVENTSOURCE_TRIGGERS
      ACTION_EVAL_TYPE_AND
      ACTION_CONDITION_TYPE_TRIGGER_NAME
      ACTION_CONDITION_OPERATOR_LIKE
      ACTION_OPERATION_TYPE_MESSAGE/;
  
  # Create a trigger for demonstration purposes.
  my $new_trigger = Zabbix2::API::Trigger->new(
      root => $zabber,
      data => { description => 'Some Trigger',
                expression => '{Zabbix server:system.uptime.last(0)}<600', });
  
  # Get a random media type and user, also for demonstration purposes.
  my $any_media_type = $zabber->fetch_single('MediaType', params => { limit => 1 });
  my $any_user = $zabber->fetch_single('User', params => { limit => 1 });
  
  # Create a new action: every time the trigger 'Some Trigger' toggles
  # (from OK to PROBLEM or from PROBLEM to OK), send a message to the
  # user.  The message's contents will be determined from the action
  # data (default_msg => 1) and the message itself will be delivered,
  # over some media type that we previously picked randomly, to a random
  # user (id.).  Escalates every 2 minutes.
  
  my $new_action = Zabbix2::API::Action->new(
      root => $zabber,
      data => { name => 'Another Action',
                esc_period => 120,
                eventsource => ACTION_EVENTSOURCE_TRIGGERS,
                evaltype => ACTION_EVAL_TYPE_AND,
                conditions => [ { conditiontype => ACTION_CONDITION_TYPE_TRIGGER_NAME,
                                  operator => ACTION_CONDITION_OPERATOR_LIKE,
                                  value => 'Some Trigger' } ],
                operations => [ { operationtype => ACTION_OPERATION_TYPE_MESSAGE,
                                  opmessage => { default_msg => 1,
                                                 mediatypeid => $any_media_type->id },
                                  opmessage_usr => [ { userid => $any_user->id } ] } ]
      });
  
  $new_action->create;

DESCRIPTION

Handles CRUD for Zabbix action objects.

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

EXPORTS

Many many constants that don't seem to be documented anywhere; see source for a complete list.

Nothing is exported by default; you can use the tags :eventsources, :condition_types, :condition_operators, operation_types and eval_types (or import by name).

SEE ALSO

Zabbix2::API::CRUDE.

http://www.zabbix.com/documentation/1.8/complete#actions

AUTHOR

Fabrice Gabolde <fga@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2011, 2014 Devoteam

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