Zabbix2::API::Action -- Zabbix action objects
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;
Handles CRUD for Zabbix action objects.
This is a subclass of Zabbix2::API::CRUDE; see there for inherited methods.
Zabbix2::API::CRUDE
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).
:eventsources
:condition_types
:condition_operators
operation_types
eval_types
Zabbix2::API::CRUDE.
http://www.zabbix.com/documentation/1.8/complete#actions
Fabrice Gabolde <fga@cpan.org>
Copyright (C) 2011, 2014 Devoteam
This library is free software; you can redistribute it and/or modify it under the terms of the GPLv3.
To install Zabbix2::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Zabbix2::API
CPAN shell
perl -MCPAN -e shell install Zabbix2::API
For more information on module installation, please visit the detailed CPAN module installation guide.