TUXEDO使用TMIB系统管理
TUXEDO为我们对TUXEDO的管理提供了一整套的API接口,可惜的是ORACLE公司并未提供一套完整的接口文档,让TUXEDO开发人员无法很好的掌握,同时网络上几乎没有MIB开发方面的资料。
本文就以WSH为例来讲解如何先获取WSH 列表,然后单独获取每个WSH与客户端连接的CLIENTID,最后通过CLIENTID再获取IP的一个完整实例。这是一个完整的例子,结合上一讲的系统事件订阅可以完整的,实时的获取TUXEDO在线用户列表。
环境变量非常重要
FIELDTBLS=tpadm
FLDTBLDIR=${TUXDIR}/udataobj
export FIELDTBLS FLDTBLDIR
主要设置的tuxedo系统管理的FML格式文件名称和文件夹
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <atmi.h> /* TUXEDO Header File */
#include <userlog.h> /* TUXEDO Header File */
#include <fml32.h> /*MIB主要是FML操作,必须添加*/
#include <tpadm.h> /*我们主要操作系统数据,tmadm.h与环境变量中FML文件对应*/
#include <stdio.h>
#if defined(__STDC__) || defined(__cplusplus)
int tpsvrinit(int argc, char *argv[])
#else
int tpsvrinit(argc, argv)
int argc;
char **argv;
#endif
{
/* Some compilers warn if argc and argv aren't used. */
argc = argc;
argv = argv;
/* userlog writes to the central TUXEDO message log */
userlog((char*)"Welcome to the simple server");
return(0);
}
#ifdef __cplusplus
extern "C"
#endif
void
#if defined(__STDC__) || defined(__cplusplus)
TOUPPER(TPSVCINFO *rqst)
#else
TOUPPER(rqst)
TPSVCINFO *rqst;
#endif
{
FILE * fp;/*创建一个文件,用来记录中间过程*/
if((fp=fopen("./log","w"))==NULL)
{
userlog("create file faild.");
return;
}
/*获取WSH数量*/
/* Allocate input and output buffers */
FBFR32* ibuf=(FBFR32*)(tpalloc("FML32",NULL,1000));
FBFR32* obuf=(FBFR32*)(tpalloc("FML32",NULL,1000));
/* Set MIB(5) attributes def