From c6a571c20770a46dcfb7a51c1e2f09176e362bcc Mon Sep 17 00:00:00 2001 From: zhongwencool Date: Thu, 13 Jan 2022 17:41:16 +0800 Subject: [PATCH 1/2] chore(alarm): support license alarm type --- src/emqx_alarm.erl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/emqx_alarm.erl b/src/emqx_alarm.erl index 62ce1af8b..53cd9561d 100644 --- a/src/emqx_alarm.erl +++ b/src/emqx_alarm.erl @@ -375,6 +375,8 @@ normalize_message(high_cpu_usage, #{usage := Usage}) -> list_to_binary(io_lib:format("~p% cpu usage", [Usage])); normalize_message(too_many_processes, #{usage := Usage}) -> list_to_binary(io_lib:format("~p% process usage", [Usage])); +normalize_message(license_usage, #{high_watermark := High}) -> + iolist_to_binary(["License: the number of connections exceeds ", High, "%"]); normalize_message(partition, #{occurred := Node}) -> list_to_binary(io_lib:format("Partition occurs at node ~s", [Node])); normalize_message(<<"resource", _/binary>>, #{type := Type, id := ID}) -> From 7c0d70cfde9ac20191e17213b3d779c3b2a38fc8 Mon Sep 17 00:00:00 2001 From: zhongwencool Date: Fri, 14 Jan 2022 00:31:56 +0800 Subject: [PATCH 2/2] feat(license): license expriy early alarm. --- src/emqx_alarm.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/emqx_alarm.erl b/src/emqx_alarm.erl index 53cd9561d..de1fbadb8 100644 --- a/src/emqx_alarm.erl +++ b/src/emqx_alarm.erl @@ -375,8 +375,10 @@ normalize_message(high_cpu_usage, #{usage := Usage}) -> list_to_binary(io_lib:format("~p% cpu usage", [Usage])); normalize_message(too_many_processes, #{usage := Usage}) -> list_to_binary(io_lib:format("~p% process usage", [Usage])); -normalize_message(license_usage, #{high_watermark := High}) -> +normalize_message(license_quota, #{high_watermark := High}) -> iolist_to_binary(["License: the number of connections exceeds ", High, "%"]); +normalize_message(license_expiry, #{expiry_at := ExpiryAt}) -> + iolist_to_binary(["License will be expired at ", ExpiryAt]); normalize_message(partition, #{occurred := Node}) -> list_to_binary(io_lib:format("Partition occurs at node ~s", [Node])); normalize_message(<<"resource", _/binary>>, #{type := Type, id := ID}) ->