beautypg.com

5 client api interface – HP 2000SA G2-Modular-Smart-Array User Manual

Page 35

background image

5 Client API Interface

Client applications can use any supported client interface that is supported by the Pegasus CIMOM.
Please refer to

http://cvs.opengroup.org/pegasus-doc/ClientInterfaces.html

for more details on the

client interfaces supplied by Open Pegasus.

Provided below is a sample C++ client application to collect Disk asset information using the HP
MSA2000 G2 proxy provider. This application assumes that the proxy provider has already been
configured to manage at least one MSA2000 G2 system.

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

PEGASUS_USING_PEGASUS;

PEGASUS_USING_STD;

static AtomicInt errorCount(0);

Array instanceRef;

void connectClient(

CIMClient *client,

String host,

Uint32 portNumber,

String userName,

String password,

Boolean useSSL,

Boolean localConnection,

Uint32 timeout)

{

try

{

client->setTimeout(timeout);

if (useSSL)

{

cout << "SSL not supported " << endl;

exit(1);

}

else

{

if (localConnection)

{

cout << "Using local connection mechanism " << endl;

client->connectLocal();

}

else

{

cout << "Connecting to " << host << ":" << portNumber << endl;

client->connect (host, portNumber, userName, password);

#define NAMESPACE CIMNamespaceName ("root/HPQ")

#define CLASSNAME CIMName ("DHS_TopComputerSystem")

// Locate the Top Computer System instance

Array cimNInstances =

client->enumerateInstances(NAMESPACE, CLASSNAME,

MSA2000 G2 SMI-S Proxy Provider User Guide

35

This manual is related to the following products: