diff --git a/ChangeLog b/ChangeLog index f0a34f6..7be6fef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Version 5.5.0 (molinaro) + * vmstats can now be sent once a minute via mondemand when specified in the + application config file. A program id is required so a minimal config + might be something like + { vmstats, [ { program_id, mondemand } ] } + in addition a context could be added via a context parameter with a + 2-tuple list as an argument like + { vmstats, [ { program_id, mondemand }, {context, [{foo,bar}]} ] } + Version 5.4.2 (molinaro) * problem with context deserialization diff --git a/mondemand_dev.config b/mondemand_dev.config index c23782a..6a5a49c 100644 --- a/mondemand_dev.config +++ b/mondemand_dev.config @@ -1,6 +1,7 @@ [ { mondemand, [ - { lwes_channel, { 1, [ { "127.0.0.1", 20602 } ] } } %, + { lwes_channel, { 1, [ { "127.0.0.1", 20602 } ] } }, + { vmstats, [ { program_id, mondemand } ] } % { lwes_channel, { 2, [{"127.0.0.1",20602}, {"172.16.107.128", 20602}] } } %, % { config_file, "mondemand.conf" } % { send_interval, 5 } diff --git a/src/mondemand.app.src b/src/mondemand.app.src index 1f60f77..6eb9cfb 100644 --- a/src/mondemand.app.src +++ b/src/mondemand.app.src @@ -1,7 +1,7 @@ { application, mondemand, [ { description, "Erlang Mondemand Bindings." }, - { vsn, "5.4.2" }, + { vsn, "5.5.0" }, { modules, [] }, { registered, [mondemand,mondemand_sup]}, { applications, [kernel,stdlib,lwes]}, diff --git a/src/mondemand.erl b/src/mondemand.erl index 22ba7e3..428fa8c 100644 --- a/src/mondemand.erl +++ b/src/mondemand.erl @@ -250,6 +250,17 @@ send_stats (ProgId, Context, Stats) -> send_event (Event). flush () -> + case application:get_env (mondemand, vmstats) of + {ok, L} when is_list (L) -> + case proplists:get_value (program_id, L) of + undefined -> ok; + ProgId -> + Context = proplists:get_value (context, L, []), + VmStats = mondemand_vmstats:to_mondemand (), + send_stats (ProgId, Context, VmStats) + end; + _ -> ok + end, mondemand_statdb:flush (1, fun flush_one/1). reset_stats () -> diff --git a/src/mondemand_sup.erl b/src/mondemand_sup.erl index a72db3a..c280fdb 100644 --- a/src/mondemand_sup.erl +++ b/src/mondemand_sup.erl @@ -23,16 +23,20 @@ init([]) -> VMStatsChild = case application:get_env (mondemand, vmstats) of - {ok, true} -> - [ - { mondemand_vmstats, - {mondemand_vmstats, start_link, []}, - permanent, - 2000, - worker, - [mondemand_vmstats] - } - ]; + {ok, L} when is_list (L) -> + case proplists:get_value (program_id, L) of + undefined -> []; + _ -> + [ + { mondemand_vmstats, + {mondemand_vmstats, start_link, []}, + permanent, + 2000, + worker, + [mondemand_vmstats] + } + ] + end; _ -> [] end,