告警

GET /api/v4/alarms

返回集群下当前告警信息。

Path Parameters:

Success Response Body (JSON):

NameTypeDescription
codeInteger0
dataArray of Objects各节点上的告警列表
data[0].nodeString节点名称
data[0].alarmsArray of Objects当前告警列表
data[0].alarms[0].nameString告警名称
data[0].alarms[0].messageString人类易读的告警信息
data[0].alarms[0].detailsObject告警详情
data[0].alarms[0].activate_atInteger告警激活时间,以微秒为单位的 UNIX 时间戳
data[0].alarms[0].deactivate_atInteger告警取消激活时间,以微秒为单位的 UNIX 时间戳
data[0].alarms[0].activatedBoolean是否激活

Examples:

  1. $ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/alarms"
  2. {"data":[{"node":"emqx@127.0.0.1","alarms":[{"name":"high_system_memory_usage","message":"System memory usage is higher than 60%","details":{"high_watermark":60},"deactivate_at":"infinity","activated":true,"activate_at":1597996203658236},{"name":"high_system_memory_usage","message":"System memory usage is higher than 60%","details":{"high_watermark":60},"deactivate_at":1597994359335482,"activated":false,"activate_at":1597993108657522}]}],"code":0}

GET /api/v4/nodes/{node}/alarms

返回指定节点下的告警信息。接口参数和返回请参看 GET /api/v4/alarms

Examples:

  1. $ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/nodes/emqx@127.0.0.1/alarms"
  2. {"data":[{"name":"high_system_memory_usage","message":"System memory usage is higher than 60%","details":{"high_watermark":60},"deactivate_at":"infinity","activated":true,"activate_at":1597996203658236},{"name":"high_system_memory_usage","message":"System memory usage is higher than 60%","details":{"high_watermark":60},"deactivate_at":1597994359335482,"activated":false,"activate_at":1597993108657522}],"code":0}

GET /api/v4/alarms/activated

返回集群下激活中的告警。接口参数和返回请参看 GET /api/v4/alarms

Examples:

  1. $ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/alarms/activated"
  2. {"data":[{"node":"emqx@127.0.0.1","alarms":[{"name":"high_system_memory_usage","message":"System memory usage is higher than 60%","details":{"high_watermark":60},"deactivate_at":"infinity","activated":true,"activate_at":1597996203658236}]}],"code":0}

GET /api/v4/nodes/{node}/alarms/activated

返回指定节点下激活中的告警。接口参数和返回请参看 GET /api/v4/alarms

Examples:

  1. $ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/nodes/emqx@127.0.0.1/alarms/activated"
  2. {"data":[{"name":"high_system_memory_usage","message":"System memory usage is higher than 60%","details":{"high_watermark":60},"deactivate_at":"infinity","activated":true,"activate_at":1597996203658236}],"code":0}

GET /api/v4/alarms/deactivated

返回集群下已经取消的告警。接口参数和返回请参看 GET /api/v4/alarms/activated

Examples:

  1. $ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/alarms/deactivated"
  2. {"data":[{"node":"emqx@127.0.0.1","alarms":[{"name":"high_system_memory_usage","message":"System memory usage is higher than 60%","details":{"high_watermark":60},"deactivate_at":1597994359335482,"activated":false,"activate_at":1597993108657522}]}],"code":0}

GET /api/v4/nodes/{node}/alarms/deactivated

返回指定节点下已经取消的告警。接口参数和返回请参看 GET /api/v4/alarms/activated

Examples:

  1. $ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/nodes/emqx@127.0.0.1/alarms/deactivated"
  2. {"data":[{"name":"high_system_memory_usage","message":"System memory usage is higher than 60%","details":{"high_watermark":60},"deactivate_at":1597994359335482,"activated":false,"activate_at":1597993108657522}],"code":0}

POST /api/v4/alarms/deactivated

取消指定告警。

Parameters (json):

NameTypeRequiredDefaultDescription
nodeStringRequired告警所在节点
nameStringRequired告警名称

Success Response Body (JSON):

NameTypeDescription
codeInteger0

Examples:

  1. $ curl -i --basic -u admin:public -vX POST "http://localhost:8081/api/v4/alarms/deactivated" -d '{"node":"emqx@127.0.0.1","name":"high_system_memory_usage"}'
  2. {"code":0}

DELETE /api/v4/alarms/deactivated

清除所有已经取消的告警。

Parameters (json):

Success Response Body (JSON):

NameTypeDescription
codeInteger0

Examples:

  1. $ curl -i --basic -u admin:public -X DELETE "http://localhost:8081/api/v4/alarms/deactivated"
  2. {"code":0}

DELETE /api/v4/nodes/{node}/alarms/deactivated

清除指定节点下所有已经取消的告警。

Parameters (json):

Success Response Body (JSON):

NameTypeDescription
codeInteger0

Examples:

  1. $ curl -i --basic -u admin:public -X DELETE "http://localhost:8081/api/v4/nodes/emqx@127.0.0.1/alarms/deactivated"
  2. {"code":0}