Optional
realtime: RealtimeGets the number of alarms based on the filter criteria.
Filters to query alarms.
Example
const filter: AlarmQueryFilter = {
severity: Severity.MAJOR,
};
(async () => {
const {data, res} = await alarmService.count(filter);
})();
Response wrapped in [[IResultList]]
Creates a new alarm.
Alarm object with mandantory fragments.
Response wrapped in [[IResult]]
Example
const mandantoryObject: IAlarm = {
severity: Severity.CRITICAL,
source: device,
text: 'I am an Alarm!',
time: '2018-05-02T10:08:00Z',
type: 'device-type-here',
};
(async () => {
const {data, res} = await alarmService.create(mandantoryObject);
})();
Gets the details of selected alarms.
Entity or Id of the entity.
Response wrapped in [[IResult]]
Example
const alarmId: number = 1;
(async () => {
const {data, res} = await alarmService.detail(alarmId);
})();
Gets the list of alarms filtered by parameters.
Filters to query alarms.
Example
const filter: AlarmQueryFilter = {
severity: Severity.MAJOR,
pageSize: 100,
withTotalPages: true
};
(async () => {
const {data, res, paging} = await alarmService.list(filter);
})();
Response wrapped in [[IResultList]]
Updates alarm data.
Partial alarm to update, must have id
.
Response wrapped in [[IResult]]
Example
const partialUpdateObject: Partial<IAlarm> = {
id: 123,
severity: Severity.MINOR,
source: device,
text: 'Changed Alarm!'
};
(async () => {
const {data, res} = await alarmService.update(partialUpdateObject);
})();
Updates alarm data in bulk and with additional query filters.
Partial alarm object.
Additional query filters.
Response in form of { IFetchResponse }
Example
const partialUpdateObject: Partial<IAlarm> = {
status: AlarmStatus.CLEARED
};
const additionalFilters: Record<string, string | number | boolean> = {
resolved: false,
severity: Severity.MINOR
};
(async () => {
const response = await alarmService.updateBulk(partialUpdateObject, additionalFilters);
})();
In this example, every unresolved alarm that has a severity of Severity.MINOR
will be updated with a status of AlarmStatus.CLEARED
.
This class allows for managing alarms.