sailor.pai

Submodules

Module contents

sailor.pai.create_alert(**kwargs)[source]

Create a new alert in the remote system.

Alerts are immutable. If the specified alert type uses a deduplication period, the remote system will not create a new alert but ONLY increase the counter for an existing alert on the same equipment within the deduplication period. This means (1) additional properties supplied are discarded and (2) this function will return the existing alert object as a response.

Parameters

**kwargs – Keyword arguments which names correspond to the available properties. Can also be used to supply custom fields (Z_*, z_*) used with the corresponding alert type: in this case the type of the field is not known to Sailor and therefore the value must be strictly given in the format defined by the type as defined by the remote API.

Returns

A new alert object as retrieved from PAI after the create succeeded.

Return type

Alert

Example

alert = create_alert(equipment_id=’123’, triggered_on=’2020-07-31T13:23:00Z’,

type=’PUMP_TEMP_WARN’, severity_code=5, indicator_id=’ic1’, indicator_group_id=’ig1’, template_id=’t1’)

sailor.pai.find_alerts(*, extended_filters=(), **kwargs)[source]

Fetch Alerts from PredictiveAssetInsights (PAI) with the applied filters, return an AlertSet.

This method supports the common filter language explained at Filter Language.

Parameters
Return type

AlertSet

Examples

Get all Alerts with the type ‘MyAlertType’:

find_alerts(type='MyAlertType')

Get all Error(severity code=10) and Information(severity code=1) alerts:

find_equipment(severity_code=[10, 1])