From 144193da099f9b77f10af5102107df56ad60edaf Mon Sep 17 00:00:00 2001 From: Yosuke Hara Date: Tue, 12 Jul 2016 13:06:42 +0900 Subject: [PATCH 1/3] Fix leo-project/leofs/issues/485 --- src/leo_watchdog_cpu.erl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/leo_watchdog_cpu.erl b/src/leo_watchdog_cpu.erl index 786d587..4a0f866 100644 --- a/src/leo_watchdog_cpu.erl +++ b/src/leo_watchdog_cpu.erl @@ -143,10 +143,17 @@ handle_call(Id, #state{threshold_load_avg = ThresholdLoadAvg, raised_error_times = RaisedErrorTimes, cur_error_times = CurErrorTimes} = State) -> try - AVG_1 = erlang:round(cpu_sup:avg1() / 256 * 100), + AVG_1 = case catch cpu_sup:avg1() of + {'EXIT',_} -> + 0.0; + OrgAvg1 -> + erlang:round(OrgAvg1 / 256 * 100) + end, CPU_Util = case os:type() of {unix, linux} -> - case cpu_sup:util([per_cpu]) of + case catch cpu_sup:util([per_cpu]) of + {'EXIT',_} -> + 0; [] -> 0; Ret_CPUUtil -> From e2348b40c9d62a2e933b18b0bfa4b1b5a4f299f8 Mon Sep 17 00:00:00 2001 From: Yosuke Hara Date: Tue, 12 Jul 2016 13:16:38 +0900 Subject: [PATCH 2/3] To be able to build leo_commons with Erlang/OTP 19 --- rebar.config | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rebar.config b/rebar.config index f11e250..d6643b9 100644 --- a/rebar.config +++ b/rebar.config @@ -20,16 +20,15 @@ %% under the License. %% %%====================================================================== -{require_otp_vsn, "R16B*|17|18"}. +{require_otp_vsn, "R16B*|17|18|19"}. {deps, [ - {leo_commons, "1.*", {git, "https://github.com/leo-project/leo_commons.git", {tag, "1.1.6"}}}, + {leo_commons, "1.*", {git, "https://github.com/leo-project/leo_commons.git", {tag, "1.1.7"}}}, {elarm, ".*", {git, "https://github.com/leo-project/elarm.git", "d9e8a6f35c408c0c4dea8a15ddcf61f54cb8a826"}} ]}. {erl_opts, [{d, 'NOTEST'}, warn_obsolete_guard, - warnings_as_errors, warn_shadow_vars ]}. {xref_checks, [undefined_function_calls]}. From 5ce017808b1a6e8b952a1b33aaf118983bc417e0 Mon Sep 17 00:00:00 2001 From: Yosuke Hara Date: Mon, 8 Aug 2016 12:59:43 +0900 Subject: [PATCH 3/3] Bump leo_watchdog to 0.12.3 --- src/leo_watchdog.app.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/leo_watchdog.app.src b/src/leo_watchdog.app.src index 4cf0091..d40bf40 100644 --- a/src/leo_watchdog.app.src +++ b/src/leo_watchdog.app.src @@ -23,7 +23,7 @@ {application, leo_watchdog, [ {description, "leo_watchdog keep monitoring applications"}, - {vsn, "0.12.2"}, + {vsn, "0.12.3"}, {mod, {leo_watchdog_app, []}}, {registered, []}, {applications, [