Alarm service
Contents
Requires EVA ICS Enterprise.
Alarms service allows operator to deal with alarm events happened on EVA ICS nodes.
Functionality limitations
The service is not open-source and is included in EVA ICS Enterprise. Despite being a part of EVA ICS Enterprise, it is allowed to use service instances without a license, with the following limitations:
The maximum number of alarms is limited to 10
The service is limited to a local node, cloud alarms are not supported
Architecture
The service implements ANSI/ISA 18.2 alarm management standard and allows to deal with alarms on both local and remote nodes.
Each alarm is represented by a lvar item. The service manages lvars and allows operators to perform standard alarm actions, such as getting alarm state/summary/history, acknowledging, shelving, etc.
There are two kinds of alarms: managed and regular. A managed alarm means an alarm, configured on a local node. Such alarm is allowed to be set in any state, using either internal rules or external scenarios.
In addition to the internal rule engine, the service provides a flexible EAPI commons interface which allows system integrators to create complex alarm setups.
Alarm UI
Alarms can be managed in Operation centre or in custom HMI applications.
Terminology
The tables provided below describe service data types and input/output codes.
Alarm space
An alarm space is defined with prefix service configuration field (the default is alarm/default). Alarm service instances which operate in the same space work with the same set of alarms.
Warning
It is highly recommended to use a single service instance per a node with the same alarm space to avoid conflicts.
Alarm operations
ISA 18.2 defines the following alarm operations:
Code |
Name |
Description |
|---|---|---|
TT |
Trigger |
Trigger an alarm |
TL |
Latch |
Trigger + latch alarm |
SS |
Shelve |
Shelve (suspend) an alarm |
US |
Unshelve |
Unshelve (resume) an alarm |
CC |
Clear |
Clear an alarm |
SD |
Suspend-by-design |
Suspend an alarm (do not accept triggers) |
RD |
Resume-by-design |
Resume an alarm (accept triggers) |
AA |
Acknowledge |
Acknowledge an alarm |
OS |
Out-of-service |
Put an alarm out of service |
IS |
In-service |
Put an alarm in service |
Triggered alarms can be acknowledged when active, if a clear operation is applied, the alarm is removed from the active state.
Latched alarms are triggered and latched, they must be acknowledged even if a clear operation is applied.
Shelved alarms are excluded from the alarm summary, however they still can be triggered/cleared in the background.
Suspended-by-design operation is applied when an alarm source is down (e.g. PLC is shut down) so the assigned rules may produce trigger events which should be ignored. This operation can be applied by an external scenario or program only.
Out-of-service operation means the alarm source is down and it is unable to determine is the alarm is active or not. E.g. an alarm is triggered by a temperature sensor. Out of service means the sensor is down and the current temperature is unknown.
Sources and source kinds
Each alarm operation must include a source name and a source kind. Source name is a string. HTTP API sets the source name to the login of the user who performs the operation. External scenarios can use any custom source names or leave the source field empty (use an empty string).
Source kinds are coded as the following:
Code |
Description |
|---|---|
U |
User operation |
P |
Program operation |
R |
Used by an internal rule system |
Alarm controls
Each service instance automatically crates a control lmacro which is used to send operator control commands to alarms. As lmacros are cloud-wide accessible, it is possible to control alarms on both local and remote nodes.
E.g. a service with alarm space alarm/default creates a control lmacro with OID: lmacro:alarm/default/NODE_NAME/control. where NODE_NAME is the system name of the current node.
The scenario accepts the following parameters (all are mandatory):
Name |
Type |
Description |
|---|---|---|
alarm_oid (i) |
String |
Alarm lvar OID |
command (cmd) |
String |
Command code |
source_kind (sk) |
String |
Source kind |
source (src) |
String |
Source name |
Unlike alarm operations, alarm control commands can be applied to any alarm in a cloud but the list of allowed operations is restricted. The following command codes are accepted:
AA - Acknowledge an alarm
SS - Shelve (suspend) an alarm
US - Unshelve (resume) an alarm
Alarm states
An alarm lvar value contains a set of fields used to process alarm logic. However when a state method is called, the value is contracted to the following fields which represent the current alarm state:
active - A boolean value, which is set to true if the alarm is triggered, triggered+latched, latched (triggered+latched, then cleared but not acknowledged) or out-of-service.
current - Contains the current alarm state code:
Code |
Name |
Description |
|---|---|---|
CC |
Cleared |
The alarm is cleared (default state) |
TL |
Triggered+latched |
The alarm is triggered and latched |
LL |
Latched |
The alarm is latched |
TT |
Triggered |
The alarm is triggered |
OS |
Out-of-service |
The alarm is out of service |
AA |
Acknowledged |
The alarm is acknowledged |
SS |
Shelved |
The alarm is shelved |
SD |
Suspended-by-design |
The alarm is suspended by design |
Alarm subscriptions
The following kinds are supported:
Code |
Description |
|---|---|
M |
When a subscription method is called, a notification is sent to the subscribed user when an alarm operation is applied. It is recommended to subscribe at least to the following operations: TT, TL, OS.
Note that triggered and triggered + latched alarm operations are different, despite the user may see the same notification.
If an alarm or user is deleted, its subscriptions are kept so if a new alarm with the same OID/user with the same login is created, the subscriptions are restored.
Note
Alarm subscriptions are processed by the node where the user was logged in and created the subscription.
Defining alarms
The alarms can be deployed either with IaC and deployment or by calling alarm.deploy EAPI method directly. It also possible to manage alarms with eva-shell commands.
An alarm payload example:
alarms:
# a mandatory alarm group
group: test
# a mandatory alarm ID
id: AL001
# a mandatory alarm level (0-255)
level: 20
# an optional alarm description
description: "test alarm"
# an optional configuration
- config:
# optional delayed alarm configuration
delay:
# delay for out-of-service state (seconds). If in-service operation
# is applied during the delay, the out-of-service operation is
# aborted.
oos: 1.0
# delay for triggres (seconds). If the alarm is cleared during the
# delay, the trigger is aborted.
trig: 1.0
# internal rules, processed one-by-one
rules:
# an optional bit parameter to process value bit number
- bit: null
# optional, break the rule chain if the condition is met
break: false
# condition to process the rule, written as a string
condition: "x >= 30"
# optional, on initial core state: process/skip/only
initial: process
# OID of an item which is monitored
oid: sensor:env/temp
# Alarm operation code, trigger+latch the alarm
op: TL
# optional, item state property to monitor (the default is value)
prop: value
- condition:
# a condition written in the machine format
max: 25.0
max_eq: false
min: null
min_eq: false
initial: process
oid: sensor:env/temp
# clear the alarm
op: CC
prop: value
- condition: "x = 1"
oid: sensor:env/temp
# set the alarm in-service if the sensor status is 1
op: IS
prop: status
- condition: "x = -1"
oid: sensor:env/temp
# set the alarm out-of-service if the sensor status is -1 (error)
op: OS
prop: status
When deployed, the above payload creates an alarm with assigned lvar lvar:alarm/default/NODE_NAME/20/test/AL001. After creation, the majority operations are handled by providing lvar OID.
If a description is defined, it is placed into meta/description field of the item.
Warning
It is highly non-recommended to modify/read alarm lvar values manually as the internal logic may be changed in the further versions of the service. Use the service methods only.
For more complex rule chains it is recommended to use Logic manager or a custom event-processing service.
Warning
Bus event subscriptions are preserved for deleted alarm rules. If alarms are mass-undeployed and not required anymore, it is recommended to restart the service to clear bus subscriptions.
Service instance IDs
For the default functionality, service instances must have IDs set to eva.alarm.default. For custom functionality, any ID can be used.
Setup
Use the template EVA_DIR/share/svc-tpl/svc-tpl-alarms.yml:
# Alarm service
command: svc/eva-svc-alarms
bus:
path: var/bus.ipc
config:
# alarm lvar prefix, must be the same for all nodes
prefix: alarm/default
# Alarm database, default: runtime/svc_data/<SVC_ID>/alarms.db
#db: sqlite:///tmp/alarms.db
#db: postgres://USER:PASSWORD@HOST/DB
# keep alarm events (seconds), if not set: keep forever
keep: 604800
notify:
# Mailer service to notify via
mailer_svc: eva.svc.mailer
# Mailer delay (seconds) to group notifications
mailer_delay: 5
# for PostgreSQL the service can work under "nobody"
user: eva
Create the service using eva-shell:
eva svc create eva.alarm.1 /opt/eva4/share/svc-tpl/svc-tpl-alarms.yml
or using the bus CLI client:
cd /opt/eva4
cat DEPLOY.yml | ./bin/yml2mp | \
./sbin/bus ./var/bus.ipc rpc call eva.core svc.deploy -
(see eva.core::svc.deploy for more info)
EAPI methods
See EAPI commons for the common information about the bus, types, errors and RPC calls.
alarm.deploy
Description |
Deploy managed alarms |
Parameters |
required |
Returns |
nothing |
Name |
Type |
Description |
Required |
alarms |
Vec<struct> |
Alarm configurations |
yes |
alarm.destroy
Description |
Destroy a managed alarm |
Parameters |
required |
Returns |
nothing |
Name |
Type |
Description |
Required |
i |
String |
Alarm LVar OID |
yes |
alarm.get_config
Description |
Get managed alarm configuration |
Parameters |
required |
Returns |
Alarm configuration |
Name |
Type |
Description |
Required |
i |
String |
Alarm LVar OID |
yes |
Return payload example:
{
"config": {
"delay": {
"oos": 1.0,
"trig": 1.0
},
"rules": [
{
"bit": null,
"break": false,
"condition": {
"max": null,
"max_eq": false,
"min": 30.0,
"min_eq": true
},
"initial": "process",
"oid": "sensor:env/temp",
"op": "TT",
"prop": "value"
},
{
"bit": null,
"break": false,
"condition": {
"max": 25.0,
"max_eq": false,
"min": null,
"min_eq": false
},
"initial": "process",
"oid": "sensor:env/temp",
"op": "CC",
"prop": "value"
}
]
},
"description": "test alarm",
"group": "test",
"id": "AL001",
"level": 20
}
alarm.history
Description |
Get alarm history |
Parameters |
required |
Returns |
Alarm history |
Name |
Type |
Description |
Required |
i |
String |
Alarm LVar OID |
no |
t_start |
String/u64 |
Start time |
no |
t_end |
String/u64 |
End time |
no |
node |
String |
Alarm node |
no |
level_min |
u8 |
Minimum alarm level |
no |
level_max |
u8 |
Maximum alarm level |
no |
group |
String |
Alarm group |
no |
id |
String |
Alarm ID |
no |
ack |
bool |
Acknowledged alarms only |
no |
latch |
bool |
Latched alarms only |
no |
oos |
bool |
Out-of-service alarms only |
no |
sbd |
bool |
Suspended-by-design alarms only |
no |
shelv |
bool |
Shelved alarms only |
no |
trig |
bool |
Triggered alarms only |
no |
lo |
String |
Filter by alarm operation |
no |
losk |
String |
Filter by alarm operation source kind |
no |
los |
String |
Filter by alarm operation source |
no |
Return payload example:
[
{
"ack": false,
"group": "test",
"id": "AL001",
"level": 20,
"node": "mws1",
"latch": false,
"lo": "TT",
"los": "",
"losk": "P",
"oid": "lvar:alarm/default/mws1/20/test/AL001",
"oos": false,
"sbd": false,
"shelv": false,
"t": 1715732660.061618,
"trig": true
},
{
"ack": false,
"group": "test",
"id": "AL001",
"level": 20,
"node": "mws1",
"latch": false,
"lo": "CC",
"los": "",
"losk": "P",
"oid": "lvar:alarm/default/mws1/20/test/AL001",
"oos": false,
"sbd": false,
"shelv": false,
"t": 1715732890.977563,
"trig": false
}
]
alarm.list
Description |
List managed alarms |
Parameters |
required |
Returns |
List of managed alarms |
Name |
Type |
Description |
Required |
level |
u8 |
Alarm level |
no |
group |
String |
Alarm group |
no |
id |
String |
Alarm ID |
no |
Return payload example:
[
{
"description": "test alarm",
"group": "test",
"id": "AL001",
"level": 20,
"oid": "lvar:alarm/default/mws1/20/test/AL001"
},
{
"description": null,
"group": "test",
"id": "AL002",
"level": 20,
"oid": "lvar:alarm/default/mws1/20/test/AL002"
}
]
alarm.set
Description |
Set alarm state |
Parameters |
required |
Returns |
nothing |
Name |
Type |
Description |
Required |
i |
String |
Alarm LVar OID |
yes |
op |
String |
Alarm operation code |
yes |
source_kind |
String |
Source kind (U/P/R) |
yes |
source |
String |
Source |
yes |
alarm.state
Description |
Get alarm states (all) |
Parameters |
required |
Returns |
List of alarm states |
Name |
Type |
Description |
Required |
node |
String |
Alarm node |
no |
level_min |
u8 |
Alarm level min |
no |
level_max |
u8 |
Alarm level max |
no |
group |
String |
Alarm group |
no |
id |
String |
Alarm ID |
no |
active |
bool |
Active/inactive alarms |
no |
current |
String |
Current alarm state |
no |
u |
String |
View alarm state as a user (including subscriptions) |
no |
Return payload example:
[
{
"active": false,
"current": "CC",
"description": "test alarm",
"group": "test",
"id": "AL001",
"level": 20,
"node": "mws1",
"oid": "lvar:alarm/default/mws1/20/test/AL001",
"subscribed_email": [
"TT",
"TL",
"OS"
]
},
{
"active": true,
"current": "TL",
"description": null,
"group": "test",
"id": "AL002",
"level": 20,
"node": "mws1",
"oid": "lvar:alarm/default/mws1/20/test/AL002",
"subscribed_email": [
"TT",
"TL",
"OS"
]
}
]
alarm.subscribe
Description |
Subscribe a user to alarm state changes |
Parameters |
required |
Returns |
nothing |
Name |
Type |
Description |
Required |
u |
String |
User account |
yes |
oid_mask |
String/Vec<String> |
Alarm OID mask |
yes |
nk |
String |
Notification kind |
yes |
op |
String/Vec<String> |
Alarm operation code |
yes |
alarm.summary
Description |
Get alarm summary |
Parameters |
none |
Returns |
Alarm summary |
Return payload example:
{
"active": 1,
"active_by_node": {
"mws1": 1
}
}
alarm.undeploy
Description |
Undeploy managed alarms |
Parameters |
required |
Returns |
nothing |
Name |
Type |
Description |
Required |
alarms |
Vec<struct> |
Alarm configurations |
yes |
alarm.unsubscribe
Description |
Unsubscribe a user from alarm state changes |
Parameters |
required |
Returns |
nothing |
Name |
Type |
Description |
Required |
u |
String |
User account |
yes |
oid_mask |
String/Vec<String> |
Alarm OID mask |
yes |
nk |
String |
Notification kind |
yes |
op |
String/Vec<String> |
Alarm operation code |
yes |
HTTP API
The service provides certain methods via extra calls (the methods must be called e.g. as x::eva.alarm.default::summary)
To use HTTP API methods, a user must have read or write access to alarm lvars.
ack
Description |
Acknowledge an alarm |
Parameters |
required |
Returns |
nothing |
Name |
Type |
Description |
Required |
k |
String |
valid API key/token |
yes |
i |
String |
Alarm OID |
yes |
http
POST /jrpc HTTP/1.1
accept: application/json
content-type: application/json
host: localhost:7727
{
"id": 1,
"jsonrpc": "2.0",
"method": "ack",
"params": {
"i": "lvar:alarm/default/mws1/20/test/AL001",
"k": "secretkey"
}
}
curl
curl -i -X POST http://localhost:7727/jrpc -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "ack", "params": {"i": "lvar:alarm/default/mws1/20/test/AL001", "k": "secretkey"}}'
wget
wget -S -O- http://localhost:7727/jrpc --header="Accept: application/json" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "ack", "params": {"i": "lvar:alarm/default/mws1/20/test/AL001", "k": "secretkey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "ack",
"params": {
"i": "lvar:alarm/default/mws1/20/test/AL001",
"k": "secretkey"
}
}' | http POST http://localhost:7727/jrpc Accept:application/json Content-Type:application/json
python-requests
requests.post('http://localhost:7727/jrpc', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'ack', 'params': {'i': 'lvar:alarm/default/mws1/20/test/AL001', 'k': 'secretkey'}})
response
HTTP/1.1 200 OK
cache-control: no-cache, no-store
content-length: 58
content-type: application/json
date: Thu, 13 Aug 2021 00:00:00 GMT
expires: 0
pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": null
}
history
Description |
Get alarm history |
Parameters |
required |
Returns |
Alarm history |
Name |
Type |
Description |
Required |
k |
String |
valid API key/token |
yes |
filter |
History filter structure (see alarm.history) |
Alarm history filter |
no |
http
POST /jrpc HTTP/1.1
accept: application/json
content-type: application/json
host: localhost:7727
{
"id": 1,
"jsonrpc": "2.0",
"method": "history",
"params": {
"filter": {
"node": "mws1"
},
"k": "secretkey"
}
}
curl
curl -i -X POST http://localhost:7727/jrpc -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "history", "params": {"filter": {"node": "mws1"}, "k": "secretkey"}}'
wget
wget -S -O- http://localhost:7727/jrpc --header="Accept: application/json" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "history", "params": {"filter": {"node": "mws1"}, "k": "secretkey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "history",
"params": {
"filter": {
"node": "mws1"
},
"k": "secretkey"
}
}' | http POST http://localhost:7727/jrpc Accept:application/json Content-Type:application/json
python-requests
requests.post('http://localhost:7727/jrpc', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'history', 'params': {'filter': {'node': 'mws1'}, 'k': 'secretkey'}})
response
HTTP/1.1 200 OK
cache-control: no-cache, no-store
content-length: 905
content-type: application/json
date: Thu, 13 Aug 2021 00:00:00 GMT
expires: 0
pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"ack": false,
"group": "test",
"id": "AL001",
"level": 20,
"node": "mws1",
"latch": false,
"lo": "TT",
"los": "",
"losk": "P",
"oid": "lvar:alarm/default/mws1/20/test/AL001",
"oos": false,
"sbd": false,
"shelv": false,
"t": 1715732660.061618,
"trig": true
},
{
"ack": false,
"group": "test",
"id": "AL001",
"level": 20,
"node": "mws1",
"latch": false,
"lo": "CC",
"los": "",
"losk": "P",
"oid": "lvar:alarm/default/mws1/20/test/AL001",
"oos": false,
"sbd": false,
"shelv": false,
"t": 1715732890.977563,
"trig": false
}
]
}
shelv
Description |
Shelve an alarm |
Parameters |
required |
Returns |
nothing |
Name |
Type |
Description |
Required |
k |
String |
valid API key/token |
yes |
i |
String |
Alarm OID |
yes |
http
POST /jrpc HTTP/1.1
accept: application/json
content-type: application/json
host: localhost:7727
{
"id": 1,
"jsonrpc": "2.0",
"method": "shelv",
"params": {
"i": "lvar:alarm/default/mws1/20/test/AL001",
"k": "secretkey"
}
}
curl
curl -i -X POST http://localhost:7727/jrpc -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "shelv", "params": {"i": "lvar:alarm/default/mws1/20/test/AL001", "k": "secretkey"}}'
wget
wget -S -O- http://localhost:7727/jrpc --header="Accept: application/json" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "shelv", "params": {"i": "lvar:alarm/default/mws1/20/test/AL001", "k": "secretkey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "shelv",
"params": {
"i": "lvar:alarm/default/mws1/20/test/AL001",
"k": "secretkey"
}
}' | http POST http://localhost:7727/jrpc Accept:application/json Content-Type:application/json
python-requests
requests.post('http://localhost:7727/jrpc', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'shelv', 'params': {'i': 'lvar:alarm/default/mws1/20/test/AL001', 'k': 'secretkey'}})
response
HTTP/1.1 200 OK
cache-control: no-cache, no-store
content-length: 58
content-type: application/json
date: Thu, 13 Aug 2021 00:00:00 GMT
expires: 0
pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": null
}
state
Description |
Get alarm states (all) |
Parameters |
required |
Returns |
List of alarm states |
Name |
Type |
Description |
Required |
k |
String |
valid API key/token |
yes |
filter |
State filter structure (see alarm.state) |
Alarm state filter |
no |
http
POST /jrpc HTTP/1.1
accept: application/json
content-type: application/json
host: localhost:7727
{
"id": 1,
"jsonrpc": "2.0",
"method": "state",
"params": {
"filter": {
"node": "mws1"
},
"k": "secretkey"
}
}
curl
curl -i -X POST http://localhost:7727/jrpc -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "state", "params": {"filter": {"node": "mws1"}, "k": "secretkey"}}'
wget
wget -S -O- http://localhost:7727/jrpc --header="Accept: application/json" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "state", "params": {"filter": {"node": "mws1"}, "k": "secretkey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "state",
"params": {
"filter": {
"node": "mws1"
},
"k": "secretkey"
}
}' | http POST http://localhost:7727/jrpc Accept:application/json Content-Type:application/json
python-requests
requests.post('http://localhost:7727/jrpc', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'state', 'params': {'filter': {'node': 'mws1'}, 'k': 'secretkey'}})
response
HTTP/1.1 200 OK
cache-control: no-cache, no-store
content-length: 781
content-type: application/json
date: Thu, 13 Aug 2021 00:00:00 GMT
expires: 0
pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"active": false,
"current": "CC",
"description": "test alarm",
"group": "test",
"id": "AL001",
"level": 20,
"node": "mws1",
"oid": "lvar:alarm/default/mws1/20/test/AL001",
"subscribed_email": [
"TT",
"TL",
"OS"
]
},
{
"active": true,
"current": "TL",
"description": null,
"group": "test",
"id": "AL002",
"level": 20,
"node": "mws1",
"oid": "lvar:alarm/default/mws1/20/test/AL002",
"subscribed_email": [
"TT",
"TL",
"OS"
]
}
]
}
subscribe
Description |
Subscribe a user to alarm state changes |
Parameters |
required |
Returns |
nothing |
Name |
Type |
Description |
Required |
k |
String |
valid API key/token |
yes |
oid_mask |
String/Vec<String> |
Alarm OID mask |
yes |
nk |
String |
Notification kind |
yes |
op |
String/Vec<String> |
Alarm operation code |
yes |
http
POST /jrpc HTTP/1.1
accept: application/json
content-type: application/json
host: localhost:7727
{
"id": 1,
"jsonrpc": "2.0",
"method": "subscribe",
"params": {
"k": "secretkey",
"nk": "M",
"oid_mask": "lvar:alarm/default/mws1/20/test/AL001",
"op": [
"TT",
"TL",
"OS"
]
}
}
curl
curl -i -X POST http://localhost:7727/jrpc -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "subscribe", "params": {"k": "secretkey", "nk": "M", "oid_mask": "lvar:alarm/default/mws1/20/test/AL001", "op": ["TT", "TL", "OS"]}}'
wget
wget -S -O- http://localhost:7727/jrpc --header="Accept: application/json" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "subscribe", "params": {"k": "secretkey", "nk": "M", "oid_mask": "lvar:alarm/default/mws1/20/test/AL001", "op": ["TT", "TL", "OS"]}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "subscribe",
"params": {
"k": "secretkey",
"nk": "M",
"oid_mask": "lvar:alarm/default/mws1/20/test/AL001",
"op": [
"TT",
"TL",
"OS"
]
}
}' | http POST http://localhost:7727/jrpc Accept:application/json Content-Type:application/json
python-requests
requests.post('http://localhost:7727/jrpc', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'subscribe', 'params': {'k': 'secretkey', 'nk': 'M', 'oid_mask': 'lvar:alarm/default/mws1/20/test/AL001', 'op': ['TT', 'TL', 'OS']}})
response
HTTP/1.1 200 OK
cache-control: no-cache, no-store
content-length: 67
content-type: application/json
date: Thu, 13 Aug 2021 00:00:00 GMT
expires: 0
pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}
summary
Description |
Get alarm summary |
Parameters |
required |
Returns |
Alarm summary |
Name |
Type |
Description |
Required |
k |
String |
valid API key/token |
yes |
http
POST /jrpc HTTP/1.1
accept: application/json
content-type: application/json
host: localhost:7727
{
"id": 1,
"jsonrpc": "2.0",
"method": "summary",
"params": {
"k": "secretkey"
}
}
curl
curl -i -X POST http://localhost:7727/jrpc -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "summary", "params": {"k": "secretkey"}}'
wget
wget -S -O- http://localhost:7727/jrpc --header="Accept: application/json" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "summary", "params": {"k": "secretkey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "summary",
"params": {
"k": "secretkey"
}
}' | http POST http://localhost:7727/jrpc Accept:application/json Content-Type:application/json
python-requests
requests.post('http://localhost:7727/jrpc', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'summary', 'params': {'k': 'secretkey'}})
response
HTTP/1.1 200 OK
cache-control: no-cache, no-store
content-length: 132
content-type: application/json
date: Thu, 13 Aug 2021 00:00:00 GMT
expires: 0
pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"active": 1,
"active_by_node": {
"mws1": 1
}
}
}
unshelv
Description |
Unshelve an alarm |
Parameters |
required |
Returns |
nothing |
Name |
Type |
Description |
Required |
k |
String |
valid API key/token |
yes |
i |
String |
Alarm OID |
yes |
http
POST /jrpc HTTP/1.1
accept: application/json
content-type: application/json
host: localhost:7727
{
"id": 1,
"jsonrpc": "2.0",
"method": "unshelv",
"params": {
"i": "lvar:alarm/default/mws1/20/test/AL001",
"k": "secretkey"
}
}
curl
curl -i -X POST http://localhost:7727/jrpc -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "unshelv", "params": {"i": "lvar:alarm/default/mws1/20/test/AL001", "k": "secretkey"}}'
wget
wget -S -O- http://localhost:7727/jrpc --header="Accept: application/json" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "unshelv", "params": {"i": "lvar:alarm/default/mws1/20/test/AL001", "k": "secretkey"}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "unshelv",
"params": {
"i": "lvar:alarm/default/mws1/20/test/AL001",
"k": "secretkey"
}
}' | http POST http://localhost:7727/jrpc Accept:application/json Content-Type:application/json
python-requests
requests.post('http://localhost:7727/jrpc', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'unshelv', 'params': {'i': 'lvar:alarm/default/mws1/20/test/AL001', 'k': 'secretkey'}})
response
HTTP/1.1 200 OK
cache-control: no-cache, no-store
content-length: 58
content-type: application/json
date: Thu, 13 Aug 2021 00:00:00 GMT
expires: 0
pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": null
}
unsubscribe
Description |
Unsubscribe a user from alarm state changes |
Parameters |
required |
Returns |
nothing |
Name |
Type |
Description |
Required |
k |
String |
valid API key/token |
yes |
oid_mask |
String/Vec<String> |
Alarm OID mask |
yes |
nk |
String |
Notification kind |
yes |
op |
String/Vec<String> |
Alarm operation code |
yes |
http
POST /jrpc HTTP/1.1
accept: application/json
content-type: application/json
host: localhost:7727
{
"id": 1,
"jsonrpc": "2.0",
"method": "unsubscribe",
"params": {
"k": "secretkey",
"nk": "M",
"oid_mask": "lvar:alarm/default/mws1/20/test/AL001",
"op": [
"TT",
"TL",
"OS"
]
}
}
curl
curl -i -X POST http://localhost:7727/jrpc -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"id": 1, "jsonrpc": "2.0", "method": "unsubscribe", "params": {"k": "secretkey", "nk": "M", "oid_mask": "lvar:alarm/default/mws1/20/test/AL001", "op": ["TT", "TL", "OS"]}}'
wget
wget -S -O- http://localhost:7727/jrpc --header="Accept: application/json" --header="Content-Type: application/json" --post-data='{"id": 1, "jsonrpc": "2.0", "method": "unsubscribe", "params": {"k": "secretkey", "nk": "M", "oid_mask": "lvar:alarm/default/mws1/20/test/AL001", "op": ["TT", "TL", "OS"]}}'
httpie
echo '{
"id": 1,
"jsonrpc": "2.0",
"method": "unsubscribe",
"params": {
"k": "secretkey",
"nk": "M",
"oid_mask": "lvar:alarm/default/mws1/20/test/AL001",
"op": [
"TT",
"TL",
"OS"
]
}
}' | http POST http://localhost:7727/jrpc Accept:application/json Content-Type:application/json
python-requests
requests.post('http://localhost:7727/jrpc', headers={'Accept': 'application/json', 'Content-Type': 'application/json'}, json={'id': 1, 'jsonrpc': '2.0', 'method': 'unsubscribe', 'params': {'k': 'secretkey', 'nk': 'M', 'oid_mask': 'lvar:alarm/default/mws1/20/test/AL001', 'op': ['TT', 'TL', 'OS']}})
response
HTTP/1.1 200 OK
cache-control: no-cache, no-store
content-length: 67
content-type: application/json
date: Thu, 13 Aug 2021 00:00:00 GMT
expires: 0
pragma: no-cache
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ok": true
}
}