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.

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 concurrent connections to trigger on.

  • uconns (int) – no of unest. connections to trigger on.

  • out_ttls (int) – out number of different used ttls 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.

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 of the in-parameter is VIEW and the view name is missing.

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)

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 concurrent connections to trigger on.

  • uconns (int) – no of unest. connections to trigger on.

  • out_ttls (int) – out number of different used ttls 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.

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