Quantcast
Channel: High Availability (Clustering) forum
Viewing all articles
Browse latest Browse all 5654

Problem getting information of the cluster

$
0
0

 

Hi!! I´m doing an application in c++ with Cluster API, I need to recover information of the cluster, now I have this

 

#include

"stdafx.h"

#include

"ClusDocEx.h"// from MS, this include  #include<ClusApi.h>

 

void

main()

{

HCLUSTER hCluster = NULL;

HGROUP hGroup = NULL;

HRESOURCE hResource = NULL;

HCLUSENUM hEnum;

HGROUPENUM hGroupEnum;

HRESENUM hResourceEnum;

 

DWORD chName;

DWORD chNameGroup;

DWORD chNameResource;

DWORD dwType;

DWORD dwIndex = 0;

DWORD dwIndexGroup = 0;

DWORD dwIndexResource = 0;

DWORD cbNameSize = 0;

WCHAR szName[512];

WCHAR szNameGroup[9000];

WCHAR szNameResource[9000];

//WCHAR szAddressData[9000];

DWORD dwCluster = ERROR_SUCCESS;

DWORD dwResult = ERROR_SUCCESS;

DWORD dwResultGroup = ERROR_SUCCESS;

DWORD dwResultResource = ERROR_SUCCESS;

DWORD dwGetIp = ERROR_SUCCESS;

hCluster = OpenCluster( L

"CICNAS" );

if

(hCluster == NULL)

{

printf(

"\nNo se encontro el Cluster");Sleep(1000);

}

else

{

hEnum = ClusterOpenEnum(hCluster,CLUSTER_ENUM_GROUP);

if(hEnum == NULL)

{

printf(

"\nCluster fue Encontrado pero no se puede abrir");Sleep(1000);

}

else

{

printf(

"\nSe Encontro el Cluster!!!");Sleep(1000);

while( dwResult == ERROR_SUCCESS )

{

chName =

sizeof (szName);

dwResult = ClusterEnum(hEnum,dwIndex,&dwType, szName,&chName);

if(dwResult == ERROR_SUCCESS)

{

printf(

"\n\tNombre del Grupo= ");Sleep(1000);

int i=0;

while(szNameIdea)

{

printf(

"%c",szNameIdea);

i++;

}

hGroup = OpenClusterGroup(hCluster,szName);

if(hGroup == NULL)

{

printf(

"\n\tNo existen Grupos");Sleep(1000);

}

else

{

ClusterGroupOpenEnum(hGroup,CLUSTER_GROUP_ENUM_NODES|CLUSTER_GROUP_ENUM_CONTAINS);

hGroupEnum = ClusterGroupOpenEnum(hGroup,CLUSTER_GROUP_ENUM_CONTAINS);

if(hGroupEnum == NULL)

{

printf(

"\n\tError al recorrer Grupos");Sleep(1000);

}

else

{

dwResultGroup = ERROR_SUCCESS;

dwIndexGroup = 0;

while( dwResultGroup == ERROR_SUCCESS )

{

chNameGroup =

sizeof (szNameGroup);

dwResultGroup = ClusterGroupEnum(hGroupEnum,dwIndexGroup,&dwType, szNameGroup,&chNameGroup);

if(dwResultGroup == ERROR_SUCCESS)

{

printf(

"\n\t\tszNameGroup s = ");Sleep(1000);

int i=0;

while(szNameGroupIdea)

{

printf(

"%c",szNameGroupIdea);

i++;

}

hResource = OpenClusterResource(hCluster,szNameGroup);

if(hResource == NULL)

{

printf(

"\n\t\tError!!!");

}

else

{

ClusterResourceOpenEnum(hResource,CLUSTER_RESOURCE_ENUM_NODES|CLUSTER_RESOURCE_ENUM_DEPENDS);

hResourceEnum = ClusterResourceOpenEnum(hResource,CLUSTER_RESOURCE_ENUM_NODES);

if(hResourceEnum == NULL)

{

printf(

"\n\t\tError!!!");

}

else

{

dwResultResource = ERROR_SUCCESS;

dwIndexResource = 0;

while (dwResultResource == ERROR_SUCCESS)

{

chNameResource =

sizeof(szNameResource);

dwResultResource = ClusterResourceEnum(hResourceEnum,dwIndexResource,&dwType,szNameResource,&chNameResource);

if(dwResultResource == ERROR_SUCCESS)

{

int i=0;

while(szNameResourceIdea)

{

i++;

}

}

dwIndexResource++;

}

}

}

}

elseif(dwResultGroup == ERROR_NO_MORE_ITEMS)

{

printf(

"\n\tFin Grupo");Sleep(3000);

}

elseif( dwResultGroup == ERROR_MORE_DATA)

{

printf(

"\n\tNo mas grupos");Sleep(3000);

}

else

{

printf(

"\n\tError!!!!");Sleep(1000);

}

dwIndexGroup++;

}

}

}

}

dwIndex++;

}

}

dwResult = GetLastError();

}

SetLastError( dwResult );

}

 

I  recover the Group Name, the name of the Shares, the Networks Names and the Physical Disk but I need the Ip addres of each Group, the complete path of each File Share and the permission of each File Share, I investigate a lot but I don´t found infomation, Please Help Me!!!!!

 

 

Thanks

 

Roger


Viewing all articles
Browse latest Browse all 5654

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>