Host Triggers
Example of usage:
>>> import activelogic as api
>>> conn = api.sync_connect(<IP or host name>, <user name>, <password>)
>>> ht = conn.hosttriggers()
>>> ht.add(api.HostTrigger(name='test', script='filename'))
45
>>> ht.list(api.HostTrigger)
[HostTrigger(name='test', id=45)]
>>> t = ht.list(api.HostTriggers)[0]
>>> t.in_bw
0
>>> ht.update(t, in_bw=7)
>>> t = ht.list(api.HostTriggers)[0]
>>> t.in_bw
7
>>> ht.list(api.HostTrigger)
[HostTrigger(name='test', id=45)]
>>> ht.remove(45)
>>> ht.list(api.HostTrigger)
[]
>>>
- class activelogic.HostTriggers
This is the resource for Host Triggers.
- async HostTriggers.list(cls)
Generic list function for all kinds of data that belong to this resource.
- Parameters:
cls – An object dataclass that determines what kind of data to get.
- Returns:
A list with objects of the given dataclass.
- Raises:
ValueError – Invalid dataclass.
PLDBNewDataCommitted – Conflict with new data committed by an other session.
The following data can be listed by this resource:
HostTrigger: Lists all host triggers.
The list may or may not be cached depending on if
cache_enabled
is set.>>> ht.list(api.HostTrigger) [HostTrigger(name='test', id=45)]
The result can be filtered using Python’s list comprehension syntax. For example, to list all host triggers with incoming bandwidth larger than zero:
>>> [l for l in ht.list(api.HostTrigger) if l.in_bw > 0] [HostTrigger(name='test', id=45)]
- class activelogic.HostTriggerType
Defines a set of constants for the type of triggers.
- Variables:
HOST – The value is a netobject path.
HOST_IN_NETOBJECT – The value is a netobject path.
NETOBJECT – The value is a netobject parent path.
NETOBJECT_CHILD – The value is a netobject path.
VIEW – The value is a view name.
VIEW_SCEVENT – The value is a view name with session context
- class activelogic.HostTriggerScEventFlags
Defines a set of constants for session context event evaluation flags
- Variables:
SC_EVENT_EVAL_ON_START_MATCH – Evaluate the trigger on start match.
SC_EVENT_EVAL_ON_STOP_MATCH – Evaluate the trigger on stop match.
- class activelogic.HostTrigger
Information about a host trigger. To create a new HostTrigger object, the name and the script filename are not optional.
- Parameters:
id (int) – The id of the host trigger.
name (str) – The name of the host trigger.
script (str) – The script filename to execute.
in_bw (int) – in bandwidth limit to trigger on in Kbps.
out_bw (int) – out bandwidth limit to trigger on in Kbps.
in_cps (int) – in connections per second to trigger on.
out_cps (int) – out connections per second to trigger on.
conns (int) – no of est. connections to trigger on.
uconns (int) – no of unest. connections to trigger on.
qoe_in_int (int) – QoE for in traffic on internal interface.
qoe_in_ext (int) – QoE for in traffic on external interface.
qoe_out_int (int) – QoE for out traffic on internal interface.
qoe_out_ext (int) – QoE for out traffic on external interface.
netobject (int) – Netobject id the trigger is configured for when trigtype is HostTriggerType.HOST_IN_NETOBJECT.
trigtype (int) – Trigger type. One of HostTriggerType.
subitem_count (int) – Number of subitems in view tree.
view_name (str) – DynamicLiveView the trigger is configured for when trigtype is HostTriggerType.VIEW.
sc_event_name (str) – Session context event name (only applicable for TRIGTYPE_VIEW_SC_EVENT)
sc_event_data (str) – Session context event data (only applicable for TRIGTYPE_VIEW_SC_EVENT)
sc_event_flags (HostTriggerScEventFlags) – Session context event evaluation flags (only applicable for TRIGTYPE_VIEW_SC_EVENT)
sc_event_ratelimit_data (str) – Session context event ratelimit data (only applicable for TRIGTYPE_VIEW_SC_EVENT)
sc_event_ratelimit_for (int) – Session context event ratelimit milliseconds (only applicable for TRIGTYPE_VIEW_SC_EVENT)
detection_interval (int) – Detection interval (Number of connection update intervals to raise)
recovery_interval (int) – Recovery interval (Number of connection update intervals to clear)
abortedconns (int) – Aborted connections.
abortedconns_percent (int) – Percentage of aborted connections.
- async HostTriggers.add(trigger)
Adds a new host trigger to the system.
QoE (Quality of Experience) triggers can have values from 100 to 0 (Corresponding to 100% to 0%). It will trigger when QoE goes below configured value. See product guide for a detailed definition of QoE values.
- Parameters:
trigger (HostTrigger) – The new HostTrigger name.
- Returns:
The id of the new HostTrigger
- Raises:
ValueError – The trigger type is not supported.
ValueError – Session context event triggers are not supported.
ValueError – The trigger type of the in-parameter is VIEW or VIEW_SCEVENT and the view name is missing.
ValueError – The trigger type of the in-parameter is not VIEW_SCEVENT and the script is missing.
ValueError – The trigger contains both script and event name.
ValueError – Detection/recovery interval, aborted connections and percentage of aborted connections are not supported.
ValueError – Seen TTLs/Hop Limits is not supported
- async HostTriggers.update(trigger, script=None, in_bw=None, out_bw=None, in_cps=None, out_cps=None, conns=None, uconns=None, out_ttls=None, qoe_in_int=None, qoe_in_ext=None, qoe_out_int=None, qoe_out_ext=None, netobject=None, trigtype=None, subitem_count=None, view_name=None, sc_event_name=None, sc_event_data=None, sc_event_flags=None, sc_event_ratelimit_data=None, sc_event_ratelimit_for=None, detection_interval=None, recovery_interval=None, abortedconns=None, abortedconns_percent=None)
Updates the host trigger properties.
- Parameters:
trigger (
HostTrigger
or int) – The trigger, or trigger id, to update.script (str) – The script filename to execute.
in_bw (int) – in bandwidth limit to trigger on in Kbps.
out_bw (int) – out bandwidth limit to trigger on in Kbps.
in_cps (int) – in connections per second to trigger on.
out_cps (int) – out connections per second to trigger on.
conns (int) – no of est. connections to trigger on.
uconns (int) – no of unest. connections to trigger on.
qoe_in_int (int) – QoE for in traffic on internal interface.
qoe_in_ext (int) – QoE for in traffic on external interface.
qoe_out_int (int) – QoE for out traffic on internal interface.
qoe_out_ext (int) – QoE for out traffic on external interface.
netobject (int) – Netobject id the trigger is configured for when trigtype is in in (HOST_IN_NETOBJECT, NETOBJECT or NETOBJECT_CHILD).
trigtype (int) – Trigger type. One of HostTriggerType.
subitem_count (int) – Number of subitems in view tree.
view_name (str) – DynamicLiveView the trigger is configured for when trigtype is HostTriggerType.VIEW.
sc_event_name (str) – Session context event name (only applicable for TRIGTYPE_VIEW_SC_EVENT)
sc_event_data (str) – Session context event data (only applicable for TRIGTYPE_VIEW_SC_EVENT)
sc_event_flags (HostTriggerScEventFlags) – Session context event evaluation flags (only applicable for TRIGTYPE_VIEW_SC_EVENT)
sc_event_ratelimit_data (str) – Session context event ratelimit data (only applicable for TRIGTYPE_VIEW_SC_EVENT)
sc_event_ratelimit_for (int) – Session context event ratelimit milliseconds (only applicable for TRIGTYPE_VIEW_SC_EVENT)
detection_interval (int) – Detection interval (Number of connection update intervals to raise)
recovery_interval (int) – Recovery interval (Number of connection update intervals to clear)
abortedconns (int) – Aborted connections.
abortedconns_percent (int) – Percentage of aborted connections.
- Raises:
ValueError – The trigger type is not supported.
ValueError – Session context event triggers are not supported.
ValueError – The trigger type of the in-parameter is VIEW or VIEW_SCEVENT and the view name is missing.
ValueError – The trigger type of the in-parameter is not VIEW_SCEVENT and the script is missing.
ValueError – The trigger contains both script and event name.
ValueError – Detection/recovery interval, aborted connections and percentage of aborted are not supported.
ValueError – Seen TTLs/Hop Limits is not supported
- async HostTriggers.remove(trigger)
Remove this host trigger from the system.
- Parameters:
trigger (An ID for a trigger or a HostTrigger object) – The trigger to remove from the system.
- Raises:
ValueError – The trigger parameter must be a trigger id or a HostTrigger object