当前位置: 首页>>代码示例>>C++>>正文


C++ Oam::itoa方法代码示例

本文整理汇总了C++中Oam::itoa方法的典型用法代码示例。如果您正苦于以下问题:C++ Oam::itoa方法的具体用法?C++ Oam::itoa怎么用?C++ Oam::itoa使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Oam的用法示例。


在下文中一共展示了Oam::itoa方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: diskMonitor

/*****************************************************************************************
* @brief	diskMonitor Thread
*
* purpose:	Get current Local and External disk usage and report alarms
*
*****************************************************************************************/
void diskMonitor()
{
	ServerMonitor serverMonitor;
	Oam oam;
    SystemConfig systemConfig;
	ModuleTypeConfig moduleTypeConfig;
	typedef std::vector<std::string> LocalFileSystems;
	LocalFileSystems lfs;
	struct statvfs buf; 

	// set defaults
	int localDiskCritical = 90,
		localDiskMajor = 80,
		localDiskMinor = 70,
		ExternalDiskCritical = 90,
		ExternalDiskMajor = 80,
		ExternalDiskMinor = 70;

	// get module types
	string moduleType;
	int moduleID=-1;
	string moduleName;
	oamModuleInfo_t t;
	try {
		t = oam.getModuleInfo();
		moduleType = boost::get<1>(t);
		moduleID = boost::get<2>(t);
		moduleName = boost::get<0>(t);
	}
	catch (exception& e) {}

	bool Externalflag = false;

	//check for external disk
	DBrootList dbrootList;
	if (moduleType == "pm") {
		systemStorageInfo_t t;
		t = oam.getStorageConfig();
		if ( boost::get<0>(t) == "external")
			Externalflag = true;

		// get dbroot list and storage type from config file
		DBRootConfigList dbrootConfigList;
		oam.getPmDbrootConfig(moduleID, dbrootConfigList);
	
		DBRootConfigList::iterator pt = dbrootConfigList.begin();
		for( ; pt != dbrootConfigList.end() ; pt++)
		{
			int dbrootID = *pt;
	
			string dbroot = "DBRoot" + oam.itoa(dbrootID);
	
			string dbootdir;
			try{
				oam.getSystemConfig(dbroot, dbootdir);
			}
			catch(...) {}
	
			if ( dbootdir.empty() || dbootdir == "" )
				continue;
	
			DBrootData dbrootData;
			dbrootData.dbrootDir = dbootdir;
			dbrootData.downFlag = false;
	
			dbrootList.push_back(dbrootData);
		}
	}

	string cloud = oam::UnassignedName;
	try {
		oam.getSystemConfig( "Cloud", cloud);
	}
	catch(...) {
		cloud = oam::UnassignedName;
	}

	//get Gluster Config setting
	string GlusterConfig = "n";
	try {
		oam.getSystemConfig( "GlusterConfig", GlusterConfig);
	}
	catch(...)
	{
		GlusterConfig = "n";
	}

	int diskSpaceCheck = 0;

	while(true)
	{
		SystemStatus systemstatus;
		try {
			oam.getSystemStatus(systemstatus);
//.........这里部分代码省略.........
开发者ID:dmitrikr,项目名称:infinidb,代码行数:101,代码来源:diskMonitor.cpp

示例2: main

int main(int argc, char *argv[])
{
	Oam oam;
	vector <string> queryDirectory;
	vector <string> queryID;

	// get latest set of svn queries
//	system("rm -rf /root/genii/ > /dev/null 2>&1");
	system("updateGenii.pl > /dev/null 2>&1");

	system("rm -rf /home/qa/bldqry/mysql/* > /dev/null 2>&1");

	string cronFile = "/root/calpontBuildTest";
	unlink(cronFile.c_str());

	// get query directory list
	string topQueryfileName = "/tmp/topQuerydirs";
	string secondQueryfileName = "/tmp/secondQuerydirs";
	string queryfileName = "/home/qa/bldqry/mysql/querydirs";

	string cmd = "ls /root/genii/mysql/queries/. > " + topQueryfileName;
	system(cmd.c_str());

	ifstream file (topQueryfileName.c_str());
	if (!file) {
		cout << " Error: can't open " + topQueryfileName << endl;
		exit (-1);
	}

	char line[200];
	string topQueryDir;
	while (file.getline(line, 200))
	{
		topQueryDir = line;
		if ( topQueryDir.find("queryTester",0) != string::npos || topQueryDir == "Makefile" )
			continue;

		// only do working queries for now
		if ( topQueryDir.find("working",0) == string::npos)
			continue;

		string cmd = "ls /root/genii/mysql/queries/" + topQueryDir + "/. > " + secondQueryfileName;
		system(cmd.c_str());
	
		ifstream file (secondQueryfileName.c_str());
		if (file) {
			char line[200];
			string buf;
			while (file.getline(line, 200))
			{
				buf = line;
				if ( buf.empty() )
					continue;
				string tempdir =  topQueryDir + "/" + buf;
				queryDirectory.push_back(tempdir);
			}
		}
		file.close();
	}

	file.close();

	if ( queryDirectory.size() == 0 ) {
		cout << endl << "Error: no query sub-directories located" << endl;
		exit (-1);
	}

	// get query list for each query directory
	int test = 1;
	std::vector<std::string>::iterator pt1 = queryDirectory.begin();
	for( ; pt1 != queryDirectory.end() ; pt1++)
	{
		string directory = *pt1;
		string::size_type pos = directory.find("/",0);
		if (pos != string::npos)
		{
			string setName;
			setName = directory.substr(0, pos);
			setName = setName + "-";
			setName = setName + directory.substr(pos+1, 200);
		
			string cmd = "cd /home/qa/bldqry/mysql/;echo " + setName + ".sql > " + oam.itoa(test) + ".txt";
			system(cmd.c_str());
			queryID.push_back(oam.itoa(test));
			test++;
	
			cmd = "rm -f /home/qa/bldqry/mysql/" + setName + ".sql";
			system(cmd.c_str());
	
			cmd = "cat /root/genii/mysql/queries/" + directory + "/*.sql >> /home/qa/bldqry/mysql/" + setName +  ".sql";
			system(cmd.c_str());
		}
	}

	// setup calpontBuildTest cron job with directories
	string cronFileTemplate = "/root/calpontBuildTest.template";

	ifstream cfile (cronFileTemplate.c_str());
	if (!cfile) {
		cout << endl << "Error: " + cronFileTemplate + " not found" << endl;
//.........这里部分代码省略.........
开发者ID:Kangmo,项目名称:infinidb,代码行数:101,代码来源:svnQuery.cpp

示例3: main

int main(int argc, char *argv[])
{
    Oam oam;
	string systemUser = "root";
	string installParentModuleHostName;
	string password;
	string debug_flag = "1";
 	string systemName = "all";
	bool VERBOSE = false;

	Config* sysConfig = Config::makeConfig("./systems/CalpontSystems.xml");

   for( int i = 1; i < argc; i++ )
   {
      if( string("-h") == argv[i] ) {
			cout << endl;
			cout << "'stackReleaseChecker' retrieves and prints the release installed on a stack." << endl;
			cout << endl;
			cout << "The list of systems are located in './systems/CalpontSystems.xml" << endl;
			cout << endl;
   			cout << "Usage: stackReleaseChecker [-h][-s system][-v]" << endl;
			cout << "			-s system-name or leave blank for all systems" << endl;
			cout << "			-v verbose will give the version numbers" << endl;
			exit (0);
		}
      	else if( string("-s") == argv[i] ) {
			i++;
			if ( argc == i ) {
				cout << "ERROR: missing system argument" << endl;
				exit(-1);
			}
			systemName = argv[i];
		}
		else if( string("-v") == argv[i] )
			VERBOSE = true;
   }

	int systemCount;
	try {
		systemCount = strtol(sysConfig->getConfig("NetworkConfig", "SystemCount").c_str(), 0, 0);
		if ( systemCount == 0 ) {
			cout << "ERROR: SystemCount in ./systems/CalpontSystems.xml equal to 0" << endl;
			exit(-1);
		}
	}
	catch(...)
	{
		cout << "ERROR: Problem getting SystemCount from ./systems/CalpontSystems.xml" << endl;
		exit(-1);
	}

	bool FOUND = false;
	for ( int i = 1 ; i < systemCount+1 ; i++)
	{
		string SystemName = "SystemName" + oam.itoa(i);
		string oamParentModule = "OAMParentModule" + oam.itoa(i);
		string SystemPassword = "SystemPassword" + oam.itoa(i);
		string SystemUser = "SystemUser" + oam.itoa(i);

		string tempSystem;
		try {
			tempSystem = sysConfig->getConfig("NetworkConfig", SystemName );
		}
		catch(...)
		{
			cout << "ERROR: Problem getting SystemName from ./systems/CalpontSystems.xml" << endl;
			exit(-1);
		}

		if ( tempSystem == systemName || systemName == "all") {
			try {
				installParentModuleHostName = sysConfig->getConfig("NetworkConfig", oamParentModule );
				password = sysConfig->getConfig("NetworkConfig", SystemPassword );
				systemUser = sysConfig->getConfig("NetworkConfig", SystemUser );
				FOUND = true;
			}
			catch(...)
			{
				cout << "ERROR: Problem getting SystemName from ./systems/CalpontSystems.xml" << endl;
				exit(-1);
			}

			if ( tempSystem == "unassigned")
				continue;

			//get if root or no-root user install
			string installDir = "/usr/local";
			if ( systemUser != "root" )
				installDir = "/home/" + systemUser;

			installDir = installDir + "/Calpont";

			string cmd;
			if (!VERBOSE)
				cmd = "./remote_command.sh " + installParentModuleHostName + " " + systemUser + " " + password + " 'cat " + installDir + "/releasenum' 'release=' cat: 10 " + debug_flag;
			else
				cmd = "./remote_command.sh " + installParentModuleHostName + " " + systemUser + " " + password + " '" + installDir + "/bin/calpontConsole getcalpontsoftware' 'tools' Error 10 " + debug_flag;

			cout << "***** Calpont InfiniDB Package Release Information for stack '" << tempSystem << "' *****" << endl << endl;

//.........这里部分代码省略.........
开发者ID:DYFeng,项目名称:infinidb,代码行数:101,代码来源:stackReleaseChecker.cpp

示例4: main


//.........这里部分代码省略.........
	catch(...)
	{ }

	try {
		 sysConfigNew->setConfig(SystemSection, "SystemLang", systemLang);
	}
	catch(...)
	{}

	//setup HA IP Address
	string HA_IPadd;
	try {
		HA_IPadd = sysConfigOld->getConfig("ProcMgr_HA", "IPAddr");
	}
	catch(...)
	{ }

	if ( !HA_IPadd.empty() ) {
		try {
			sysConfigNew->setConfig("ProcMgr_HA", "IPAddr", HA_IPadd);
		}
		catch(...)
		{
			cout << "ERROR: Problem setting ProcMgr_HA from the Calpont System Configuration file" << endl;
			exit(-1);
		}
	}

	//setup CMP IP Addresses
	string CMP_IPadd;
	string CMP_port;
	for ( int id = 1 ;; id ++ )
	{
		string cmpName = "CMP" + oam.itoa(id);
		try {
			CMP_IPadd = sysConfigOld->getConfig(cmpName, "IPAddr");
		}
		catch(...)
		{ }
	
		if ( !CMP_IPadd.empty() ) {
			try {
				CMP_port = sysConfigOld->getConfig(cmpName, "Port");
			}
			catch(...)
			{ }

			try {
				sysConfigNew->setConfig(cmpName, "IPAddr", CMP_IPadd);
				sysConfigNew->setConfig(cmpName, "Port", CMP_port);
			}
			catch(...)
			{
				cout << "ERROR: Problem setting CMP from the Calpont System Configuration file" << endl;
				exit(-1);
			}
		}
		else
			break;
	}

	//setup module and process monitor settings
	string ModuleHeartbeatPeriod = "3";
	string ModuleHeartbeatCount = "1";
	string ProcessRestartCount = "3";
	string ProcessRestartPeriod = "1";
开发者ID:Kangmo,项目名称:infinidb,代码行数:67,代码来源:autoConfigure.cpp

示例5: main


//.........这里部分代码省略.........
				childmodule.hostName = moduleHostName;
				childmodulelist.push_back(childmodule);
			}
			
			if (moduleName == parentOAMModule.moduleName)
			{
				parentOAMModule.moduleIP = moduleIPAddr;
				parentOAMModule.hostName = moduleHostName;
				parentOAMModule.moduleName = moduleName;
			}
		}
	} //end of i for loop

	// create a clean Calpont Support Report
	system("rm -f *_configReport.txt");
	system("rm -f *_dbmsReport.txt");
	system("rm -f *_hardwareReport.txt");
	system("rm -f *_logReport.txt");
	system("rm -f *_bulklogReport.txt");
	system("rm -f *_resourceReport.txt");
	system("rm -f *_softwareReport.txt");
	system("rm -f hadoopReport.txt");

	//
	// Software
	//

	if ( SOFTWARE ) {
		string reportType = "software";
		pthread_t reportthread;
		int status = pthread_create (&reportthread, NULL, (void*(*)(void*)) &reportThread, &reportType);

		if ( status != 0 ) {
			cout <<  "ERROR: reportthread: pthread_create failed, return status = " + oam.itoa(status);
		}

		sleep(5);
	}

	//
	// Configuration
	//

	if ( CONFIG ) {
		string reportType = "config";
		pthread_t reportthread;
		int status = pthread_create (&reportthread, NULL, (void*(*)(void*)) &reportThread, &reportType);

		if ( status != 0 ) {
			cout <<  "ERROR: reportthread: pthread_create failed, return status = " + oam.itoa(status);
		}

		sleep(5);
	}

	//
	// Alarms and Calpont Logs
	//

	if ( LOG ) {
		string reportType = "log";
		pthread_t reportthread;
		int status = pthread_create (&reportthread, NULL, (void*(*)(void*)) &reportThread, &reportType);

		if ( status != 0 ) {
			cout <<  "ERROR: reportthread: pthread_create failed, return status = " + oam.itoa(status);
开发者ID:greenlion,项目名称:mariadb-columnstore-engine,代码行数:67,代码来源:calpontSupport.cpp

示例6: reportThread

void reportThread(string reporttype)
{
	string reportType = reporttype;
	
	string installDir(startup::StartUp::installDir());
	Oam oam;

	pthread_mutex_lock( &mutex1 );
	runningThreads++;
//cout << "++ " << runningThreads << endl;
	pthread_mutex_unlock( &mutex1 );

	string outputFile = localModule + "_" + reportType + "Report.txt";

	// run on child servers and get report
	if (!LOCAL)
	{
		ChildModuleList::iterator list1 = childmodulelist.begin();
		for (; list1 != childmodulelist.end() ; list1++)
		{
			threadInfo_t *st = new threadInfo_t;
			*st = boost::make_tuple(list1, reportType);

			pthread_t childreportthread;
			int status = pthread_create (&childreportthread, NULL, (void*(*)(void*)) &childReportThread, st);
	
			if ( status != 0 ) {
				cout <<  "ERROR: childreportthread: pthread_create failed, return status = " + oam.itoa(status) << endl;
			}

			sleep(1);
		}
	}

	// run report on local server
	cout << "Get " + reportType + " report data for " + localModule  << endl;

	if (reportType == "log")
	{
			string cmd = installDir + "/bin/logReport.sh " + localModule + " " + installDir;
			system(cmd.c_str());

			cmd = "mv -f /tmp/" + localModule + "_logReport.tar.gz .";
			system(cmd.c_str());

			cmd = "tar -zcf " + localModule + "_mysqllogReport.tar.gz " + installDir + "/mysql/db/*.err* 2>/dev/null";
			system(cmd.c_str());
	
			// run log config on local server
			cout << "Get log config data for " + localModule << endl;
	
			cmd = "echo ' ' >> " + outputFile;
			system(cmd.c_str());
			cmd = "echo '******************** Log Configuration  ********************' >> " + outputFile;
			system(cmd.c_str());
			cmd = "echo ' ' >> " + outputFile;
			system(cmd.c_str());
			cmd = "echo '################# mcsadmin getLogConfig ################# ' >> " + outputFile;
			system(cmd.c_str());
			cmd = "echo ' ' >> " + outputFile;
			system(cmd.c_str());
			cmd = installDir + "/bin/mcsadmin getLogConfig >> " + outputFile;
			system(cmd.c_str());
	}
	else
	{
		//get local report
		title(outputFile);
	
		string cmd = "echo '=======================================================================' >> " + outputFile;
		system(cmd.c_str());
		cmd = "echo '=                    " + reportType + " report                                  =' >> " + outputFile;
		system(cmd.c_str());
		cmd = "echo '=======================================================================' >> " + outputFile;
		system(cmd.c_str());
	
		cmd = installDir + "/bin/" + reportType + "Report.sh " + localModule + " " + installDir;
		system(cmd.c_str());
		cmd = " mv -f /tmp/" + localModule + "_" + reportType + "Report.txt .";
		system(cmd.c_str());

		if (reportType == "config" )
		{
			cmd = "echo ' ' >> " + outputFile;
			system(cmd.c_str());
			cmd = "echo '******************** System Network Configuration ********************' >> " + outputFile;
			system(cmd.c_str());
			cmd = "echo ' ' >> " + outputFile;
			system(cmd.c_str());
			cmd = "echo '################# mcsadmin getSystemNetworkConfig ################# ' >> " + outputFile;
			system(cmd.c_str());
			cmd = "echo ' ' >> " + outputFile;
			system(cmd.c_str());
			cmd = installDir + "/bin/mcsadmin getSystemNetworkConfig >> " + outputFile;
			system(cmd.c_str());
	
			cmd = "echo ' ' >> " + outputFile;
			system(cmd.c_str());
			cmd = "echo '******************** System Module Configure  ********************' >> " + outputFile;
			system(cmd.c_str());
//.........这里部分代码省略.........
开发者ID:greenlion,项目名称:mariadb-columnstore-engine,代码行数:101,代码来源:calpontSupport.cpp


注:本文中的Oam::itoa方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。