Updated on 2022-02-21 GMT+08:00

Alarm Reporting

This topic is used to report alarms to AOM.

Topic

$hw/alarm/{appname}/add

Parameter

Type

Description

appname

String

Application name, which is user-defined.

Usage

Use an MQTT client to publish this topic.

Parameter Description

Parameter

Type

Description

alarmName

String

Alarm name.

alarmId

String

Alarm ID, which must be unique. For details, see Generating an alarmId.

detailedInformation

String

Alarm description.

url

String

URL for root cause analysis. If the URL is not available, leave this field blank.

source

String

Alarm source. The value is a character string consisting of uppercase and lowercase letters.

cleared

Boolean

Whether the alarm is cleared.

  • true: The alarm has been cleared.
  • false: The alarm needs to be cleared manually.

policyID

String

ID of an alarm rule. For a threshold rule, set this parameter to ruleId. If no threshold rule is configured, leave this field blank.

objectInstance

String

Location information. If this field is not specified, the value of this parameter is the same as that of alarmId by default.

perceivedSeverity

Integer

Alarm severity.

  • 1: Critical
  • 2: Major
  • 3: Minor
  • 4: Warning

resourceId

Object

Alarm information. For details, see Table 1.

neType

String

Type of the resource for which the alarm is generated.

  • Application
  • DB
  • Host

eventType

Integer

Alarm type.

  • 21: dynamic threshold alarm
  • 22: batch threshold alarm
  • 23: threshold alarm
  • 24: system alarm
  • 25: probe added or deleted
  • 26: Agent installation alarm
  • 27: Quota threshold-crossing alarm

probableCause

String

Possible causes.

proposedRepairActions

String

Handling suggestions.

Table 1 resourceId

Parameter

Type

Description

namespace

String

Resource type. The options are as follows:

  • PAAS.CONTAINER: container metrics
  • PAAS.NODE: node metrics

dimension

Object

Dimension information, which is associated with the node application information reported by the monitoring module. For details, see Table 2.

Currently, alarms are about nodes and applications. Therefore, you only need to pay attention to these two dimensions.

The application dimension covers service, instance, container, and process information. You can select one or more types of information to be reported.

  • Service information: clusterId, nameSpace, and serviceID
  • Instance information: podID and podName
  • Container information: containerID and containerName
  • Process information: processID and processName
Table 2 Dimension

Parameter

Type

Description

clusterId

String

Project ID. For details on how to obtain a project ID, see Obtaining a Project ID.

nameSpace

String

The default value is default.

nodeIP

String

Node IP address.

serviceID

String

Service ID.

  • For applications, the value is the MD5 value of {projectId}_{hostid}_{appName}.
  • For processes, the value is the MD5 value of {projectId}_{hostid}_{Process name}_{Process pid}.
  • processID can be calculated as follows: md5({projectId})_{hostid}_md5({Process name}) _{process pid}.

    md5(projectId) indicates the MD5 value of projectId, and md5({Process name}) indicates the MD5 value of the process name.

The dimension settings must be consistent with those reported by the monitoring module. Otherwise, the corresponding resources cannot be associated.

podID

String

Instance ID.

podName

String

Instance name.

containerID

String

Container ID.

containerName

String

Container name.

processID

String

Process ID.

processName

String

Process name.

Application

String

Application name.

Generating an alarmId

You do not need to use this method to generate the alarmId. However, you need to ensure that the alarmId is unique.

Generate the MD5 value of {projectId}_{Service name for which the alarm is generated}_{Dimension information}_{Metric name}_{Alarm type}_{Rule information}.

Where:

  • projectId: Project ID. For details on how to obtain a project ID, see Obtaining a Project ID.
  • Dimension information:
    • Node information: {clusterId}_{namespace}_{ip}
    • Container information: {clusterId}_{namespace}_{appName}_{podName}_{containerId}
    • Application information: {clusterId}_{namespace}_{appName}
  • Alarm type:
    • 21: dynamic threshold alarm
    • 22: batch threshold alarm
    • 23: threshold alarm
    • 24: system alarm
    • 25: probe added or deleted
    • 26: Agent installation alarm
  • Rule information: Set this field to a rule name for threshold alarms and to NA for alarms generated by the service itself. For dynamic threshold alarms, set this field to policyId.

Example

  • Node alarm
    {
       "alarmName": "test",
        "alarmId": "73ccbccce05de74f9d3dda42f6ecfe20",
        "detailedInformation": "test",
        "url": "",
        "source": "IEF",
        "cleared": false,
        "policyID": "",
        "perceivedSeverity": 4,
        "resourceId": {
            "namespace": "PAAS.NODE",
            "dimension": {
                "clusterId": "e277befa37a64ed1aa25b522e686bc28",
                "nameSpace": "default",
                "nodeIP": "192.168.0.164"
            }
        },
        "neType": "Host",
        "eventType": 23
    }
  • Application alarm:
    {
        "alarmName": "Application restart",
        "alarmId": "b09076ff565c59d4da0db0c9223781",
        "detailedInformation": "Application restart test",
        "url": "",
        "source": "IEF",
        "cleared": false,
        "policyID": "",
        "perceivedSeverity": 3,
        "resourceId": {
            "namespace": "PAAS.CONTAINER",
            "dimension": {
                "containerName": "container-e991acd3-864c-4038-8a90-e042eebab496",
                "containerID": "70b385315c8ac507b3de7dfe1258932cea0b53a850b7d030ce7ed0a55c47877c",
                "podID": "0e9ce4fd-b732-11e9-8a30-fa163e9b3546",
                "podName": "hxkapp1-7898f5bd4b-2lj8z"
            }
        },
        "neType": "Application",
        "eventType": 23
    }