summaryrefslogtreecommitdiff
path: root/statusserver/src/statusserver.erl
diff options
context:
space:
mode:
Diffstat (limited to 'statusserver/src/statusserver.erl')
-rw-r--r--statusserver/src/statusserver.erl12
1 files changed, 7 insertions, 5 deletions
diff --git a/statusserver/src/statusserver.erl b/statusserver/src/statusserver.erl
index 323b28d..f38bf69 100644
--- a/statusserver/src/statusserver.erl
+++ b/statusserver/src/statusserver.erl
@@ -17,9 +17,10 @@ request(post, ?APPURL_PLOP_STATUS, Service, Input) ->
Entries when is_list(Entries) ->
lists:foreach(fun ({struct, PropList}) ->
Target = proplists:get_value(<<"target">>, PropList),
+ Source = proplists:get_value(<<"source">>, PropList),
Variable = proplists:get_value(<<"key">>, PropList),
Status = proplists:get_value(<<"value">>, PropList),
- set_status(Service, Target, Variable, Status)
+ set_status(Service, Source, Target, Variable, Status)
end, Entries)
end,
success({[{result, <<"ok">>}]});
@@ -27,11 +28,12 @@ request(get, "", "status", Input) ->
Now = erlang:monotonic_time(millisecond),
Variables = [{struct, [
{service, list_to_binary(Service)},
+ {source, Source},
{target, Target},
{variable, Variable},
{status, Status},
{age, (Now - Timestamp) / 1000}
- ]} || {{Service, Target, Variable}, Status, Timestamp} <- get_status()],
+ ]} || {{Service, Source, Target, Variable}, Status, Timestamp} <- get_status()],
success({[{result, Variables}]}).
@@ -63,9 +65,9 @@ create_statusdb() ->
get_status() ->
[E || [E] <- ets:match(?STATUSDB_TABLE, '$1')].
-set_status(Service, Target, Variable, Status) ->
- lager:info("status: ~p ~p ~p ~p", [Service, Target, Variable, Status]),
+set_status(Service, Source, Target, Variable, Status) ->
+ lager:info("status: ~p ~p ~p ~p ~p", [Service, Source, Target, Variable, Status]),
Timestamp = erlang:monotonic_time(millisecond),
true = ets:insert(?STATUSDB_TABLE,
- {{Service, Target, Variable}, Status, Timestamp}),
+ {{Service, Source, Target, Variable}, Status, Timestamp}),
ok.