The OPS allows you to specify the interval for monitoring the operating status of maintenance assistants. By default, a maintenance assistant is triggered when the condition is met once within 30 seconds. This function can be used to configure multiple conditions at the same time.
opsObj.trigger(occurs=1, period=30, delay=0, suppress=0)
Method |
Description |
---|---|
opsObj |
Specifies an OPS object. It is obtained through ops.ops() instantiation. |
occurs |
Specifies the number of times that an event is triggered. |
period |
Specifies a detection period, in seconds. This parameter is valid only when the and/andnot association condition is defined or the value of occurs is greater than 1. |
delay |
Specifies a trigger delay. After the working conditions of a maintenance assistant are met, the assistant is triggered after a delay, in seconds. |
suppress |
Specifies a trigger suppression value. If the value is 0, suppression is not triggered. If the value is n, it indicates that the event is not triggered after n times within the detection period. |
test.py import ops def ops_condition(_ops): ret1, reason1 = _ops.cli.subscribe("con1","display device",True,True,False,20) ret2, reason2 = _ops.cli.subscribe("con2","display this",True,True,False,20) _ops.correlate("con1 and con2") _ops.trigger(occurs=1, period=10, delay=0, suppress=0) def ops_execute(_ops): _ops.terminal.write("Hello world!",None) return 0
When a user enters display device and display this on the terminal, the maintenance assistant is triggered only once within 10 seconds, and "Hello world!" will be displayed.