From 58bbf45338dfd5b994f2a74fda252592e44ba609 Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Mon, 2 Sep 2024 17:11:05 +0800 Subject: [PATCH] fix watchdog --- apps/iot/src/iot_watchdog.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/iot/src/iot_watchdog.erl b/apps/iot/src/iot_watchdog.erl index b8bb9b7..9ce2756 100644 --- a/apps/iot/src/iot_watchdog.erl +++ b/apps/iot/src/iot_watchdog.erl @@ -133,7 +133,7 @@ handle_cast({detection, HostUUID, Name, Metric}, case length(Warnings) > 0 of true -> - Subject = iolist_to_binary([<<"主机: "/utf8>>, Name, <<"(">>, HostUUID, <<") ">>, lists:join(<<"|">>, lists:reverse(Warnings))]), + Subject = iolist_to_binary([<<"主机: "/utf8>>, Name, lists:join(<<"|">>, lists:reverse(Warnings))]), Body = format_warn(Subject, Users, PriKey), case catch do_post(Url, Body) of {ok, Resp} -> @@ -222,7 +222,7 @@ check_cpu_temperature(#{<<"cpu_temperature">> := CpuTemperature}, Config, Report Timestamp = iot_util:timestamp_of_seconds(), case is_number(CpuTemperature) andalso CpuTemperature > Threshold of true when TTL0 == 0 orelse TTL0 < Timestamp -> - Msg = unicode:characters_to_binary(io_lib:format("CPU温度超过:~p°C", [CpuTemperature])), + Msg = unicode:characters_to_binary(io_lib:format("CPU:~p°C", [CpuTemperature])), {error, Msg, Limiter#limiter{cpu_temperature = Timestamp + ReportInterval}}; _ -> ok @@ -236,7 +236,7 @@ check_disk(#{<<"disk">> := #{<<"total">> := Total, <<"used">> := Free}}, Config, case Total > 0 andalso (Used / Total) * 100 > Threshold of true when TTL0 == 0 orelse TTL0 < Timestamp -> Val = erlang:trunc((Used / Total) * 100), - Msg = unicode:characters_to_binary(io_lib:format("硬盘使用超过:~p%", [Val])), + Msg = unicode:characters_to_binary(io_lib:format("硬盘:~p%", [Val])), {error, Msg, Limiter#limiter{disk = Timestamp + ReportInterval}}; _ -> ok @@ -249,7 +249,7 @@ check_memory(#{<<"memory">> := #{<<"total">> := Total, <<"used">> := Used}}, Con case Total > 0 andalso (Used / Total) * 100 > Threshold of true when TTL0 == 0 orelse TTL0 < Timestamp -> Val = erlang:trunc((Used / Total) * 100), - Msg = unicode:characters_to_binary(io_lib:format("内存使用超过:~p%", [Val])), + Msg = unicode:characters_to_binary(io_lib:format("内存:~p%", [Val])), {error, Msg, Limiter#limiter{memory = Timestamp + ReportInterval}}; _ -> ok