ResourceEvent

Table of contents

  1. Description
  2. Properties
  3. @Example

Description

Object to use when you want to ingest an event in Alert Notification to alert/notify about what is happening with a resource of yours. To see the methods which are using it check here

Properties

Field Type Description
id? string Identification guid of the resource event. It will be populated by Alert Notification service and you will have access to it on response.
body string Describes what the event is about in details
subject string Self explanatory title, which summarises what the sent event is about
eventType string Type of the event, e.g. it can be HighCPUUsage, MemoryTooLow, etc.
severity Severity (string) Represents the event impact in the context of the affected resource
category Category (string) Represents the event impact in the context of the affected resource
resource AffectedResource (object) Identifies the action’s current state, that is, if it’s currently enabled or disabled
eventTimestamp? string Event timestamp, represents when it was created in the source, if missing Alert Notification service will populate it for you and will set the time it was ingested for processing
priority? number Priority of the raised event
tags? object<string, string> Any other useful information about the event.

Some useful known tags by Alert Notification service are:
- ans:sourceEventId? - generated by the source, will be used for further stateful interactions with Alert Notification service
- ans:correlationId? - generated by the source in order to correlate this event with other activities or issues
- ans:status? - will be used for incient management systems. Possible values: ‘CREATE_OR_UPDATE’, ‘CREATE’, ‘UPDATE’, ‘COMMENT’ or ‘CLOSE’
- ans:recommendedActionLink? - a URL that contains details for recommended actions regarding this event
- ans:detailsLink? - a URL that contains details for this event, e.g. dashboards showing what triggered it

@Example

import { Severity, Category } from '@sap_oss/alert-notification-client';

const resourceEvent = {
    body: 'Your test-resource has been',
    subject: 'test-resource exceeds cpu limits',
    eventType: 'HighCpu',
    severity: Severity.WARNING,
    category: Category.ALERT,
    resource: {
        resourceName: 'test-resource',
        resourceType: 'application',
        resourceInstance: '123456',
        tags: {
            detailsLink: 'https://example.details.com'
        }
    },
    eventTimestamp: 1602787032,
    priority: 1
};