PureEngage On-Premises

 View Only

Sign Up

  • 1.  StatServerProtocol

    Posted 05-11-2016 21:23
    I am trying to fetch the Queue statistics from stat server using the Platform SDK StatServerProtocol but i am not getting the Total_Calls_Entered stat from it, below is the code snippet:


    confServerProtocol =
    new ConfServerProtocol(
    new Endpoint("CSProxy","host",port));
    confServerProtocol.setUserName("User name");
    confServerProtocol.setClientName("Client Name that i enter during GA login");
    confServerProtocol.setUserPassword("PWD");
    System.out.println("Initializing Config Protocol");
    confServerProtocol.setClientApplicationType(CfgAppType.CFGSCE.ordinal());
    IConfService confService = ConfServiceFactory.createConfService(confServerProtocol);
    confServerProtocol.open();
    System.out.println("Config Protocol Opened ");
    statProtocol = new StatServerProtocol(
    new Endpoint(
    "Statserver App Name",
    "Host name",
    Port));
    statProtocol.setClientName("Statserver App Name");
    System.out.println("Initializing Protocol");
    System.out.println("Stat Protocol Opening ");
    statProtocol.open();
    System.out.println("Stat Protocol Opened ");

    requestOpenStatistic
    = RequestOpenStatistic.create();
    object = StatisticObject.create();
    object.setObjectId(qName);
    object.setObjectType(StatisticObjectType.Queue);
    object.setTenantName("Resources");
    object.setTenantPassword("");
    metric = StatisticMetric.create();
    metric.setStatisticType("Total_Calls_Entered");
    notification = Notification.create();
    notification.setMode(NotificationMode.NoNotification);
    notification.setFrequency(5);
    requestOpenStatistic.setStatisticObject(object);
    requestOpenStatistic.setStatisticMetric(metric);
    requestOpenStatistic.setNotification(notification);
    requestOpenStatistic.setReferenceId(2);
    System.out.println("Sending:\n" + requestOpenStatistic);
    statProtocol.send(requestOpenStatistic);
    //statProtocol.setCopyResponse(true);
    response = statProtocol.request(requestOpenStatistic);
    //System.out.println("Stat response is"+response.toString());
    //System.out.println("Stat Detail is"+statProtocol.receive().toString());
    for (int i=0; i < 4; ++i) {
    System.out.println("Stat Detail is"+statProtocol.receive(-1));
    }
    System.out.println(statProtocol.request(RequestCloseStatistic.create(2)));
    statProtocol.close();
    confServerProtocol.close();


    I am getting response as below:

    Sending:
    'RequestOpenStatistic' (1034) attributes:
    StatisticMetric:
    STATTYPE [str] = "Total_Calls_Entered"
    REQ_ID [int] = 2
    StatisticObject:
    TENANT_ID [str] = "Resources"
    OBJECT [int] = 5 [Queue]
    TENANT_PASSWORD [str] = [output suppressed]
    OBJECT_ID [str] = "VQ_Name@SIPSwitch"
    Notification:
    TM_NOTIFICATION_FREQ [int] = 5
    NOTIFICATION_MODE [int] = 2 [NoNotification]
    INSENS_PERCENTAGE [int] = 0
    Stat Detail is'EventServerMode' (23) attributes:
    TM_LENGTH [int] = 1462987272
    LONG_VALUE [int] = 1
    USER_REQ_ID [int] = 0
    TM_SERVER [int] = 1462987272
    REQ_ID [int] = 0


    Please let me know if i am missing anything as i dont get the stats?
     


  • 2.  RE: StatServerProtocol

    Posted 05-13-2016 09:03
    What are you trying to do, do you want just to get the value for the statistic and then close the connection or do you want to recieve notifications over a period of time?

    You have the Notification Mode set to NoNotification
     
    notification.setMode(NotificationMode.NoNotification);
    notification.setFrequency(5);



    If you want to receive periodic updates of the stat then set the Notification mode to Periodic, or if you want an immediate update of the stat change  the Notification mode to Immediate.

    Or if you just want to get a one off value for the stat you will need to peek the value using RequestPeekStatistic

     
    StatServerProtocol statProtocol = new StatServerProtocol(new Endpoint("Stat_Server", "demosrv", 7006));
    			statProtocol.setClientName("Statserver App Name");
    			System.out.println("Initializing Protocol");
    			System.out.println("Stat Protocol Opening ");
    			statProtocol.open();
    			System.out.println("Stat Protocol Opened ");
    
    			RequestOpenStatistic requestOpenStatistic = RequestOpenStatistic.create();
    			StatisticObject object = StatisticObject.create();
    			object.setObjectId("2272@SIP_Switch");
    			object.setObjectType(StatisticObjectType.Queue);
    			object.setTenantName("Environment");
    			object.setTenantPassword("");
    			StatisticMetric metric = StatisticMetric.create();
    			metric.setStatisticType("Total_Calls_Entered");
    			Notification notification = Notification.create();
    			notification.setMode(NotificationMode.NoNotification);
    			notification.setFrequency(5);
    			requestOpenStatistic.setStatisticObject(object);
    			requestOpenStatistic.setStatisticMetric(metric);
    			requestOpenStatistic.setNotification(notification);
    			requestOpenStatistic.setReferenceId(1);
    			System.out.println("Sending:\n" + requestOpenStatistic);
    			//statProtocol.send(requestOpenStatistic);
    			// statProtocol.setCopyResponse(true);
    			Message response = statProtocol.request(requestOpenStatistic);
    			
    			//If the stat has been opened you can then peek the value
    			if(response instanceof EventStatisticOpened)
    			{
    				RequestPeekStatistic requestPeek = RequestPeekStatistic.create(1);
    				Message responsePeek = statProtocol.request(requestPeek);
    				System.out.println(responsePeek);
    			}
    			
    			System.out.println(statProtocol.request(RequestCloseStatistic.create(1)));
    			statProtocol.close();



    The Peek statistic will return an EventInfo

    'EventInfo' (2) attributes:
    TM_LENGTH [int] = 865
    REQ_ID [int] = 1
    USER_REQ_ID [int] = -1
    STRING_VALUE [str] = "0"
    TM_SERVER [int] = 1463130074
    LONG_VALUE [int] = 0


  • 3.  RE: StatServerProtocol

    Posted 05-13-2016 19:58
    Hi Hoyle,
    Thanks for the answer.
    I was trying one time fetch of statistic as it is going to be scheduled as services and will run every one hour to fetch the stats.
    I have tried the Peek stats but it is not getting me a correct value :
    'RequestOpenStatistic' (1034) attributes:
    StatisticMetric:
    STATTYPE [str] = "Total_Calls_Entered"
    REQ_ID [int] = 1
    StatisticObject:
    TENANT_ID [str] = "Resources"
    OBJECT [int] = 5 [Queue]
    TENANT_PASSWORD [str] = [output suppressed]
    OBJECT_ID [str] = "VQ_FI_CE_MM_DEPOSITS_REGULAR@MMK_FID1_SIPSwitch"
    Notification:
    TM_NOTIFICATION_FREQ [int] = 15
    NOTIFICATION_MODE [int] = 1 [Periodical]
    INSENS_PERCENTAGE [int] = 0
    Peek response'EventInfo' (2) attributes:
    TM_LENGTH [int] = 55872
    LONG_VALUE [int] = 5
    USER_REQ_ID [int] = -1
    STRING_VALUE [str] = "5"
    TM_SERVER [int] = 1463167872
    REQ_ID [int] = 1

    but CCPluse has value 3 as Entered call as below.

                                                         CallsWaiting DistributAbandonEnteredAnswered
    VQ_FI_CE_MM_DEPOSITS_PRIORITY    0   0   0   0   0
    VQ_FI_CE_MM_DEPOSITS_REGULAR    0   3   0   3   3


  • 4.  RE: StatServerProtocol

    Posted 05-16-2016 13:13
    It depends on how your CCPulse statistic is configured. What Interval type does it have? Which Time profile does it use etc..

    In your code you do not have a time profile applied and so  if you just peek the stat it will just start at 0 after being opened and then keep increasing. You may need to apply a time profile to match you CCPulse stat.


  • 5.  RE: StatServerProtocol

    Posted 05-18-2016 16:53
    Hi Hoyle ,
    Thanks for the reply !
    I think still i dont have luck .

    In the latest SDK there is a provision to mention the notification mode ,time interval mode & insensitivity as below.
    notification = Notification.create(NotificationMode.Periodical, 30, 1);

    and I used the RequestPeekStatistic to print the value but it returns the statistic ID as an output instead of stat value

    Code Snippet :

    if(response instanceof EventStatisticOpened)
    {
    RequestPeekStatistic requestPeek = RequestPeekStatistic.create();
    requestPeek.setStatisticId(requestOpenStatistic.getReferenceId());
    System.out.println("Response Peek "+requestPeek);
    statProtocol.send(requestPeek); }

    OUT Put :

    Sending:
    'RequestOpenStatistic' (1034) attributes:
    StatisticMetric:
    STATTYPE [str] = "Total_Calls_Entered"
    REQ_ID [int] = 2
    StatisticObject:
    TENANT_ID [str] = "Resources"
    OBJECT [int] = 5 [Queue]
    TENANT_PASSWORD [str] = [output suppressed]
    OBJECT_ID [str] = "VQ_FI_CE_MM_DEPOSITS_REGULAR@MMK_FID1_SIPSwitch"
    Notification:
    TM_NOTIFICATION_FREQ [int] = 30
    NOTIFICATION_MODE [int] = 1 [Periodical]
    INSENS_PERCENTAGE [int] = 1
    Response Peek 'RequestPeekStatistic' (1027) attributes:
    ASSOC_REQ_ID [int] = 2