Example #1
0
        private static async Task DumpClusterHealthAsync(FabricClient fc)
        {
            FabricClient.HealthClient hm = fc.HealthManager;

            ClusterHealth clusterHealth = await hm.GetClusterHealthAsync();

            WriteLine($"Cluster: State={clusterHealth.AggregatedHealthState}");
            foreach (HealthEvent healthEvent in clusterHealth.HealthEvents)
            {
                healthEvent.WriteHealth();
            }
            foreach (HealthEvaluation healthEval in clusterHealth.UnhealthyEvaluations)
            {
                WriteLine(healthEval);
            }
            foreach (NodeHealthState nodeHealth in clusterHealth.NodeHealthStates)
            {
                WriteLine($"Node: State={nodeHealth.AggregatedHealthState}, Name={nodeHealth.NodeName}");
            }
            foreach (ApplicationHealthState appHealthState in clusterHealth.ApplicationHealthStates)
            {
                WriteLine($"App: State={appHealthState.AggregatedHealthState}, Name={appHealthState.ApplicationName}");
            }


            //await hm.GetNodeHealthAsync()
            ApplicationHealth appHealth = await hm.GetApplicationHealthAsync(new Uri(@"fabric:/"));

            WriteLine($"App: State={appHealth.AggregatedHealthState}, Name={appHealth.ApplicationName}");
            foreach (HealthEvent healthEvent in appHealth.HealthEvents)
            {
                healthEvent.WriteHealth();
            }
        }