External Measurement API
Sample Program
Sample Program
This sample UNIX program is an example of how the three methods can be used. It prompts for the name of the system to connect to and the measurement name and value to supply to the service level SLO.
To successfully run this program, you must first configure the service level SLO. The measurement name you type in response to the measurement name prompt must match the name you configured for the SLO.
#include <stdio.h> #include <time.h> #include <math.h> #include <stdlib.h>
#include </opt/webqos/include/qosExternMeasApi.h> #define MAX_TOKEN 64
/******************************************************************************
*******************************************************************************
*SOURCE FILE : Test.c
*PURPOSE : A sample test program that invokes the methods in the external
*measurement API and changes the statistic values. It makes the
*following three calls to the API.
*
*1. wqStatus wqCreateConnection(char *hostname, wqSocket *socket):This
*call sets up the connection with the SCI. This method returns an
*integer indicating success or failure.
*
*2. wqStatus wqSendMeasurement(wqSocket socket, char *xmlString): This
*call sends the xml string to the SCI, again returning an integer to
*success or failure.
*
*3. wqStatus wqCloseConnection(wqSocket socket): This call closes the
*connection between the SCI and the API.
*
*******************************************************************************
*******************************************************************************/
void main()
{
char | xmlString[WQ_MAX_XML_STRING_SIZE]; |
|
char | measName[MAX_TOKEN]; | // Measurement Name |
140 | Appendix B |