private IEnumerable <KeyValuePair <Uri, HeartbeatDTO> > GetHeartbeatDtos()
        {
            if (!_config.Environments.Any())
            {
                return(new[]
                {
                    new KeyValuePair <Uri, HeartbeatDTO>(
                        GetHeartbeatUri(_config.NodeFrontUrl),
                        new HeartbeatDTO
                    {
                        name = Environment.MachineName,
                        url = _hostControlUrl,
                        apiKey = _config.ApiKey,
                        version = VersionUtil.GetAgentVersion(),
                        configVersion = _config.ConfigVersion,
                        @group = _config.AgentGroup,
                        loadBalancerState = _loadBalancerService.UseLoadBalanser ? _loadBalancerService.GetCurrentState() : null
                    })
                });
            }

            return
                (_config.Environments.Select(
                     env => new KeyValuePair <Uri, HeartbeatDTO>(GetHeartbeatUri(_config.NodeFrontUrl), new HeartbeatDTO
            {
                name = Environment.MachineName,
                url = _hostControlUrl,
                apiKey = _config.ApiKey,
                version = VersionUtil.GetAgentVersion(),
                configVersion = _config.ConfigVersion,
                @group = env.AgentGroup,
                loadBalancerState = _loadBalancerService.UseLoadBalanser ? _loadBalancerService.GetCurrentState() : null
            })));
        }
示例#2
0
 private void SendHeartbeat()
 {
     HttpPostJsonUpdate(GetHeartbeatUri(_config.NodeFrontUrl), new HeartbeatDTO
     {
         name              = Environment.MachineName,
         osPlatform        = "Windows",
         groups            = _config.GetAgentGroups(),
         url               = _hostControlUrl,
         apiKey            = _config.ApiKey,
         version           = VersionUtil.GetAgentVersion(),
         configVersion     = _config.ConfigVersion,
         loadBalancerState = _loadBalancerService.UseLoadBalancer ? _loadBalancerService.GetCurrentState() : null
     });
 }
示例#3
0
        public MainModule(IAsimovConfig config)
        {
            Get["/"] = _ => VersionUtil.GetAgentVersion();

            Get["/version"] = _ =>
            {
                var resp = new
                {
                    version       = VersionUtil.GetAgentVersion(),
                    configVersion = config.ConfigVersion
                };
                return(Response.AsJson(resp));
            };
        }
        public void Start()
        {
            try
            {
                ComponentRegistration.RegisterComponents();
                ComponentRegistration.ReadAndRegisterConfiguration();
                AddNodeFrontAppender();
                ComponentRegistration.StartStartableComponenters();

                var config = ObjectFactory.GetInstance <IAsimovConfig>();
                Log.InfoFormat("WinAgent Started, Version={0}, ConfigVersion={1}", VersionUtil.GetAgentVersion(), config.ConfigVersion);
            }
            catch (Exception e)
            {
                Log.Error("Error while starting AsimovDeployService", e);
                throw;
            }
        }
示例#5
0
        private void SendHeartbeat()
        {
            var heartBeat = new HeartbeatDTO
            {
                name          = Environment.MachineName,
                url           = _hostControlUrl,
                apiKey        = _config.ApiKey,
                version       = VersionUtil.GetAgentVersion(),
                configVersion = _config.ConfigVersion,
                group         = _config.AgentGroup
            };

            if (_loadBalancerService.UseLoadBalanser)
            {
                heartBeat.loadBalancerState = _loadBalancerService.GetCurrentState();
            }

            HttpPostJsonUpdate(_nodeFrontUri, heartBeat);
        }