Genesys CTI User Forum

Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: kerry.finlayson on January 16, 2015, 12:58:33 PM

Title: Stat Server WarmStandby
Post by: kerry.finlayson on January 16, 2015, 12:58:33 PM
Hey folks,

I am building a third party app which registers and opens a number of statistics.  I have implemented the warm standby connection to my stat servers but I am having some issues.  I am registering for a number of stats and when the stat servers are failed over I get an event to advise me this has happened but I don't automatically receive any updates on the registered stats.  Now I am finding it difficult to get any information on whether in a warm standby situation the failed over stat server has details of the stats which we registered against?  Should I expect that I should still have registrations against statistics for my app?

I was under the impression that in a warm standby scenario both servers would have knowledge of the connections and registered stats or do I need to go and re-register on the failed over server?

This is my connection code:

private void Connect()
        {

            try
            {
                PropertyConfiguration conf = new PropertyConfiguration();
                conf.SetOption("protocol", "addp");
                conf.SetOption(AddpInterceptor.TimeoutKey, "10");
                conf.SetOption(AddpInterceptor.RemoteTimeoutKey, "10");
                conf.SetOption(AddpInterceptor.TraceKey, "both");

                Endpoint primaryEndpoint = new Endpoint(_statServerName, _statServerPrimaryHostName, _statServerPrimaryPort, conf);
                Endpoint backUpEndpoint;
                if (_statServerSecondaryHostName != "")
                {
                    backUpEndpoint = new Endpoint(_statServerName, _statServerSecondaryHostName, _statServerSecondaryPort, conf);
                }
                else
                {
                    backUpEndpoint = new Endpoint(_statServerName, "", _statServerPrimaryPort, conf);
                    TpsLogManager<StatisticQueryEngine>.Error("Error : StatsQueryEngine - " + _statServerName + " Backup is blank");
                    _managementServer.SendMessageToMessageServer(97014, LogCategory.Alarm, LogLevel.Alarm, "Error : StatsQueryEngine - " + _statServerName + " Backup is blank");
                }

                statServerProtocol = new StatServerProtocol(primaryEndpoint)
                {
                    ClientId = _statisticRefId,
                    ClientName = _clientName,

                };

                statServerProtocol.Closed += statServerProtocol_Closed;
                var warmStandbyConfig = new WarmStandbyConfiguration(primaryEndpoint, backUpEndpoint)
                {
                    Timeout = 5000,
                    Attempts = 2
                };


                var warmStandby = new WarmStandbyService(statServerProtocol);
                warmStandby.ApplyConfiguration(warmStandbyConfig);
                warmStandby.Channel.Opened += Channel_Opened;
                warmStandby.Channel.Closed += Channel_Closed;
                warmStandby.StateChanged += warmStandby_StateChanged;
                warmStandby.SwitchedOver += warmStandby_SwitchedOver;


                warmStandby.Start();
                warmStandby.Channel.BeginOpen();

                _eventBrokerService = BrokerServiceFactory.CreateEventBroker(statServerProtocol);
                TpsLogManager<StatisticQueryEngine>.Debug(_statServerPrimaryHostName + " :Statistic broker service created");

                _eventBrokerService.Register(OnEventInfo);
                TpsLogManager<StatisticQueryEngine>.Debug(_statServerPrimaryHostName + " :Statistic handler registered.");


                //Activate event broker service
                _eventBrokerService.Activate();
                TpsLogManager<StatisticQueryEngine>.Debug(_statServerPrimaryHostName + " :Event Broker Service Activate.");
                TpsLogManager<StatisticQueryEngine>.Info(statServerProtocol.State.ToString());
            }
            catch (Exception e)
            {
                TpsLogManager<StatisticQueryEngine>.Error("Error : StatsQueryEngine : " + e.Message);
            }
        }

I would appreciate any help you can provide and would appreciate if you can see anything in the code above which could be causing my issue.

Thanks in advance,
Kerry.
Title: Re: Stat Server WarmStandby
Post by: cavagnaro on January 16, 2015, 01:28:07 PM
Why Warm and not Hot?? On Hot they sync everything. On Warm they sync basic data but the backup is passive until you make it Main
Title: Re: Stat Server WarmStandby
Post by: Kubig on January 16, 2015, 01:37:26 PM
StatServer does not support pure Hot-Standby mode. Just WarmStandby.
Title: Re: Stat Server WarmStandby
Post by: cavagnaro on January 16, 2015, 06:47:19 PM
[quote author=Kubig link=topic=8674.msg38426#msg38426 date=1421415446]
StatServer does not support pure Hot-Standby mode. Just WarmStandby.
[/quote]
True...my bad :D
Title: Re: Stat Server WarmStandby
Post by: Adam G on January 17, 2015, 10:03:31 AM
Might be the config - or your misinterpretation of how Warm Standby works...

Do your StatServers have connections, as Objects in CIM/CME?
Are they set as Warm Standby's for one another, in CIM/CME?
Check documentation for any other Platform Settings required for Warm Standby of a StatServer.
Test both StatServers on Failover and Failback(with CCPulse+?) to ensure Stats are updating, without your code.

HTH?

AG
Title: Re: Stat Server WarmStandby
Post by: Kubig on January 19, 2015, 12:40:56 PM
I strongly recommend to configure StatServer with option allow-clients-in-backup-mode (does not know the exactly name of the option) to true => this allows you to connect to the backup statserver too and receive required stats.
Title: Re: Stat Server WarmStandby
Post by: kerry.finlayson on January 20, 2015, 12:00:25 PM
Hi Kubig,

That worked!  ;D

Thanks so much for your help folks, really made my day when this worked.  This has been haunting us for a while.

Kerry.