Beispiel #1
0
        public static IConsulRegistration AddTTLCheck(this IConsulRegistration registration, TimeSpan ttl, TimeSpan interval, TimeSpan deregisterFailedAfter)
        {
            var ttlCheck = new AgentCheckRegistration
            {
                DockerContainerID = Environment.MachineName,
                DeregisterCriticalServiceAfter = deregisterFailedAfter,
                Interval = interval,
                TTL      = ttl,
                Name     = $"TTL check"
            };

            registration.AddHealthCheck(ttlCheck);

            return(registration);
        }
Beispiel #2
0
        public static IConsulRegistration AddHttpCheck(this IConsulRegistration registration, int port, string relativePath, TimeSpan interval, TimeSpan deregisterFailedAfter)
        {
            var url       = $"{registration.Address}:{port}{relativePath}";
            var httpCheck = new AgentCheckRegistration
            {
                DockerContainerID = Environment.MachineName,
                DeregisterCriticalServiceAfter = deregisterFailedAfter,
                Interval = interval,
                HTTP     = url,
                Name     = $"HTTP GET {url} check"
            };

            registration.AddHealthCheck(httpCheck);

            return(registration);
        }