Alarm and Events
The alarming API of HumanOS® allows to get pending alarms but also to post and remove alarms manually.
An alarm item contains of following fields:
Field Name | Description | Type |
---|---|---|
Active | True = Alarm is active | System.Boolean |
AlarmType | Type of alarm (Information, Warning, Alarm, Emergency) | EAlarmType |
ConditionName | Name of the alarm | System.String |
Disappearance | Timestamp of the disappearance | System.DateTime |
EventId | Identifier of the alarm | System.Int32 |
Message | Message text | System.String |
Occurrence | Timestamp of the occurrence | System.DateTime |
Severity | Severity of the alarm | System.Int32 |
SourceName | Name of the alarm source | System.String |
SourceNodeId | Guid of the source node | System.Guid |
Time | Current timestamp (Occurrence or Disappearance) | System.DateTime |
Getting all Pending Alarms
Gets all pending alarms of a alarm-event pool.
HTTP Method: | GET |
HTTP Url: | alarms/pool |
HTTP Query-Parameter: | id : Id of the alarm pool as System.Guid |
Request Content-Type | text/xml |
Request Body | - |
Response Content-Type | text/xml |
Response Content | List of pending alarms |
Example:
GET http://localhost:8081/alarms/pool?id=56b4925b-e671-482b-8dc3-debba395e7a1
Response Body:
<HumanOS.Stream>
<Alarms>
<AlarmItem>
<Active>true</Active>
<AlarmType>Alarm</AlarmType>
<ConditionName>Alarm PS3</ConditionName>
<Disappearance>0001-01-01T00:00:00</Disappearance>
<EventId>1631396097</EventId>
<Message>TOO MANY DIGIT</Message>
<Occurrence>2019-10-22T20:44:28.974112Z</Occurrence>
<Severity>500</Severity>
<SourceName>CNC</SourceName>
<SourceNodeId>0dd3fac7-ed5a-4193-af6a-f63439e7b0ff</SourceNodeId>
<Time>2019-10-22T20:44:28.974112Z</Time>
</AlarmItem>
</Alarms>
</HumanOS.Stream>
Post an Alarm
Posts an alarm over the REST API.
HTTP Method: | POST |
HTTP Url: | alarms/pool |
HTTP Query-Parameter: | id : Id of the alarm pool as System.Guid |
Request Content-Type | text/xml |
Request Body | Alarm Item data |
Response Content-Type | text/xml |
Response Content | Alarm Item |
Note that the response body returns the EventId of the posted alarm. This id must be used to remove the alarm.
Following fields are given in the request body:
- ConditionName: Name of the alarm
- Message: message text
- SourceNodeId: ID of the source node
- Time: timestamp of the occurrence
- AlarmType: alarm type. [Optional, Default=Alarm]
- SourceName : name of the source [Optional, Default=<empty>]
Example:
POST http://localhost:8081/alarms/pool?id=56b4925b-e671-482b-8dc3-debba395e7a1
Request Body:
<HumanOS.Stream>
<Alarms>
<AlarmItem>
<ConditionName>Alarm 100</ConditionName>
<Message>Some alarm 100</Message>
<SourceNodeId>{0A52B7E8-5841-4E40-97E2-B6BD2CE5E081}</SourceNodeId>
<Time>2019-10-19 0:0:0</Time>
</AlarmItem>
</Alarms>
</HumanOS.Stream>
Response Body:
<HumanOS.Stream>
<Alarms>
<AlarmItem>
<EventId>-1179259960</EventId>
...
</AlarmItem>
</Alarms>
</HumanOS.Stream>
Remove an Alarm
Removes an alarm from the pool.
HTTP Method: | DELETE |
HTTP Url: | alarms/pool |
HTTP Query-Parameter: | id : Id of the alarm pool as System.Guid |
Request Content-Type | text/xml |
Request Body | Alarm Item |
Response Content-Type | text/xml |
Response Content | "OK" if item is deleted |
The request body contains following fields:
- EventId: Id of the alarm to be removed
- Time: Timestamp of the disappearance
Example:
DELETE http://localhost:8081/alarms/pool?id=56b4925b-e671-482b-8dc3-debba395e7a1
Request Body:
<HumanOS.Stream>
<Alarms>
<AlarmItem>
<EventId>-1179259960</EventId>
<Time>2019-10-19 0:1</Time>
</AlarmItem>
</Alarms>
</HumanOS.Stream>
Response:
OK