Logic - is a mechanism for automatic management.
The syntax of a logic description
The logic is described by a line in the following form:
Code Block |
---|
(SENSORID OLDSTATE-NEWSTATE OPERATOR ...){SENSORID1:TIMEOUT NEWSTATE2 OPERATOR2 ...} |
Where:
SENSORID - unique sensor ID.
OLDSTATE-NEWSTATE - sensor status codes, with which the condition is true in transition. The values of both parameters should be the same.
OPERATOR - the operator code with which the result of conditions is calculated.
SENSORID1 - Unique sensor ID whose status should be changed under the conditions of the logical scheme.
TIMEOUT - A timeout condition.
NEWSTATE2 - The status code where you want to move the element (relay).
OPERATOR2 - Symbol '+'.
Status codes are:
'normal': 1;
'low': 2;
'warning': 3;
'alarm': 4;
'on': 5;
'off': 6.
'not connected': 7.
'pulse': 8.
Operators codes:
'and': symbol '+';
'or': symbol '|'.
Manage logic
To create a logic use field ctlLogicRowStatus. Moving field ctlLogicRowStatus in a state CreateAndWait(5) will create a new note in the table сtlLogicsTable.
After creating the logic it is necessary to specify its name in a the field ctlLogicName and the logic description in a the field ctlLogicDescription.
After creating a logic description, the logic becomes active, as indicated by the value active(1) in a field ctlLogicRowStatus.
Turn Turning off the logic is performed by setting a field ctlLogicDisable desired interval in seconds.
Turn-on logic is performed by setting the field ctlLogicDisable value of '0'.
...
Code Block |
---|
$ snmptable -Ci -Cb -v2c -cread 192.168.0.193 VUTLAN-SYSTEM-MIB::ctlLogicsTable |
Code Block |
---|
...
SNMP table: VUTLAN-SYSTEM-MIB::ctlLogicsTable
index ID Name Description Disable RowStatus
1 1 "Logic scheme" "(20 4 - 4){34:0 8}" 0 active |
Creating new logic:
Code Block | linenumbers | true
---|
$ snmpset -v2c -cwrite 192.168.0.193 VUTLAN-SYSTEM-MIB::ctlLogicName.2 s "New Logic" \ VUTLAN-SYSTEM-MIB::ctlLogicDescription.2 s "(20 1-1){301:0 5}" \ VUTLAN-SYSTEM-MIB::ctlTrapRowStatus.2 i createAndGo |
Code Block |
---|
...
VUTLAN-SYSTEM-MIB::ctlLogicName.2 = STRING: "New Logic"
VUTLAN-SYSTEM-MIB::ctlLogicDescription.2 = STRING: "(20 1-1){301:0 5}"
VUTLAN-SYSTEM-MIB::ctlTrapRowStatus.2 = INTEGER: createAndGo(4) |
View created logic table:
Code Block |
---|
$ snmptable -Ci -Cb -v2c -cread 192.168.0.193 VUTLAN-SYSTEM-MIB::ctlLogicsTable |
Code Block |
---|
...
SNMP table: VUTLAN-SYSTEM-MIB::ctlLogicsTable
index ID Name Description Disable RowStatus
1 1 "Logic scheme" "(20 4-4){34:0 8}" 0 active
2 2 "New Logic" "(20 1-1){301:0 5}" 0 active |
Now we have two logics:
Logic "Logic scheme" is triggered when an element of the system with ID = 20 goes to state "alarm"(4) and provides an incentive "pulse"(8) on the element with ID=34 (relay or outlet, see table above) immediately (through 0 с);
Logic "New Logic" is triggered, when an element of the system with ID=20 goes to state "normal"(1) and provides an incentive "on"(8) on the element with ID=301 (Trap element, see table above) immediately (through 0 с);
Disabling the logic in 60 seconds:
Code Block |
---|
$ snmpset -v2c -cwrite 192.168.0.193 VUTLAN-SYSTEM-MIB::ctlLogicDisable.2 i 60 |
Code Block |
---|
VUTLAN-SYSTEM-MIB::ctlLogicDisable.2 = INTEGER: 60 |
Verify that the logic is disabled:
Code Block |
---|
$ snmpget -v2c -cwrite 192.168.0.193 VUTLAN-SYSTEM-MIB::ctlLogicDisable.2 |
Code Block |
---|
VUTLAN-SYSTEM-MIB::ctlLogicDisable.2 = INTEGER: 1 |
Remove Logic:
Code Block |
---|
$ snmpset -v2c -cwrite 192.168.0.193 VUTLAN-SYSTEM-MIB::ctlLogicRowStatus.2 i destroy |
Code Block |
---|
VUTLAN-SYSTEM-MIB::ctlLogicRowStatus.2 = INTEGER: destroy(6) |
After the removal of the logic, the logic table should have an initial appearance.
...