fix watchdog
This commit is contained in:
parent
02c48495bf
commit
58bbf45338
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user