此操作用来查询HBlock告警信息。
注意告警状态为告警中的数据存储上限为10000条,达到上限后,新的告警无法触发。届时请尽快解决相关故障,或者尝试手动解除告警。
请求语法
GET /rest/v1/system/alarm?alarmStatus=alarmStatus&filter=filter&range=i-j HTTP/1.1
Date: date
Host: ip:port
Authorization: authorization
请求参数
名称 描述 是否必须 alarmStatus 告警状态:
Unresolved:告警中。
Resolved:告警已解除。
Expired:告警已失效。
默认值为Unresolved。
说明已解除、已失效数据仅支持查询最近10000条。告警中的数据超出10000条告警,功能将不可用。
否 filter 设置查询的过滤条件。可以选择多个查询,如果是或的关系,使用or将查询条件分隔开;如果是与的关系,使用and将查询条件分隔开。
支持的查询类型包括:
instanceSnapshot:告警实例的详情。
alarmRule:告警规则编码名称,详见。
severity:告警级别:
Warning:警告。
Major:重要。
Critical:严重。
muteStatus:静默状态:
Normal:正常。
Muted:静默。
alarmTime:告警发生时间,通过>和<支持范围查询。unix时间戳(UTC),精确到毫秒。
resolveTime:解除时间,通过>和<支持范围查询。unix时间戳(UTC),精确到毫秒。
resolveType:告警解除方式:
Manual:手动解除警告。
Auto:自动解除告警。
expireTime:告警失效时间,通过>和<支持范围查询。unix时间戳(UTC),精确到毫秒。
否 range 查询范围,格式:i-j,其中i,j是正整数,i小于j,j-i < 1000。按照alarmTime进行逆序排序,返回第i条到第j条的告警。
如果输入的查询范围超过告警的总个数,那么返回空结果集。
如果不输入range参数,那么返回所有符合条件的告警。
否
响应结果
名称 描述 totalCount 符合查询条件的告警条数。 alarmList 告警列表,包含:alarmId、instanceId、instanceSnapshot、alarmRule、severity、alarmStatus、duration、alarmTime、muteStatus、alarmValue、currentValue、resolveTime、resolveValue、resolveType、expireTime、reason、muteDueTime、muteOperations。
类型:数组
alarmId 告警ID。 instanceId 告警实例ID。 instanceSnapshot 告警实例快照,即告警发生时告警实例的详细信息。 alarmRule 告警规则。 severity 告警级别:
Warning:警告。
Major:重要。
Critical:严重。
alarmStatus 告警状态:
Unresolved:告警中。
Resolved:告警已解除。
Expired:告警已失效。
duration 告警持续时长。unix时间戳(UTC),精确到毫秒。 alarmTime 告警发生时间。unix时间戳(UTC),精确到毫秒。 muteStatus 静默状态:
Muted:静默。
Normal:正常。
alarmValue 告警时数值。仅有数值型指标对应的告警会有返回此项,以下告警规则会涉及数值型指标:
AlarmNumberApproachingLimit:告警中的告警条数接近上限,显示告警中数据容量使用率,百分比,单位是%。计算公式:(告警中的告警总条数/告警中条数上限)*100%。
ResourceUsageApproachingLimit:资源用量接近使用上限,显示许可证可用容量使用率,百分比,单位是%。计算公式:(本地卷总容量/许可证允许的容量)*100%。
CapacityQuotaUsageExceedsThreshold:配额使用率超阈值,显示存储池或数据目录关联磁盘的配额使用率(Path_Cap_Quota_Rate),百分数,单位是%。
CapacityQuotaUsageApproachLimit:配额用尽,显示存储池或数据目录关联磁盘的配额使用率(Path_Cap_Quota_Rate),百分数,单位是%。
DiskUsageExceedsThreshold:磁盘使用率超阈值,显示存储池或数据目录关联磁盘的使用率(Path_Rate),百分数,单位是%。
InsufficientSpaceonInstallationPath:安装目录剩余空间不足,显示目录所在磁盘的文件系统剩余空间,单位是GiB。
currentValue 当前数值。仅有数值型指标对应的告警会有返回此项,以下告警规则会涉及数值型指标:
AlarmNumberApproachingLimit:告警中的告警条数接近上限,显示告警中数据容量使用率,百分比,单位是%。计算公式:(告警中的告警总条数/告警中条数上限)*100%。
ResourceUsageApproachingLimit:资源用量接近使用上限,显示许可证可用容量使用率,百分比,单位是%。计算公式:(本地卷总容量/许可证允许的容量)*100%。
CapacityQuotaUsageExceedsThreshold:配额使用率超阈值,显示存储池或数据目录关联磁盘的配额使用率(Path_Cap_Quota_Rate),百分数,单位是%。
CapacityQuotaUsageApproachLimit:配额用尽,显示存储池或数据目录关联磁盘的配额使用率(Path_Cap_Quota_Rate),百分数,单位是%。
DiskUsageExceedsThreshold:磁盘使用率超阈值,显示存储池或数据目录关联磁盘的使用率(Path_Rate),百分数,单位是%。
InsufficientSpaceonInstallationPath:安装目录剩余空间不足,显示目录所在磁盘的文件系统剩余空间,单位是GiB。
resolveTime 告警解除时间。unix时间戳(UTC),精确到毫秒。
Resolved状态的告警会返回此字段。
resolveValue 解除告警时的数值。仅有数值型指标对应的告警会有返回此项:
AlarmNumberApproachingLimit:告警中的告警条数接近上限,显示告警中数据容量使用率,百分比,单位是%。计算公式:(告警中的告警总条数/告警中条数上限)*100%。
ResourceUsageApproachingLimit:资源用量接近使用上限,显示许可证可用容量使用率,百分比,单位是%。计算公式:(本地卷总容量/许可证允许的容量)*100%。
CapacityQuotaUsageExceedsThreshold:配额使用率超阈值,显示存储池或数据目录关联磁盘的配额使用率(Path_Cap_Quota_Rate),百分数,单位是%。
CapacityQuotaUsageApproachLimit:配额用尽,显示存储池或数据目录关联磁盘的配额使用率(Path_Cap_Quota_Rate),百分数,单位是%。
DiskUsageExceedsThreshold:磁盘使用率超阈值,显示存储池或数据目录关联磁盘的使用率(Path_Rate),百分数,单位是%。
InsufficientSpaceonInstallationPath:安装目录剩余空间不足,显示目录所在磁盘的文件系统剩余空间,单位是GiB。
resolveType 告警解除方式:
Auto:自动解除。
Manual:手动解除。
expireTime 告警失效时间。
Expired状态的告警会返回此字段。
reason 告警解除原因或告警失效原因。 muteDueTime 静默截止时间,unix时间戳(UTC),精确到毫秒。
如果多次静默,返回最后一次操作的静默截止时间。
muteOperations 静默操作,包含:operTime、operType、reason、dueTime。
类型:数组
operTime 静默操作时间。 operType 静默操作类型:
Mute:静默。
AutoUnmute:自动解除静默。
ManualUnmute:手动解除静默。
reason 静默/解除静默的原因。 dueTime 静默截止时间。
请求示例1
查询告警中的告警信息。
GET /rest/v1/system/alarm?alarmStatus=Unresolved HTTP/1.1
Date: Mon, 8 Jan 2024 03:26:58 GMT
Host: 192.168.0.110:1443
Authorization: HBlock userName:signature
响应示例1
HTTP/1.1 200 OK
Date: Mon, 8 Jan 2024 03:26:58 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 1448
Connection: keep-alive
x-hblock-request-id: 0ba4372189a8470ca43fb8bea7959bf5
Server: HBlock
{
"data": {
"totalCount": 5,
"alarmList": [
{
"alarmId": "4jlSnwld",
"instanceId": "hblock_3:/mnt/stor",
"instanceSnapshot": "hblock_3:/mnt/stor",
"alarmRule": "CapacityQuotaUsageExceedsThreshold",
"severity": "Warning",
"alarmStatus": "Unresolved",
"duration": 346407,
"alarmTime": 1704684071663,
"alarmValue": "93.69",
"currentValue": "92.63",
"muteStatus": "Normal"
},
{
"alarmId": "4jlSnJ9h",
"instanceId": "hblock_3",
"instanceSnapshot": "hblock_3",
"alarmRule": "CapacityQuotaUsageExceedsThreshold",
"severity": "Warning",
"alarmStatus": "Unresolved",
"duration": 346861,
"alarmTime": 1704684071209,
"alarmValue": "93.69",
"currentValue": "92.63",
"muteStatus": "Normal"
},
{
"alarmId": "4jlSmXuZ",
"instanceId": "hblock_3:/mnt/stor",
"instanceSnapshot": "hblock_3,ecs-9689-0915140,192.168.0.102:/mnt/stor",
"alarmRule": "FaultDomainWarning",
"severity": "Warning",
"alarmStatus": "Unresolved",
"duration": 347413,
"alarmTime": 1704684070657,
"muteStatus": "Normal"
},
{
"alarmId": "4jlSmPPo",
"instanceId": "hblock_3:/mnt/stor",
"instanceSnapshot": "hblock_3,ecs-9689-0915140,192.168.0.102:/mnt/stor",
"alarmRule": "DataServiceHealthStatusWarning",
"severity": "Warning",
"alarmStatus": "Unresolved",
"duration": 347608,
"alarmTime": 1704684070462,
"muteStatus": "Normal"
},
{
"alarmId": "4jlhtUel",
"instanceId": "hblock_4",
"instanceSnapshot": "hblock_4,ecs-9689-0915141,192.168.0.202",
"alarmRule": "ProtocolServiceAbnormal",
"severity": "Major",
"alarmStatus": "Unresolved",
"duration": 2634530,
"alarmTime": 1704681783540,
"muteStatus": "Normal"
}
]
}
}
请求示例2
查询已解除的告警信息。
GET /rest/v1/system/alarm?alarmStatus=Resolved HTTP/1.1
Date: Mon, 8 Jan 2024 05:34:23 GMT
Host: 192.168.0.110:1443
Authorization: HBlock userName:signature
响应示例2
HTTP/1.1 200 OK
Date: Mon, 8 Jan 2024 05:34:23 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 3268
Connection: keep-alive
x-hblock-request-id: b47f7f2aae794363bc577eb304425122
Server: HBlock
{
"data": {
"totalCount": 10,
"alarmList": [
{
"alarmId": "4jlSnwld",
"instanceId": "hblock_3:/mnt/stor",
"instanceSnapshot": "hblock_3:/mnt/stor",
"alarmRule": "CapacityQuotaUsageExceedsThreshold",
"severity": "Warning",
"alarmStatus": "Resolved",
"duration": 603073,
"alarmTime": 1704684071663,
"alarmValue": "93.69",
"resolveTime": 1704684674736,
"resolveValue": "5.06",
"resolveType": "Auto",
"muteStatus": "Normal"
},
{
"alarmId": "4jlSnJ9h",
"instanceId": "hblock_3",
"instanceSnapshot": "hblock_3",
"alarmRule": "CapacityQuotaUsageExceedsThreshold",
"severity": "Warning",
"alarmStatus": "Resolved",
"duration": 603023,
"alarmTime": 1704684071209,
"alarmValue": "93.69",
"resolveTime": 1704684674232,
"resolveValue": "5.06",
"resolveType": "Auto",
"muteStatus": "Normal"
},
{
"alarmId": "4jlSmXuZ",
"instanceId": "hblock_3:/mnt/stor",
"instanceSnapshot": "hblock_3,ecs-9689-0915140,192.168.0.102:/mnt/stor",
"alarmRule": "FaultDomainWarning",
"severity": "Warning",
"alarmStatus": "Resolved",
"duration": 603430,
"alarmTime": 1704684070657,
"resolveTime": 1704684674087,
"resolveType": "Auto",
"muteStatus": "Normal"
},
{
"alarmId": "4jlSmPPo",
"instanceId": "hblock_3:/mnt/stor",
"instanceSnapshot": "hblock_3,ecs-9689-0915140,192.168.0.102:/mnt/stor",
"alarmRule": "DataServiceHealthStatusWarning",
"severity": "Warning",
"alarmStatus": "Resolved",
"duration": 602999,
"alarmTime": 1704684070462,
"resolveTime": 1704684673461,
"resolveType": "Auto",
"muteStatus": "Normal"
},
{
"alarmId": "4ilZH7wX",
"instanceId": "hblock_1",
"instanceSnapshot": "hblock_1,hblockserver,192.168.0.110",
"alarmRule": "ProtocolServiceAbnormal",
"severity": "Major",
"alarmStatus": "Resolved",
"duration": 230649424,
"alarmTime": 1704446197387,
"resolveTime": 1704676846811,
"resolveType": "Auto",
"muteStatus": "Normal"
},
{
"alarmId": "4hDwJnaH",
"instanceId": "hblock_3",
"instanceSnapshot": "hblock_3,ecs-9689-0915140,192.168.0.102",
"alarmRule": "ProtocolServiceAbnormal",
"severity": "Major",
"alarmStatus": "Resolved",
"duration": 361874,
"alarmTime": 1704275265260,
"resolveTime": 1704275627134,
"resolveType": "Auto",
"muteStatus": "Normal"
},
{
"alarmId": "4hD1BMWS",
"instanceId": "hblock_4",
"instanceSnapshot": "hblock_4,ecs-9689-0915141,192.168.0.202",
"alarmRule": "ProtocolServiceAbnormal",
"severity": "Major",
"alarmStatus": "Resolved",
"duration": 2291572,
"alarmTime": 1704273335042,
"resolveTime": 1704275626614,
"resolveType": "Auto",
"muteStatus": "Normal"
},
{
"alarmId": "4hD2AgSt",
"instanceId": "hblock_1:/mnt/stor",
"instanceSnapshot": "hblock_1,hblockserver,192.168.0.110:/mnt/stor",
"alarmRule": "FaultDomainError",
"severity": "Major",
"alarmStatus": "Resolved",
"duration": 61433,
"alarmTime": 1704273396083,
"resolveTime": 1704273457516,
"resolveType": "Auto",
"muteStatus": "Normal"
},
{
"alarmId": "4hD2zESY",
"instanceId": "hblock_1:/mnt/stor",
"instanceSnapshot": "hblock_1,hblockserver,192.168.0.110:/mnt/stor",
"alarmRule": "DataServiceHealthStatusError",
"severity": "Major",
"alarmStatus": "Resolved",
"duration": 61164,
"alarmTime": 1704273395799,
"resolveTime": 1704273456963,
"resolveType": "Auto",
"muteStatus": "Normal"
},
{
"alarmId": "4hCtBCK5",
"instanceId": "hblock_4:/mnt/storage01",
"instanceSnapshot": "hblock_4,ecs-9689-0915141,192.168.0.202:/mnt/storage01",
"alarmRule": "DataServiceHealthStatusError",
"severity": "Major",
"alarmStatus": "Resolved",
"duration": 60395,
"alarmTime": 1704271227603,
"resolveTime": 1704271287998,
"resolveType": "Auto",
"muteStatus": "Normal"
}
]
}
}
请求示例3
查询告警中、告警级别为Major的告警信息。
GET /rest/v1/system/alarm?alarmStatus=Unresolved&filter=severity:Major HTTP/1.1
Date: Mon, 8 Jan 2024 05:38:29 GMT
Host: 192.168.0.1110:1443
Authorization: HBlock userName:signature
响应示例3
HTTP/1.1 200 OK
Date: Mon, 8 Jan 2024 05:38:29 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 299
Connection: keep-alive
x-hblock-request-id: 988b145267ac41c886954b6f81598ec4
Server: HBlock
{
"data": {
"totalCount": 1,
"alarmList": [
{
"alarmId": "4jlhtUel",
"instanceId": "hblock_4",
"instanceSnapshot": "hblock_4,ecs-9689-0915141,192.168.0.202",
"alarmRule": "ProtocolServiceAbnormal",
"severity": "Major",
"alarmStatus": "Unresolved",
"duration": 10526372,
"alarmTime": 1704681783540,
"muteStatus": "Normal"
}
]
}
}