diff options
| author | Michael Klishin <mklishin@pivotal.io> | 2019-05-29 14:29:44 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-29 14:29:44 +0100 |
| commit | e7166314e4e661c9d87b4bcc8d2d2aa496ef27b7 (patch) | |
| tree | 6dbe3971306bbc958d1c3c8eecb8bb19daf1a3cd /src | |
| parent | aeb23f71a3dd6584aadc090fc4e104483e621695 (diff) | |
| parent | d6f4bdc10a7e752e4b19a1db0e5c5a7d83a3fccd (diff) | |
| download | rabbitmq-server-git-e7166314e4e661c9d87b4bcc8d2d2aa496ef27b7.tar.gz | |
Merge pull request #2018 from rabbitmq/rabbitmq-cli-302
'check' function for health check of virtual hosts
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_vhost_sup_sup.erl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/rabbit_vhost_sup_sup.erl b/src/rabbit_vhost_sup_sup.erl index 46a2b485f2..d9d6091c39 100644 --- a/src/rabbit_vhost_sup_sup.erl +++ b/src/rabbit_vhost_sup_sup.erl @@ -30,6 +30,7 @@ save_vhost_process/2]). -export([delete_on_all_nodes/1, start_on_all_nodes/1]). -export([is_vhost_alive/1]). +-export([check/0]). %% Internal -export([stop_and_delete_vhost/1]). @@ -260,3 +261,20 @@ vhost_restart_strategy() -> transient -> transient; permanent -> permanent end. + +check() -> + VHosts = rabbit_vhost:list(), + lists:filter( + fun(V) -> + case rabbit_vhost_sup_sup:get_vhost_sup(V) of + {ok, Sup} -> + MsgStores = [Pid || {Name, Pid, _, _} <- supervisor:which_children(Sup), + lists:member(Name, [msg_store_persistent, + msg_store_transient])], + not is_vhost_alive(V) orelse (not lists:all(fun(P) -> + erlang:is_process_alive(P) + end, MsgStores)); + {error, _} -> + true + end + end, VHosts). |
