SYNOPSIS

  use Zabbix::API::Trigger;

  # TODO write the rest

DESCRIPTION

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

This is a subclass of \*(C`Zabbix::API::CRUDE\*(C'; see there for inherited methods.

METHODS

collides()

Returns true if the trigger exists with this description, false otherwise.

hosts()

Accessor for a local \*(C`hosts\*(C' attribute, which it also sets from the server data when necessary (when it is not yet set, which happens when the trigger has just been fetched or immediately after a pull or push \*(-- this is because a trigger's notion of its host(s) is \*(L"whatever is referred to in the trigger expression\*(R"). The value returned is an arrayref of \*(C`Zabbix::API::Host\*(C' instances.

items()

Same as \*(C`hosts()\*(C', for items.

dependencies()

Same as \*(C`hosts()\*(C', for dependencies (which are \*(C`Trigger\*(C' instances).

add_dependency(\s-1DEPENDENCY\s0)

Add a dependency to this trigger. The dependency can be a trigger \s-1ID\s0 (an integer), or a \*(C`Zabbix::API::Trigger\*(C' instance.

remove_dependency(\s-1DEPENDENCY\s0)

Remove a dependency from this trigger. The dependency can be a trigger \s-1ID\s0 (an integer), or a \*(C`Zabbix::API::Trigger\*(C' instance. Unlike the web \s-1API\s0 method, this method removes a single dependency.

BUGS AND LIMITATIONS

The \*(C`expression\*(C' data attribute stored in \*(C`Zabbix::API::Trigger\*(C' instances is actually an expression \s-1ID\s0. This is what the web \s-1API\s0 returns. Expressions are also not mapped by the web \s-1API\s0, so this is all you get (well, you can get the list of hosts and items mentioned in the expression). If you plan on using this distribution to manipulate trigger expressions, a workaround is to have the trigger just use a calculated item in a very simple expression, since items work as expected.

Since the web \s-1API\s0 does not expose a method through which dependencies can be removed individually, the \*(C`remove_dependency\*(C' method works around this by deleting all dependencies then adding back the rest.

RELATED TO Zabbix::API::Trigger…

Zabbix::API::CRUDE.

AUTHOR

Fabrice Gabolde <[email protected]>

COPYRIGHT AND LICENSE

Copyright (C) 2011 Devoteam

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