⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sub_ht_sun_cfg.c

📁 电信硬件的信息数据采集程序
💻 C
字号:
#include "sub_ht_sun_cfg.h"/*******************************************************************************\| Name			: sub_ht_sun_gethostname				|						|| Description	: for KPI CM-00-01-01-01 :get host name				|| Input Param	: 								|							|| Output Param	:								|								|| Author		: kongque						|								|| History		: Oct.02.2003		kongque		create		||										|										||*******************************************************************************/void sub_ht_sun_gethostname(){	char FuncName[128] = {"sub_ht_sun_gethostname"};	char shellCommandStr[MAX_STRING_LENGTH];	struct KPIValue *pKPIValues = NULL;	char temp[VALUE_STRING_LENGTH];#ifdef DEBUG_OUT	sprintf(DebugMsg,"sub_ht_sun_gethostname Begin\n");	writeLog(FuncName,DebugMsg,DEBUG_MSG);#endif	memset(temp,'\0',sizeof(temp));	pKPIValues = malloc(sizeof(struct KPIValue));	if(!pKPIValues) {#ifdef ERROR_OUT		sprintf(DebugMsg,"malloc memory failed\n");		writeLog(FuncName,DebugMsg,ERROR_MSG);#endif		return;	}	memset(pKPIValues,'\0',sizeof(struct KPIValue));	getParameter(temp,(char *)SUB_HT_CONFIG_FILE,"subhtsungethostname.EntityID");	sprintf(pKPIValues->EntityID,"%s",temp);		sprintf(pKPIValues->CollTime,"%s",getDatetime());		memset(temp,'\0',sizeof(temp));	getParameter(temp,(char *)SUB_HT_CONFIG_FILE,"subhtsungethostname.KPIID");	sprintf(pKPIValues->KPIID,temp);		memset(temp,'\0',sizeof(temp));	gethostname(temp,sizeof(temp));	sprintf(pKPIValues->KPIValue,temp);	pKPIValues->next = NULL;		/* put KPI Value to Queue */	putKPIValueQueue(pKPIValues);#ifdef DEBUG_OUT	sprintf(DebugMsg,"sub_ht_sun_gethostname End\n");	writeLog(FuncName,DebugMsg,DEBUG_MSG);#endif	return;}/*******************************************************************************\| Name			: sub_ht_sun_getipaddress				|						|| Description	: for KPI CM-00-01-01-02 :get host ip address			|| Input Param	: 								|							|| Output Param	:								|								|| Author		: kongque						|								|| History		: Oct.02.2003		kongque		create		||										|										||*******************************************************************************/void sub_ht_sun_getipaddress(){	char FuncName[128] = {"sub_ht_sun_getipaddress"};	char shellCommandStr[MAX_STRING_LENGTH];	struct KPIValue *pKPIValues = NULL;	char temp[VALUE_STRING_LENGTH];#ifdef DEBUG_OUT	sprintf(DebugMsg,"sub_ht_sun_getipaddress Begin\n");	writeLog(FuncName,DebugMsg,DEBUG_MSG);#endif	memset(temp,'\0',sizeof(temp));	pKPIValues = malloc(sizeof(struct KPIValue));	if(!pKPIValues) {#ifdef ERROR_OUT		sprintf(DebugMsg,"malloc memory failed\n");		writeLog(FuncName,DebugMsg,ERROR_MSG);#endif		return;	}	memset(pKPIValues,'\0',sizeof(struct KPIValue));	getParameter(temp,(char *)SUB_HT_CONFIG_FILE,"subhtsungetipaddress.EntityID");	sprintf(pKPIValues->EntityID,"%s",temp);		sprintf(pKPIValues->CollTime,"%s",getDatetime());		memset(temp,'\0',sizeof(temp));	getParameter(temp,(char *)SUB_HT_CONFIG_FILE,"subhtsungetipaddress.KPIID");	sprintf(pKPIValues->KPIID,temp);		sprintf(pKPIValues->KPIValue,"10.105.2.245");	pKPIValues->next = NULL;		/* put KPI Value to Queue */	putKPIValueQueue(pKPIValues);#ifdef DEBUG_OUT	sprintf(DebugMsg,"sub_ht_sun_getipaddress End\n");	writeLog(FuncName,DebugMsg,DEBUG_MSG);#endif	return;}/*******************************************************************************\| Name			: sub_ht_sun_getvendor					|						|| Description	: for KPI CM-00-01-01-03 :get host vendor's name		|| Input Param	: 								|							|| Output Param	:								|								|| Author		: kongque						|								|| History		: Oct.02.2003		kongque		create		||										|										||*******************************************************************************/void sub_ht_sun_getvendor(){	char FuncName[128] = {"sub_ht_sun_getvendor"};	char shellCommandStr[MAX_STRING_LENGTH];	struct KPIValue *pKPIValues = NULL;	char temp[VALUE_STRING_LENGTH];#ifdef DEBUG_OUT	sprintf(DebugMsg,"sub_ht_sun_getvendor Begin\n");	writeLog(FuncName,DebugMsg,DEBUG_MSG);#endif	memset(temp,'\0',sizeof(temp));	pKPIValues = malloc(sizeof(struct KPIValue));	if(!pKPIValues) {#ifdef ERROR_OUT		sprintf(DebugMsg,"malloc memory failed\n");		writeLog(FuncName,DebugMsg,ERROR_MSG);#endif		return;	}	memset(pKPIValues,'\0',sizeof(struct KPIValue));	getParameter(temp,(char *)SUB_HT_CONFIG_FILE,"subhtsungetvendor.EntityID");	sprintf(pKPIValues->EntityID,"%s",temp);		sprintf(pKPIValues->CollTime,"%s",getDatetime());		memset(temp,'\0',sizeof(temp));	getParameter(temp,(char *)SUB_HT_CONFIG_FILE,"subhtsungetvendor.KPIID");	sprintf(pKPIValues->KPIID,temp);		sprintf(pKPIValues->KPIValue,"SUN");	pKPIValues->next = NULL;		/* put KPI Value to Queue */	putKPIValueQueue(pKPIValues);#ifdef DEBUG_OUT	sprintf(DebugMsg,"sub_ht_sun_getvendor End\n");	writeLog(FuncName,DebugMsg,DEBUG_MSG);#endif	return;}/*******************************************************************************\| Name			: sub_ht_sun_getcpunumber				|						|| Description	: for KPI CM-00-01-01-04 :get the number of cpu			|| Input Param	: 								|							|| Output Param	:								|								|| Author		: kongque						|								|| History		: Oct.02.2003		kongque		create		||										|										||*******************************************************************************/void sub_ht_sun_getcpunumber(){	char FuncName[128] = {"sub_ht_sun_getcpunumber"};	char shellCommandStr[MAX_STRING_LENGTH];	struct KPIValue *pKPIValues = NULL;	char temp[VALUE_STRING_LENGTH];#ifdef DEBUG_OUT	sprintf(DebugMsg,"sub_ht_sun_getcpunumber Begin\n");	writeLog(FuncName,DebugMsg,DEBUG_MSG);#endif	memset(temp,'\0',sizeof(temp));	pKPIValues = malloc(sizeof(struct KPIValue));	if(!pKPIValues) {#ifdef ERROR_OUT		sprintf(DebugMsg,"malloc memory failed\n");		writeLog(FuncName,DebugMsg,ERROR_MSG);#endif		return;	}	memset(pKPIValues,'\0',sizeof(struct KPIValue));	getParameter(temp,(char *)SUB_HT_CONFIG_FILE,"subhtsungetcpunumber.EntityID");	sprintf(pKPIValues->EntityID,"%s",temp);		sprintf(pKPIValues->CollTime,"%s",getDatetime());		memset(temp,'\0',sizeof(temp));	getParameter(temp,(char *)SUB_HT_CONFIG_FILE,"subhtsungetcpunumber.KPIID");	sprintf(pKPIValues->KPIID,temp);		sprintf(pKPIValues->KPIValue,"2");	pKPIValues->next = NULL;		/* put KPI Value to Queue */	putKPIValueQueue(pKPIValues);#ifdef DEBUG_OUT	sprintf(DebugMsg,"sub_ht_sun_getcpunumber End\n");	writeLog(FuncName,DebugMsg,DEBUG_MSG);#endif	return;}/*******************************************************************************\| Name			: sub_ht_sun_getcpumodel				|						|| Description	: for KPI CM-00-01-01-05 :get the model of cpu			|| Input Param	: 								|							|| Output Param	:								|								|| Author		: kongque						|								|| History		: Oct.02.2003		kongque		create		||										|										||*******************************************************************************/void sub_ht_sun_getcpumodel(){	char FuncName[128] = {"sub_ht_sun_getcpumodel"};	char shellCommandStr[MAX_STRING_LENGTH];	struct KPIValue *pKPIValues = NULL;	char temp[VALUE_STRING_LENGTH];#ifdef DEBUG_OUT	sprintf(DebugMsg,"sub_ht_sun_getcpumodel Begin\n");	writeLog(FuncName,DebugMsg,DEBUG_MSG);#endif	memset(temp,'\0',sizeof(temp));	pKPIValues = malloc(sizeof(struct KPIValue));	if(!pKPIValues) {#ifdef ERROR_OUT		sprintf(DebugMsg,"malloc memory failed\n");		writeLog(FuncName,DebugMsg,ERROR_MSG);#endif		return;	}	memset(pKPIValues,'\0',sizeof(struct KPIValue));	getParameter(temp,(char *)SUB_HT_CONFIG_FILE,"subhtsungetcpumodel.EntityID");	sprintf(pKPIValues->EntityID,"%s",temp);		sprintf(pKPIValues->CollTime,"%s",getDatetime());		memset(temp,'\0',sizeof(temp));	getParameter(temp,(char *)SUB_HT_CONFIG_FILE,"subhtsungetcpumodel.KPIID");	sprintf(pKPIValues->KPIID,temp);		sprintf(pKPIValues->KPIValue,"UltraSPARC-II");	pKPIValues->next = NULL;		/* put KPI Value to Queue */	putKPIValueQueue(pKPIValues);#ifdef DEBUG_OUT	sprintf(DebugMsg,"sub_ht_sun_getcpumodel End\n");	writeLog(FuncName,DebugMsg,DEBUG_MSG);#endif	return;}/*******************************************************************************\| Name			: sub_ht_sun_getcpufreq					|						|| Description	: for KPI CM-00-01-01-06 :get the frequence of cpu		|| Input Param	: 								|							|| Output Param	:								|								|| Author		: kongque						|								|| History		: Oct.02.2003		kongque		create		||										|										||*******************************************************************************/void sub_ht_sun_getcpufreq(){	char FuncName[128] = {"sub_ht_sun_getcpufreq"};	char shellCommandStr[MAX_STRING_LENGTH];	struct KPIValue *pKPIValues = NULL;	char temp[VALUE_STRING_LENGTH];#ifdef DEBUG_OUT	sprintf(DebugMsg,"sub_ht_sun_getcpufreq Begin\n");	writeLog(FuncName,DebugMsg,DEBUG_MSG);#endif	memset(temp,'\0',sizeof(temp));	pKPIValues = malloc(sizeof(struct KPIValue));	if(!pKPIValues) {#ifdef ERROR_OUT		sprintf(DebugMsg,"malloc memory failed\n");		writeLog(FuncName,DebugMsg,ERROR_MSG);#endif		return;	}	memset(pKPIValues,'\0',sizeof(struct KPIValue));	getParameter(temp,(char *)SUB_HT_CONFIG_FILE,"subhtsungetcpufreq.EntityID");	sprintf(pKPIValues->EntityID,"%s",temp);		sprintf(pKPIValues->CollTime,"%s",getDatetime());		memset(temp,'\0',sizeof(temp));	getParameter(temp,(char *)SUB_HT_CONFIG_FILE,"subhtsungetcpufreq.KPIID");	sprintf(pKPIValues->KPIID,temp);		sprintf(pKPIValues->KPIValue,"400MHz");	pKPIValues->next = NULL;		/* put KPI Value to Queue */	putKPIValueQueue(pKPIValues);#ifdef DEBUG_OUT	sprintf(DebugMsg,"sub_ht_sun_getcpufreq End\n");	writeLog(FuncName,DebugMsg,DEBUG_MSG);#endif	return;}/*******************************************************************************\| Name			: sub_ht_sun_getmemorysize				|						|| Description	: for KPI CM-00-01-01-07 :get the memory size			|| Input Param	: 								|							|| Output Param	:								|								|| Author		: kongque						|								|| History		: Oct.02.2003		kongque		create		||										|										||*******************************************************************************/void sub_ht_sun_getmemorysize(){	char FuncName[128] = {"sub_ht_sun_getmemorysiz"};	char shellCommandStr[MAX_STRING_LENGTH];	struct KPIValue *pKPIValues = NULL;	char temp[VALUE_STRING_LENGTH];#ifdef DEBUG_OUT	sprintf(DebugMsg,"sub_ht_sun_getmemorysiz Begin\n");	writeLog(FuncName,DebugMsg,DEBUG_MSG);#endif	memset(temp,'\0',sizeof(temp));	pKPIValues = malloc(sizeof(struct KPIValue));	if(!pKPIValues) {#ifdef ERROR_OUT		sprintf(DebugMsg,"malloc memory failed\n");		writeLog(FuncName,DebugMsg,ERROR_MSG);#endif		return;	}	memset(pKPIValues,'\0',sizeof(struct KPIValue));	getParameter(temp,(char *)SUB_HT_CONFIG_FILE,"subhtsungetmemorysize.EntityID");	sprintf(pKPIValues->EntityID,"%s",temp);		sprintf(pKPIValues->CollTime,"%s",getDatetime());		memset(temp,'\0',sizeof(temp));	getParameter(temp,(char *)SUB_HT_CONFIG_FILE,"subhtsungetmemorysize.KPIID");	sprintf(pKPIValues->KPIID,temp);		memset(temp,'\0',sizeof(temp));	getValueFromCmd(GET_MEM_SIZE_CMD,temp);	sprintf(pKPIValues->KPIValue,StrTrim(temp));	pKPIValues->next = NULL;		/* put KPI Value to Queue */	putKPIValueQueue(pKPIValues);#ifdef DEBUG_OUT	sprintf(DebugMsg,"sub_ht_sun_getmemorysize End\n");	writeLog(FuncName,DebugMsg,DEBUG_MSG);#endif	return;}/*******************************************************************************\| Name			: sub_ht_sun_getsysversion				|						|| Description	: for KPI CM-00-01-01-07 :get the system version		|| Input Param	: 								|							|| Output Param	:								|								|| Author		: kongque						|								|| History		: Oct.02.2003		kongque		create		||										|										||*******************************************************************************/void sub_ht_sun_getsysversion(){	char FuncName[128] = {"sub_ht_sun_getsysversion"};	char shellCommandStr[MAX_STRING_LENGTH];	struct KPIValue *pKPIValues = NULL;	char temp[VALUE_STRING_LENGTH];#ifdef DEBUG_OUT	sprintf(DebugMsg,"sub_ht_sun_getsysversion Begin\n");	writeLog(FuncName,DebugMsg,DEBUG_MSG);#endif	memset(temp,'\0',sizeof(temp));	pKPIValues = malloc(sizeof(struct KPIValue));	if(!pKPIValues) {#ifdef ERROR_OUT		sprintf(DebugMsg,"malloc memory failed\n");		writeLog(FuncName,DebugMsg,ERROR_MSG);#endif		return;	}	memset(pKPIValues,'\0',sizeof(struct KPIValue));	getParameter(temp,(char *)SUB_HT_CONFIG_FILE,"subhtsungetsysversion.EntityID");	sprintf(pKPIValues->EntityID,"%s",temp);		sprintf(pKPIValues->CollTime,"%s",getDatetime());		memset(temp,'\0',sizeof(temp));	getParameter(temp,(char *)SUB_HT_CONFIG_FILE,"subhtsungetsysversion.KPIID");	sprintf(pKPIValues->KPIID,temp);			memset(temp,'\0',sizeof(temp));	getValueFromCmd(GET_SYS_VERSION_CMD,temp);	sprintf(pKPIValues->KPIValue,StrTrim(temp));	pKPIValues->next = NULL;		/* put KPI Value to Queue */	putKPIValueQueue(pKPIValues);#ifdef DEBUG_OUT	sprintf(DebugMsg,"sub_ht_sun_getsysversion End\n");	writeLog(FuncName,DebugMsg,DEBUG_MSG);#endif	return;}/*******************************************************************************\| Name			: sub_ht_sun_getswapsize				|						|| Description	: for KPI CM-00-01-01-13 :get the swap size			|| Input Param	: 								|							|| Output Param	:								|								|| Author		: kongque						|								|| History		: Oct.02.2003		kongque		create		||										|										||*******************************************************************************/void sub_ht_sun_getswapsize(){	char FuncName[128] = {"sub_ht_sun_getswapsize"};	char shellCommandStr[MAX_STRING_LENGTH];	struct KPIValue *pKPIValues = NULL;	char temp[VALUE_STRING_LENGTH];#ifdef DEBUG_OUT	sprintf(DebugMsg,"sub_ht_sun_getswapsize Begin\n");	writeLog(FuncName,DebugMsg,DEBUG_MSG);#endif	memset(temp,'\0',sizeof(temp));	pKPIValues = malloc(sizeof(struct KPIValue));	if(!pKPIValues) {#ifdef ERROR_OUT		sprintf(DebugMsg,"malloc memory failed\n");		writeLog(FuncName,DebugMsg,ERROR_MSG);#endif		return;	}	memset(pKPIValues,'\0',sizeof(struct KPIValue));	getParameter(temp,(char *)SUB_HT_CONFIG_FILE,"subhtsungetswapsize.EntityID");	sprintf(pKPIValues->EntityID,"%s",temp);		sprintf(pKPIValues->CollTime,"%s",getDatetime());		memset(temp,'\0',sizeof(temp));	getParameter(temp,(char *)SUB_HT_CONFIG_FILE,"subhtsungetswapsize.KPIID");		sprintf(pKPIValues->KPIID,temp);		memset(temp,'\0',sizeof(temp));	getValueFromCmd(GET_SWAP_SIZE_CMD,temp);	sprintf(pKPIValues->KPIValue,StrTrim(temp));	pKPIValues->next = NULL;		/* put KPI Value to Queue */	putKPIValueQueue(pKPIValues);#ifdef DEBUG_OUT	sprintf(DebugMsg,"sub_ht_sun_getswapsize End\n");	writeLog(FuncName,DebugMsg,DEBUG_MSG);#endif	return;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -