system.alarm.acknowledge
Acknowledges any number of alarms, specified by their event ids. The event id is generated for an alarm when it becomes active, and is used to identify a particular event from other events for the same source. The alarms will be acknowledged by the logged in user making the call. Additionally, acknowledgement notes may be included and will be stored along with the acknowledgement.
This function uses different parameters based on the scope of the script calling it. Both versions are listed below.
system.alarm.acknowledge(alarmIds, [notes])
-
Parameters
String[] alarmIds - List of alarm event ids (uuids) to acknowledge.
String notes - Optional. Notes that will be stored on the acknowledged alarm events.
-
Returns
Nothing
-
Scope
Client
system.alarm.acknowledge(alarmIds, [notes], username)
-
Parameters
String[] alarmIds - List of alarm event ids (uuids) to acknowledge.
String notes - Optional. Notes that will be stored on the acknowledged alarm events.
String username - The user that acknowledged the alarm. NOTE that this parameter is only used when called from a gateway scoped script. This parameter should be omitted from any client-based scripts.
-
Returns
Nothing
-
Scope
Client
#This example shows the basic syntax for acknowledging an alarm from a client-based script
system.alarm.acknowledge([
'c27c06d8-698f-4814-af89-3c22944f58c5'
],
'Saw this alarm, did something about it.'
)
#This example shows the basic syntax for acknowledging an alarm from a gateway-based script
system.alarm.acknowledge([
'c27c06d8-698f-4814-af89-3c22944f58c5'
],
'Saw this alarm, did something about it.'
,
'admin'
)
#This code snippet could be used as a mouseReleased event handler on a Table component whose data was the return value of thesystem.alarm.queryAlarmStatus function.
#It would present a right-click menu to acknowledge the currently selected alarms (for more than #one, the table must be set to allow multiple selection).
#This example does not ask for an ack message, and therefore might fail if the alarms we're attempting to acknowledge require notes.
#Also, note that the system will ignore any alarms that have already #been acknowledged.
if
event.button
=
=
3
:
rows
=
event.source.selectedRows
data
=
event.source.data
if
len
(rows)>
0
:
uuids
=
[
str
(data.getValueAt(r,
'EventId'
))
for
r
in
rows]
def
ack(event, uuids
=
uuids):
import
system
system.alarm.acknowledge(uuids,
None
)
menu
=
system.gui.createPopupMenu({
'Acknowledge'
:ack})
menu.show(event)