diff --git a/oamapps/columnstoreSupport/CMakeLists.txt b/oamapps/columnstoreSupport/CMakeLists.txt index 16ad18fac..d34fc9bee 100644 --- a/oamapps/columnstoreSupport/CMakeLists.txt +++ b/oamapps/columnstoreSupport/CMakeLists.txt @@ -4,7 +4,7 @@ include_directories( ${ENGINE_COMMON_INCLUDES} ) ########### next target ############### -set(columnstoreSupport_SRCS columnstoreSupport.cpp) +set(columnstoreSupport_SRCS columnstoreSupport.cpp mcsSupportUtil.cpp) add_executable(columnstoreSupport ${columnstoreSupport_SRCS}) @@ -14,7 +14,7 @@ target_link_libraries(columnstoreSupport ${ENGINE_LDFLAGS} ${ENGINE_READLINE_LIB install(TARGETS columnstoreSupport DESTINATION ${ENGINE_BINDIR} COMPONENT columnstore-engine) -install(PROGRAMS alarmReport.sh bulklogReport.sh configReport.sh +install(PROGRAMS dbmsReport.sh bulklogReport.sh configReport.sh hardwareReport.sh logReport.sh resourceReport.sh softwareReport.sh DESTINATION ${ENGINE_BINDIR} COMPONENT columnstore-engine) diff --git a/oamapps/columnstoreSupport/bulklogReport.sh b/oamapps/columnstoreSupport/bulklogReport.sh index c66de2612..83076f4eb 100755 --- a/oamapps/columnstoreSupport/bulklogReport.sh +++ b/oamapps/columnstoreSupport/bulklogReport.sh @@ -8,10 +8,11 @@ else MODULE="pm1" fi -#get temp directory -tmpDir=`mcsGetConfig SystemConfig SystemTempFileDir` - -rm -f ${tmpDir}/${MODULE}_bulklogReport.txt +if [ $2 ] ; then + OUT_FILE=$2 +else + OUT_FILE=${MODULE}_logReport.txt +fi { @@ -24,6 +25,6 @@ if test -d /var/lib/columnstore/data/bulk ; then egrep '(ERR|CRIT)' /var/lib/columnstore/data/bulk/log/*.err 2>/dev/null fi -} > ${tmpDir}/${MODULE}_bulklogReport.txt +} >> $OUT_FILE exit 0 diff --git a/oamapps/columnstoreSupport/columnstoreSupport.cpp b/oamapps/columnstoreSupport/columnstoreSupport.cpp index 3c6f487a4..cad59210b 100644 --- a/oamapps/columnstoreSupport/columnstoreSupport.cpp +++ b/oamapps/columnstoreSupport/columnstoreSupport.cpp @@ -28,11 +28,13 @@ #include "ctype.h" #include #include +#include #include "mcsconfig.h" #include "liboamcpp.h" #include "configcpp.h" #include "installdir.h" +#include "mcsSupportUtil.h" using namespace std; using namespace oam; @@ -68,22 +70,6 @@ typedef boost::tuple threadInfo_t; bool LOCAL = false; -void title(string outputFile = "columnstoreSupportReport.txt") -{ - string cmd = "echo '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo ' System " + systemName + "' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo ' columnstoreSupportReport script ran from Module " + localModule + " on " + currentDate + "' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%' >> " + outputFile; - system(cmd.c_str()); -} - void childReportThread(threadInfo_t& st) { ChildModuleList::iterator& list = boost::get<0>(st); @@ -108,19 +94,27 @@ void childReportThread(threadInfo_t& st) { outputFile = remoteModuleName + "_" + reportType + "Report.txt"; - title(outputFile); + FILE *pOutputFile = fopen(outputFile.c_str(), "a"); + if (pOutputFile == NULL) + { + printf("Could not open file: %s",outputFile.c_str()); + exit(1); + } - string cmd = "echo '=======================================================================' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo '= " + reportType + " report =' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo '=======================================================================' >> " + outputFile; - system(cmd.c_str()); + fprintf(pOutputFile,"********************************************************************************\n" + "\n" + " System %s\n" + " columnstoreSupportReport script ran from Module %s on %s\n" + "\n" + "********************************************************************************\n" + "\n" + " %s report\n" + "\n" + "********************************************************************************\n", + systemName.c_str(),localModule.c_str(),currentDate.c_str(),reportType.c_str()); } - cout << "Get " + reportType + " report data for " + remoteModuleName + " " << endl; - - cout.flush(); + cout << "Child Get " + reportType + " report data for " + remoteModuleName + " " << endl; string cmd = "remote_command.sh " + remoteModuleIP + " " + rootPassword + " '. " + ProfileFile + ";" + reportType + "Report.sh " + remoteModuleName + @@ -161,6 +155,26 @@ void reportThread(string reporttype) string outputFile = localModule + "_" + reportType + "Report.txt"; + FILE *pOutputFile = fopen(outputFile.c_str(), "a"); + if (pOutputFile == NULL) + { + printf("Could not open file: %s",outputFile.c_str()); + exit(1); + } + //get local report + fprintf(pOutputFile,"********************************************************************************\n" + "\n" + " System %s\n" + " columnstoreSupportReport script ran from Module %s on %s\n" + "\n" + "********************************************************************************\n" + "\n" + " %s report\n" + "\n" + "********************************************************************************\n", + systemName.c_str(),localModule.c_str(),currentDate.c_str(),reportType.c_str()); + + fclose(pOutputFile); // run on child servers and get report if (!LOCAL) { @@ -183,168 +197,71 @@ void reportThread(string reporttype) } } - // run report on local server - cout << "Get " + reportType + " report data for " + localModule << endl; - if (reportType == "log") { - string cmd = "logReport.sh " + localModule; - system(cmd.c_str()); - - cmd = "mv -f " + tmpDir + "/" + localModule + "_logReport.tar.gz ."; - system(cmd.c_str()); - - cmd = "tar -zcf " + localModule + "_mysqllogReport.tar.gz /var/log/mysql/*.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 = "mcsadmin getLogConfig >> " + outputFile; + string cmd = "logReport.sh " + localModule + " " + 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 = reportType + "Report.sh " + localModule; - system(cmd.c_str()); - cmd = " mv -f " + tmpDir + "/" + localModule + "_" + reportType + "Report.txt ."; + string cmd = reportType + "Report.sh " + localModule + " " + outputFile; 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 = "mcsadmin getSystemNetworkConfig >> " + outputFile; - system(cmd.c_str()); + pOutputFile = fopen(outputFile.c_str(), "a"); + if (pOutputFile == NULL) + { + printf("Could not open file: %s",outputFile.c_str()); + exit(1); + } - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo '******************** System Module Configure ********************' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo '################# mcsadmin getModuleTypeConfig ################# ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "mcsadmin getModuleTypeConfig >> " + outputFile; - system(cmd.c_str()); + fprintf(pOutputFile,"\n******************** System Network Configuration ******************************\n\n"); + getSystemNetworkConfig(pOutputFile); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo '******************** System Storage Configuration ********************' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo '################# mcsadmin getStorageConfig ################# ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "mcsadmin getStorageConfig >> " + outputFile; - system(cmd.c_str()); + fprintf(pOutputFile,"\n******************** System Module Configure **********************************\n\n"); + getModuleTypeConfig(pOutputFile); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo '******************** System Storage Status ********************' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo '################# mcsadmin getStorageStatus ################# ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "mcsadmin getStorageStatus >> " + outputFile; - system(cmd.c_str()); + fprintf(pOutputFile,"\n******************** System Storage Configuration *****************************\n\n"); + getStorageConfig(pOutputFile); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo '******************** System Status ********************' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo '################# mcsadmin getSystemInfo ################# ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "mcsadmin getSystemInfo >> " + outputFile; - system(cmd.c_str()); + fprintf(pOutputFile,"\n******************** System Storage Status ************************************\n\n"); + getStorageStatus(pOutputFile); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo '******************** System Directories ********************' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo '################# mcsadmin getSystemDirectories ################# ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "mcsadmin getSystemDirectories >> " + outputFile; - system(cmd.c_str()); + // BT: most of this is tedious to collect and can be manually looked up in the debug.log file + //fprintf(pOutputFile,"\n******************** System Status ********************************************\n\n"); + //printSystemStatus(pOutputFile); + //printProcessStatus(pOutputFile); + //printAlarmSummary(pOutputFile); + // + //fprintf(pOutputFile,"\n******************** System Directories ***************************************\n\n"); + //getSystemDirectories(pOutputFile); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo '******************** System Configuration File ********************' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo '################# cat /etc/columnstore/Columnstore.xml ################# ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); - cmd = "cat " + std::string(MCSSYSCONFDIR) + "/columnstore/Columnstore.xml >> " + outputFile; - system(cmd.c_str()); + boost::filesystem::path configFile = std::string(MCSSYSCONFDIR) + std::string("/columnstore/Columnstore.xml"); + boost::filesystem::copy_file(configFile,"./Columnstore.xml",boost::filesystem::copy_option::overwrite_if_exists); + fclose(pOutputFile); } + /* + // TODO: This can be ported from mcsadmin if needed most info included does not seem useful at this time if (reportType == "resource" ) { if (LOCAL) { - cmd = "echo '################# mcsadmin getModuleResourceUsage ################# ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); + fprintf(pOutputFile,"\n******************** mcsadmin getModuleResourceUsage **************************\n\n"); string cmd = "mcsadmin getModuleResourceUsage " + localModule + " >> " + outputFile; system(cmd.c_str()); } else { - cmd = "echo '################# mcsadmin getSystemResourceUsage ################# ' >> " + outputFile; - system(cmd.c_str()); - cmd = "echo ' ' >> " + outputFile; - system(cmd.c_str()); + fprintf(pOutputFile,"\n******************** mcsadmin getSystemResourceUsage **************************\n\n"); string cmd = "mcsadmin getSystemResourceUsage >> " + outputFile; system(cmd.c_str()); } - } + }*/ } // exit thread @@ -720,127 +637,130 @@ int main(int argc, char* argv[]) // // Software // - if ( SOFTWARE ) { string reportType = "software"; + cout << "Get " + reportType + " report data for " + localModule << endl; 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); + sleep(1); } // // Configuration // - if ( CONFIG ) { string reportType = "config"; + cout << "Get " + reportType + " report data for " + localModule << endl; 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); + sleep(1); } // // Alarms and Columnstore Logs // - if ( LOG ) { string reportType = "log"; + cout << "Get " + reportType + " report data for " + localModule << endl; 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); + sleep(1); } // // Bulk Logs // - if ( BULKLOG ) { string reportType = "bulklog"; + cout << "Get " + reportType + " report data for " + localModule << endl; 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); + sleep(1); } // // Hardware // - if ( HARDWARE ) { string reportType = "hardware"; + cout << "Get " + reportType + " report data for " + localModule << endl; 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); + sleep(1); } // // Resources // - if ( RESOURCE ) { string reportType = "resource"; + cout << "Get " + reportType + " report data for " + localModule << endl; 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); + sleep(1); } // // DBMS // - if ( DBMS ) { - system("rm -f columnstoreSupportReport.txt;touch columnstoreSupportReport.txt"); - title(); - - system("echo '=======================================================================' >> columnstoreSupportReport.txt"); - system("echo '= DBMS Report =' >> columnstoreSupportReport.txt"); - system("echo '=======================================================================' >> columnstoreSupportReport.txt"); - - // run DBMS report on local server cout << "Get dbms report data for " << localModule << endl; + string outputFile = localModule + "_dbmsReport.txt"; + + FILE *pOutputFile = fopen(outputFile.c_str(), "w"); + if (pOutputFile == NULL) + { + cout << "Could not open file: " + outputFile << endl; + exit(1); + } + + fprintf(pOutputFile,"********************************************************************************\n" + "\n" + " System %s\n" + " columnstoreSupportReport script ran from Module %s on %s\n" + "\n" + "********************************************************************************\n" + "\n" + " DBMS report\n" + "\n" + "********************************************************************************\n", + systemName.c_str(),localModule.c_str(),currentDate.c_str()); + + fclose(pOutputFile); + + // run DBMS report on local server bool FAILED = false; if ( localModule != PrimaryUMModuleName ) @@ -925,127 +845,28 @@ int main(int argc, char* argv[]) if (!FAILED) { - // check if mysql is supported and get info - string columnstoreMysql = "mysql -u root " + pwprompt; - string cmd = columnstoreMysql + " -V > /dev/null 2>&1"; - int ret = system(cmd.c_str()); - - if ( WEXITSTATUS(ret) == 0) - { - // run DBMS report info - system("echo ' ' >> columnstoreSupportReport.txt"); - system("echo '******************** DBMS Columnstore Version ********************' >> columnstoreSupportReport.txt"); - system("echo ' ' >> columnstoreSupportReport.txt"); - cmd = "echo '################# " + columnstoreMysql + " -e status ################# ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = "echo ' ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = columnstoreMysql + " -e 'status' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - - system("echo ' ' >> columnstoreSupportReport.txt"); - system("echo '******************** DBMS Columnstore System Column ********************' >> columnstoreSupportReport.txt"); - system("echo ' ' >> columnstoreSupportReport.txt"); - cmd = "echo '################# " + columnstoreMysql + " -e desc calpontsys.syscolumn ################# ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = "echo ' ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = columnstoreMysql + " -e 'desc calpontsys.syscolumn;' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - - system("echo ' ' >> columnstoreSupportReport.txt"); - system("echo '******************** DBMS Columnstore System Table ********************' >> columnstoreSupportReport.txt"); - system("echo ' ' >> columnstoreSupportReport.txt"); - cmd = "echo '################# " + columnstoreMysql + " -e desc calpontsys.systable ################# ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = "echo ' ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = columnstoreMysql + " -e 'desc calpontsys.systable;' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - - system("echo ' ' >> columnstoreSupportReport.txt"); - system("echo '******************** DBMS Columnstore System Catalog Data ********************' >> columnstoreSupportReport.txt"); - system("echo ' ' >> columnstoreSupportReport.txt"); - cmd = "echo '################# " + columnstoreMysql + " calpontsys < " + MCSSUPPORTDIR + "/dumpcat_mysql.sql ################# ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = "echo ' ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = columnstoreMysql + " calpontsys < " + MCSSUPPORTDIR + "/dumpcat_mysql.sql >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - - system("echo ' ' >> columnstoreSupportReport.txt"); - system("echo '******************** DBMS Columnstore System Table Data ********************' >> columnstoreSupportReport.txt"); - system("echo ' ' >> columnstoreSupportReport.txt"); - cmd = "echo '################# " + columnstoreMysql + " -e select * from calpontsys.systable ################# ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = "echo ' ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = columnstoreMysql + " -e 'select * from calpontsys.systable;' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - - system("echo ' ' >> columnstoreSupportReport.txt"); - system("echo '******************** DBMS Columnstore Usernames ********************' >> columnstoreSupportReport.txt"); - system("echo ' ' >> columnstoreSupportReport.txt"); - cmd = "echo '################# " + columnstoreMysql + " -e show databases ################# ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = "echo ' ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = columnstoreMysql + " -e 'show databases;' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - - system("echo ' ' >> columnstoreSupportReport.txt"); - system("echo '******************** DBMS Columnstore variables ********************' >> columnstoreSupportReport.txt"); - system("echo ' ' >> columnstoreSupportReport.txt"); - cmd = "echo '################# " + columnstoreMysql + " show variables ################# ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = "echo ' ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = columnstoreMysql + " -e 'show variables;' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - } + string cmd = "dbmsReport.sh " + localModule + " " + outputFile + " " + std::string(MCSSUPPORTDIR) + " " + pwprompt ; + system(cmd.c_str()); } } - system("echo ' ' >> columnstoreSupportReport.txt"); - system("echo '******************** Database Size Report ********************' >> columnstoreSupportReport.txt"); - system("echo ' ' >> columnstoreSupportReport.txt"); + /* + BT: This doesn't appear to do anything + fprintf(pOutputFile,"\n******************** Database Size Report *************************************\n\n"); + getStorageStatus(pOutputFile); string file = "databaseSizeReport"; ifstream File (file.c_str()); if (File) { - - string cmd = "echo '################# /bin/databaseSizeReport ################# ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = "echo ' ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = "databaseSizeReport >> columnstoreSupportReport.txt"; + string cmd = "databaseSizeReport >> " + outputFile; system(cmd.c_str()); } + */ - system("echo ' ' >> columnstoreSupportReport.txt"); - system("echo '******************** DBMS Columnstore config file ********************' >> columnstoreSupportReport.txt"); - system("echo ' ' >> columnstoreSupportReport.txt"); - string cmd = "echo '################# cat " + std::string(MCSMYCNFDIR) + "/columnstore.cnf ################# ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = "echo ' ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = "cat " + std::string(MCSMYCNFDIR) + "/columnstore.cnf 2>/dev/null >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - - system("echo ' ' >> columnstoreSupportReport.txt"); - system("echo '******************** Active Queries ********************' >> columnstoreSupportReport.txt"); - system("echo ' ' >> columnstoreSupportReport.txt"); - cmd = "echo '################# mcsadmin getActiveSqlStatement ################# ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = "echo ' ' >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - cmd = "mcsadmin getActiveSqlStatement >> columnstoreSupportReport.txt"; - system(cmd.c_str()); - - cmd = "cat columnstoreSupportReport.txt > " + localModule + "_dbmsReport.txt"; - system(cmd.c_str()); + boost::filesystem::path configFile = std::string(MCSMYCNFDIR) + "/columnstore.cnf"; + boost::filesystem::copy_file(configFile,"./columnstore.cnf",boost::filesystem::copy_option::overwrite_if_exists); } int wait = 0; @@ -1066,10 +887,13 @@ int main(int argc, char* argv[]) } } - system("rm -f columnstoreSupportReport.txt"); - system("unix2dos *Report.txt > /dev/null 2>&1"); - system("rm -rf columnstoreSupportReport;mkdir columnstoreSupportReport;mv *Report.txt columnstoreSupportReport/. > /dev/null 2>&1;mv *Report.tar.gz columnstoreSupportReport/. > /dev/null 2>&1"); + system("rm -rf columnstoreSupportReport;" + "mkdir columnstoreSupportReport;" + "mv *Report.txt columnstoreSupportReport/. > /dev/null 2>&1;" + "mv Columnstore.xml columnstoreSupportReport/. > /dev/null 2>&1;" + "mv columnstore.cnf columnstoreSupportReport/. > /dev/null 2>&1;" + "mv *Report.tar.gz columnstoreSupportReport/. > /dev/null 2>&1"); string cmd = "tar -zcf columnstoreSupportReport." + systemName + ".tar.gz columnstoreSupportReport/*"; system(cmd.c_str()); diff --git a/oamapps/columnstoreSupport/configReport.sh b/oamapps/columnstoreSupport/configReport.sh index b81125127..cb642f137 100755 --- a/oamapps/columnstoreSupport/configReport.sh +++ b/oamapps/columnstoreSupport/configReport.sh @@ -8,10 +8,11 @@ else MODULE="pm1" fi -#get temp directory -tmpDir=`mcsGetConfig SystemConfig SystemTempFileDir` - -rm -f ${tmpDir}/${MODULE}_configReport.txt +if [ $2 ] ; then + OUT_FILE=$2 +else + OUT_FILE=${MODULE}_logReport.txt +fi { echo " " @@ -70,6 +71,6 @@ echo "################# top -b -n 1 #################" echo " " top -b -n 1 -} > ${tmpDir}/${MODULE}_configReport.txt +} >> $OUT_FILE exit 0 diff --git a/oamapps/columnstoreSupport/dbmsReport.sh b/oamapps/columnstoreSupport/dbmsReport.sh new file mode 100755 index 000000000..6b6a6ab48 --- /dev/null +++ b/oamapps/columnstoreSupport/dbmsReport.sh @@ -0,0 +1,63 @@ +#! /bin/sh +# +# $Id: dbmsReport.sh +# +if [ $1 ] ; then + MODULE=$1 +else + MODULE="pm1" +fi + +if [ $2 ] ; then + OUT_FILE=$2 +else + OUT_FILE=${MODULE}_logReport.txt +fi + +if [ $3 ] ; then + MCSSUPPORTDIR=$3 +else + MCSSUPPORTDIR="/usr/share/columnstore" +fi + +if [ $4 ] ; then + PW_PROMPT=$4 +else + PW_PROMPT="" +fi + +{ + +columnstoreMysql="mysql -u root ${PW_PROMPT} " + +if ${columnstoreMysql} -V > /dev/null 2>&1; then + echo " " + echo "******************** DBMS Columnstore Version *********************************" + echo " " + ${columnstoreMysql} -e 'status' + echo " " + echo "******************** DBMS Columnstore System Column ***************************" + echo " " + ${columnstoreMysql} -e 'desc calpontsys.syscolumn;' + echo " " + echo "******************** DBMS Columnstore System Table ****************************" + echo " " + ${columnstoreMysql} -e 'desc calpontsys.systable;' + echo " " + echo "******************** DBMS Columnstore System Catalog Data *********************" + echo " " + ${columnstoreMysql} calpontsys < $MCSSUPPORTDIR/dumpcat_mysql.sql + echo " " + echo "******************** DBMS Columnstore System Table Data ***********************" + echo "******************** DBMS Columnstore Databases *******************************" + echo " " + ${columnstoreMysql} -e 'show databases;' + echo " " + echo "******************** DBMS Columnstore variables *******************************" + echo " " + ${columnstoreMysql} -e 'show variables;' + echo " " +fi +} >> $OUT_FILE + +exit 0 \ No newline at end of file diff --git a/oamapps/columnstoreSupport/hardwareReport.sh b/oamapps/columnstoreSupport/hardwareReport.sh index 71d145ade..d0bc92d5c 100755 --- a/oamapps/columnstoreSupport/hardwareReport.sh +++ b/oamapps/columnstoreSupport/hardwareReport.sh @@ -8,10 +8,11 @@ else MODULE="pm1" fi -#get temp directory -tmpDir=`mcsGetConfig SystemConfig SystemTempFileDir` - -rm -f ${tmpDir}/${MODULE}_hardwareReport.txt +if [ $2 ] ; then + OUT_FILE=$2 +else + OUT_FILE=${MODULE}_logReport.txt +fi { echo " " @@ -73,6 +74,6 @@ echo "################# ifconfig -a #################" echo " " ifconfig -a 2>/dev/null -} > ${tmpDir}/${MODULE}_hardwareReport.txt +} >> $OUT_FILE exit 0 diff --git a/oamapps/columnstoreSupport/logReport.sh b/oamapps/columnstoreSupport/logReport.sh index f5399bd54..c658ad1c0 100755 --- a/oamapps/columnstoreSupport/logReport.sh +++ b/oamapps/columnstoreSupport/logReport.sh @@ -8,11 +8,45 @@ else MODULE="pm1" fi +if [ $2 ] ; then + OUT_FILE=$2 +else + OUT_FILE=${MODULE}_logReport.txt +fi + #get temp directory tmpDir=`mcsGetConfig SystemConfig SystemTempFileDir` rm -f ${tmpDir}/${MODULE}_logReport.tar.gz - tar -zcf ${tmpDir}/${MODULE}_logReport.tar.gz /var/log/mariadb/columnstore > /dev/null 2>&1 +mv ${tmpDir}/${MODULE}_logReport.tar.gz . +tar -zcf ${MODULE}_mysqllogReport.tar.gz /var/log/mysql/*.err 2>/dev/null +echo '******************** Log Configuration ********************' >> $OUT_FILE +echo '' >> $OUT_FILE +echo 'MariaDB ColumnStore System Log Configuration Data' >> $OUT_FILE +echo '' >> $OUT_FILE +configFileName=`mcsGetConfig Installation SystemLogConfigFile` +echo 'System Logging Configuration File being used: '${configFileName} >> $OUT_FILE +echo '' >> $OUT_FILE +echo -e 'Module\tConfigured Log Levels' >> $OUT_FILE +echo -e '------\t---------------------------------------' >> $OUT_FILE +moduleConfig='' +if grep -q '/var/log/mariadb/columnstore/crit.log' ${configFileName}; then + moduleConfig=${moduleConfig}' CRITICAL' +fi +if grep -q '/var/log/mariadb/columnstore/err.log' ${configFileName}; then + moduleConfig=${moduleConfig}' ERROR' +fi +if grep -q '/var/log/mariadb/columnstore/warning.log' ${configFileName}; then + moduleConfig=${moduleConfig}' WARNING' +fi +if grep -q '/var/log/mariadb/columnstore/info.log' ${configFileName}; then + moduleConfig=${moduleConfig}' INFO' +fi +if grep -q '/var/log/mariadb/columnstore/debug.log' ${configFileName}; then + moduleConfig=${moduleConfig}' DEBUG' +fi +echo -e ${MODULE}'\t'${moduleConfig} >> $OUT_FILE exit 0 + diff --git a/oamapps/columnstoreSupport/mcsSupportUtil.cpp b/oamapps/columnstoreSupport/mcsSupportUtil.cpp new file mode 100644 index 000000000..06aa131aa --- /dev/null +++ b/oamapps/columnstoreSupport/mcsSupportUtil.cpp @@ -0,0 +1,577 @@ +/* Copyright (C) 2019 MariaDB Corporation + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; version 2 of + the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. */ + +#include "mcsSupportUtil.h" + +using namespace std; +using namespace oam; +using namespace config; +using namespace alarmmanager; + +void getSystemNetworkConfig(FILE * pOutputFile) +{ + Oam oam; + // get and display Module Network Config + SystemModuleTypeConfig systemmoduletypeconfig; + systemmoduletypeconfig.moduletypeconfig.clear(); + + // get max length of a host name for header formatting + + int maxSize = 9; + + try + { + oam.getSystemConfig(systemmoduletypeconfig); + + for ( unsigned int i = 0 ; i < systemmoduletypeconfig.moduletypeconfig.size(); i++) + { + if ( systemmoduletypeconfig.moduletypeconfig[i].ModuleType.empty() ) + // end of list + break; + + int moduleCount = systemmoduletypeconfig.moduletypeconfig[i].ModuleCount; + string moduletype = systemmoduletypeconfig.moduletypeconfig[i].ModuleType; + string moduletypedesc = systemmoduletypeconfig.moduletypeconfig[i].ModuleDesc; + + if ( moduleCount > 0 ) + { + DeviceNetworkList::iterator pt = systemmoduletypeconfig.moduletypeconfig[i].ModuleNetworkList.begin(); + + for ( ; pt != systemmoduletypeconfig.moduletypeconfig[i].ModuleNetworkList.end() ; pt++) + { + HostConfigList::iterator pt1 = (*pt).hostConfigList.begin(); + + for ( ; pt1 != (*pt).hostConfigList.end() ; pt1++) + { + if ( maxSize < (int) (*pt1).HostName.size() ) + maxSize = (*pt1).HostName.size(); + } + } + } + } + } + catch (exception& e) + { + fprintf(pOutputFile,"**** getNetworkConfig Failed = %s\n\n",e.what()); + } + + fprintf(pOutputFile,"%-15s%-30s%-10s%-14s%-20s\n", + "Module Name", + "Module Description", + "NIC ID", + "Host Name", + "IP Address"); + fprintf(pOutputFile,"%-15s%-30s%-10s%-14s%-20s\n", + "-----------", + "-------------------------", + "------", + "---------", + "---------------"); + + try + { + oam.getSystemConfig(systemmoduletypeconfig); + + for ( unsigned int i = 0 ; i < systemmoduletypeconfig.moduletypeconfig.size(); i++) + { + if ( systemmoduletypeconfig.moduletypeconfig[i].ModuleType.empty() ) + // end of list + break; + + int moduleCount = systemmoduletypeconfig.moduletypeconfig[i].ModuleCount; + string moduletype = systemmoduletypeconfig.moduletypeconfig[i].ModuleType; + string moduletypedesc = systemmoduletypeconfig.moduletypeconfig[i].ModuleDesc; + + if ( moduleCount > 0 ) + { + DeviceNetworkList::iterator pt = systemmoduletypeconfig.moduletypeconfig[i].ModuleNetworkList.begin(); + + for ( ; pt != systemmoduletypeconfig.moduletypeconfig[i].ModuleNetworkList.end() ; pt++) + { + string modulename = (*pt).DeviceName; + string moduleID = modulename.substr(MAX_MODULE_TYPE_SIZE, MAX_MODULE_ID_SIZE); + string modulenamedesc = moduletypedesc + " #" + moduleID; + + fprintf(pOutputFile,"%-15s%-30s", + modulename.c_str(), + modulenamedesc.c_str()); + + HostConfigList::iterator pt1 = (*pt).hostConfigList.begin(); + + for ( ; pt1 != (*pt).hostConfigList.end() ; pt1++) + { + /* MCOL-1607. IPAddr may be a host name here b/c it is read straight + from the config file. */ + string tmphost = oam.getIPAddress(pt1->IPAddr); + string ipAddr; + if (tmphost.empty()) + ipAddr = pt1->IPAddr; + else + ipAddr = tmphost; + string hostname = (*pt1).HostName; + string nicID = oam.itoa((*pt1).NicID); + + if ( nicID != "1" ) + { + fprintf(pOutputFile,"%-45s",""); + } + fprintf(pOutputFile,"%-13s%-14s%-20s\n", + nicID.c_str(), + hostname.c_str(), + ipAddr.c_str()); + } + } + } + } + } + catch (exception& e) + { + fprintf(pOutputFile,"**** getNetworkConfig Failed = %s\n\n",e.what()); + } + +} + +void getModuleTypeConfig(FILE * pOutputFile) +{ + Oam oam; + SystemModuleTypeConfig systemmoduletypeconfig; + ModuleTypeConfig moduletypeconfig; + ModuleConfig moduleconfig; + systemmoduletypeconfig.moduletypeconfig.clear(); + + try + { + oam.getSystemConfig(systemmoduletypeconfig); + + fprintf(pOutputFile,"Module Type Configuration\n\n"); + + for ( unsigned int i = 0 ; i < systemmoduletypeconfig.moduletypeconfig.size(); i++) + { + if ( systemmoduletypeconfig.moduletypeconfig[i].ModuleType.empty() ) + // end of list + break; + + int moduleCount = systemmoduletypeconfig.moduletypeconfig[i].ModuleCount; + + if ( moduleCount < 1 ) + continue; + + string moduletype = systemmoduletypeconfig.moduletypeconfig[i].ModuleType; + + fprintf(pOutputFile,"ModuleType '%s' Configuration information\n",moduletype.c_str()); + fprintf(pOutputFile,"ModuleDesc = %s\n",systemmoduletypeconfig.moduletypeconfig[i].ModuleDesc.c_str()); + fprintf(pOutputFile,"RunType = %s\n",systemmoduletypeconfig.moduletypeconfig[i].RunType.c_str()); + fprintf(pOutputFile,"ModuleCount = %i\n",moduleCount); + + if ( moduleCount > 0 ) + { + DeviceNetworkList::iterator pt = systemmoduletypeconfig.moduletypeconfig[i].ModuleNetworkList.begin(); + + for ( ; pt != systemmoduletypeconfig.moduletypeconfig[i].ModuleNetworkList.end() ; pt++) + { + string modulename = (*pt).DeviceName; + HostConfigList::iterator pt1 = (*pt).hostConfigList.begin(); + + for ( ; pt1 != (*pt).hostConfigList.end() ; pt1++) + { + string ipAddr = (*pt1).IPAddr; + string servername = (*pt1).HostName; + fprintf(pOutputFile,"ModuleHostName and ModuleIPAddr for NIC ID %u on module '%s' = %s , %s\n",(*pt1).NicID,modulename.c_str(),servername.c_str(),ipAddr.c_str()); + } + } + } + + DeviceDBRootList::iterator pt = systemmoduletypeconfig.moduletypeconfig[i].ModuleDBRootList.begin(); + + for ( ; pt != systemmoduletypeconfig.moduletypeconfig[i].ModuleDBRootList.end() ; pt++) + { + if ( (*pt).dbrootConfigList.size() > 0 ) + { + fprintf(pOutputFile,"DBRootIDs assigned to module 'pm%u' = ",(*pt).DeviceID); + DBRootConfigList::iterator pt1 = (*pt).dbrootConfigList.begin(); + + for ( ; pt1 != (*pt).dbrootConfigList.end() ; ) + { + fprintf(pOutputFile,"%u",*pt1); + pt1++; + + if (pt1 != (*pt).dbrootConfigList.end()) + fprintf(pOutputFile,", "); + } + } + fprintf(pOutputFile,"\n"); + } + + fprintf(pOutputFile,"ModuleCPUCriticalThreshold = %u%%\n",systemmoduletypeconfig.moduletypeconfig[i].ModuleCPUCriticalThreshold); + fprintf(pOutputFile,"ModuleCPUMajorThreshold = %u%%\n",systemmoduletypeconfig.moduletypeconfig[i].ModuleCPUMajorThreshold); + fprintf(pOutputFile,"ModuleCPUMinorThreshold = %u%%\n",systemmoduletypeconfig.moduletypeconfig[i].ModuleCPUMinorThreshold); + fprintf(pOutputFile,"ModuleCPUMinorClearThreshold = %u%%\n",systemmoduletypeconfig.moduletypeconfig[i].ModuleCPUMinorClearThreshold); + fprintf(pOutputFile,"ModuleDiskCriticalThreshold = %u%%\n",systemmoduletypeconfig.moduletypeconfig[i].ModuleDiskCriticalThreshold); + fprintf(pOutputFile,"ModuleDiskMajorThreshold = %u%%\n",systemmoduletypeconfig.moduletypeconfig[i].ModuleDiskMajorThreshold); + fprintf(pOutputFile,"ModuleDiskMinorThreshold = %u%%\n",systemmoduletypeconfig.moduletypeconfig[i].ModuleDiskMinorThreshold); + fprintf(pOutputFile,"ModuleMemCriticalThreshold = %u%%\n",systemmoduletypeconfig.moduletypeconfig[i].ModuleMemCriticalThreshold); + fprintf(pOutputFile,"ModuleMemMajorThreshold = %u%%\n",systemmoduletypeconfig.moduletypeconfig[i].ModuleMemMajorThreshold); + fprintf(pOutputFile,"ModuleMemMinorThreshold = %u%%\n",systemmoduletypeconfig.moduletypeconfig[i].ModuleMemMinorThreshold); + fprintf(pOutputFile,"ModuleSwapCriticalThreshold = %u%%\n",systemmoduletypeconfig.moduletypeconfig[i].ModuleSwapCriticalThreshold); + fprintf(pOutputFile,"ModuleSwapMajorThreshold = %u%%\n",systemmoduletypeconfig.moduletypeconfig[i].ModuleSwapMajorThreshold); + fprintf(pOutputFile,"ModuleSwapMinorThreshold = %u%%\n",systemmoduletypeconfig.moduletypeconfig[i].ModuleSwapMinorThreshold); + + DiskMonitorFileSystems::iterator pt2 = systemmoduletypeconfig.moduletypeconfig[i].FileSystems.begin(); + int id = 1; + + for ( ; pt2 != systemmoduletypeconfig.moduletypeconfig[i].FileSystems.end() ; pt2++) + { + string fs = *pt2; + fprintf(pOutputFile,"ModuleDiskMonitorFileSystem#%i = %s\n",id,fs.c_str()); + ++id; + } + + cout << endl; + } + } + catch (exception& e) + { + cout << endl << "**** getModuleTypeConfig Failed = " << e.what() << endl; + } +} + +void getStorageConfig(FILE * pOutputFile) +{ + Oam oam; + try + { + systemStorageInfo_t t; + t = oam.getStorageConfig(); + + string cloud; + + try + { + oam.getSystemConfig("Cloud", cloud); + } + catch (...) {} + + string::size_type pos = cloud.find("amazon", 0); + + if (pos != string::npos) + cloud = "amazon"; + + fprintf(pOutputFile,"System Storage Configuration\n"); + + fprintf(pOutputFile,"Performance Module (DBRoot) Storage Type = %s\n",boost::get<0>(t).c_str()); + + if ( cloud == "amazon" ) + fprintf(pOutputFile,"User Module Storage Type = %s\n",boost::get<3>(t).c_str()); + + fprintf(pOutputFile,"System Assigned DBRoot Count = %i\n",boost::get<1>(t)); + + DeviceDBRootList moduledbrootlist = boost::get<2>(t); + + typedef std::vector dbrootList; + dbrootList dbrootlist; + + DeviceDBRootList::iterator pt = moduledbrootlist.begin(); + + for ( ; pt != moduledbrootlist.end() ; pt++) + { + fprintf(pOutputFile,"DBRoot IDs assigned to 'pm%u' = ",(*pt).DeviceID); + DBRootConfigList::iterator pt1 = (*pt).dbrootConfigList.begin(); + + for ( ; pt1 != (*pt).dbrootConfigList.end() ;) + { + fprintf(pOutputFile,"%u",*pt1); + dbrootlist.push_back(*pt1); + pt1++; + + if (pt1 != (*pt).dbrootConfigList.end()) + fprintf(pOutputFile,", "); + } + + fprintf(pOutputFile,"\n"); + } + + //get any unassigned DBRoots + DBRootConfigList undbrootlist; + + try + { + oam.getUnassignedDbroot(undbrootlist); + } + catch (...) {} + + if ( !undbrootlist.empty() ) + { + fprintf(pOutputFile,"DBRoot IDs unassigned = "); + DBRootConfigList::iterator pt1 = undbrootlist.begin(); + + for ( ; pt1 != undbrootlist.end() ;) + { + fprintf(pOutputFile,"%u",*pt1); + pt1++; + + if (pt1 != undbrootlist.end()) + fprintf(pOutputFile,", "); + } + + fprintf(pOutputFile,"\n"); + } + + cout << endl; + + // um volumes + if (cloud == "amazon" && boost::get<3>(t) == "external") + { + ModuleTypeConfig moduletypeconfig; + oam.getSystemConfig("um", moduletypeconfig); + + for ( int id = 1; id < moduletypeconfig.ModuleCount + 1 ; id++) + { + string volumeNameID = "UMVolumeName" + oam.itoa(id); + string volumeName = oam::UnassignedName; + string deviceNameID = "UMVolumeDeviceName" + oam.itoa(id); + string deviceName = oam::UnassignedName; + + try + { + oam.getSystemConfig( volumeNameID, volumeName); + oam.getSystemConfig( deviceNameID, deviceName); + } + catch (...) + {} + + fprintf(pOutputFile,"Amazon EC2 Volume Name/Device Name for 'um%i': %s, %s",id,volumeName.c_str(),deviceName.c_str()); + } + } + + // pm volumes + if (cloud == "amazon" && boost::get<0>(t) == "external") + { + cout << endl; + + DBRootConfigList dbrootConfigList; + + try + { + oam.getSystemDbrootConfig(dbrootConfigList); + + DBRootConfigList::iterator pt = dbrootConfigList.begin(); + + for ( ; pt != dbrootConfigList.end() ; pt++) + { + string volumeNameID = "PMVolumeName" + oam.itoa(*pt); + string volumeName = oam::UnassignedName; + string deviceNameID = "PMVolumeDeviceName" + oam.itoa(*pt); + string deviceName = oam::UnassignedName; + string amazonDeviceNameID = "PMVolumeAmazonDeviceName" + oam.itoa(*pt); + string amazondeviceName = oam::UnassignedName; + + try + { + oam.getSystemConfig( volumeNameID, volumeName); + oam.getSystemConfig( deviceNameID, deviceName); + oam.getSystemConfig( amazonDeviceNameID, amazondeviceName); + } + catch (...) + { + continue; + } + + fprintf(pOutputFile,"Amazon EC2 Volume Name/Device Name/Amazon Device Name for DBRoot%u: %s, %s, %s",*pt,volumeName.c_str(),deviceName.c_str(),amazondeviceName.c_str()); + + } + } + catch (exception& e) + { + cout << endl << "**** getSystemDbrootConfig Failed : " << e.what() << endl; + } + + // print un-assigned dbroots + DBRootConfigList::iterator pt1 = undbrootlist.begin(); + + for ( ; pt1 != undbrootlist.end() ; pt1++) + { + string volumeNameID = "PMVolumeName" + oam.itoa(*pt1); + string volumeName = oam::UnassignedName; + string deviceNameID = "PMVolumeDeviceName" + oam.itoa(*pt1); + string deviceName = oam::UnassignedName; + string amazonDeviceNameID = "PMVolumeAmazonDeviceName" + oam.itoa(*pt1); + string amazondeviceName = oam::UnassignedName; + + try + { + oam.getSystemConfig( volumeNameID, volumeName); + oam.getSystemConfig( deviceNameID, deviceName); + oam.getSystemConfig( amazonDeviceNameID, amazondeviceName); + } + catch (...) + { + continue; + } + + fprintf(pOutputFile,"Amazon EC2 Volume Name/Device Name/Amazon Device Name for DBRoot%u: %s, %s, %s",*pt1,volumeName.c_str(),deviceName.c_str(),amazondeviceName.c_str()); + } + } + + string DataRedundancyConfig; + int DataRedundancyCopies; + string DataRedundancyStorageType; + + try + { + oam.getSystemConfig("DataRedundancyConfig", DataRedundancyConfig); + oam.getSystemConfig("DataRedundancyCopies", DataRedundancyCopies); + oam.getSystemConfig("DataRedundancyStorageType", DataRedundancyStorageType); + } + catch (...) {} + + if ( DataRedundancyConfig == "y" ) + { + cout << endl << "Data Redundant Configuration" << endl << endl; + fprintf(pOutputFile,"Copies Per DBroot = %i",DataRedundancyCopies); + //cout << "Storage Type = " << DataRedundancyStorageType << endl; + + oamModuleInfo_t st; + string moduleType; + + try + { + st = oam.getModuleInfo(); + moduleType = boost::get<1>(st); + } + catch (...) {} + + if ( moduleType != "pm") + return; + + try + { + DBRootConfigList dbrootConfigList; + oam.getSystemDbrootConfig(dbrootConfigList); + + DBRootConfigList::iterator pt = dbrootConfigList.begin(); + + for ( ; pt != dbrootConfigList.end() ; pt++) + { + fprintf(pOutputFile,"DBRoot #%u has copies on PMs = ", *pt); + + string pmList = ""; + + try + { + string errmsg; + oam.glusterctl(oam::GLUSTER_WHOHAS, oam.itoa(*pt), pmList, errmsg); + } + catch (...) + {} + + boost::char_separator sep(" "); + boost::tokenizer< boost::char_separator > tokens(pmList, sep); + + for ( boost::tokenizer< boost::char_separator >::iterator it = tokens.begin(); + it != tokens.end(); + ++it) + { + fprintf(pOutputFile,"%s ",(*it).c_str()); + } + + fprintf(pOutputFile,"\n"); + } + + fprintf(pOutputFile,"\n"); + } + catch (exception& e) + { + cout << endl << "**** getSystemDbrootConfig Failed : " << e.what() << endl; + } + } + } + catch (exception& e) + { + cout << endl << "**** getStorageConfig Failed : " << e.what() << endl; + } +} + +void getStorageStatus(FILE * pOutputFile) +{ + SystemStatus systemstatus; + Oam oam; + + fprintf(pOutputFile,"System External DBRoot Storage Statuses\n\n"); + fprintf(pOutputFile,"Component Status Last Status Change\n"); + fprintf(pOutputFile,"------------ -------------------------- ------------------------\n"); + + try + { + oam.getSystemStatus(systemstatus, false); + + if ( systemstatus.systemdbrootstatus.dbrootstatus.size() == 0 ) + { + fprintf(pOutputFile," No External DBRoot Storage Configured\n\n"); + return; + } + + for ( unsigned int i = 0 ; i < systemstatus.systemdbrootstatus.dbrootstatus.size(); i++) + { + if ( systemstatus.systemdbrootstatus.dbrootstatus[i].Name.empty() ) + // end of list + break; + + int state = systemstatus.systemdbrootstatus.dbrootstatus[i].OpState; + string stime = systemstatus.systemdbrootstatus.dbrootstatus[i].StateChangeDate ; + stime = stime.substr (0, 24); + fprintf(pOutputFile,"DBRoot%s%-29s%-24s\n", + systemstatus.systemdbrootstatus.dbrootstatus[i].Name.c_str(), + oamState[state].c_str(), + stime.c_str()); + } + fprintf(pOutputFile,"\n"); + } + catch (exception& e) + { + cout << endl << "**** getSystemStatus Failed = " << e.what() << endl; + } + + string DataRedundancyConfig; + int DataRedundancyCopies; + string DataRedundancyStorageType; + + try + { + oam.getSystemConfig("DataRedundancyConfig", DataRedundancyConfig); + oam.getSystemConfig("DataRedundancyCopies", DataRedundancyCopies); + oam.getSystemConfig("DataRedundancyStorageType", DataRedundancyStorageType); + } + catch (...) {} + + if ( DataRedundancyConfig == "y" ) + { + string arg1 = ""; + string arg2 = ""; + string errmsg = ""; + int ret = oam.glusterctl(oam::GLUSTER_STATUS, arg1, arg2, errmsg); + + if ( ret == 0 ) + { + cout << arg2 << endl; + } + else + { + cerr << "FAILURE: Status check error: " + errmsg << endl; + } + } +} + diff --git a/oamapps/columnstoreSupport/mcsSupportUtil.h b/oamapps/columnstoreSupport/mcsSupportUtil.h new file mode 100644 index 000000000..1c7eb0bd3 --- /dev/null +++ b/oamapps/columnstoreSupport/mcsSupportUtil.h @@ -0,0 +1,44 @@ +/* Copyright (C) 2020 MariaDB Corporation + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; version 2 of + the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. */ + +#ifndef MCS_SUPPORT_UTIL_H_ +#define MCS_SUPPORT_UTIL_H_ + +#include +#include +#include +#include +#include +#include +#include "configcpp.h" +#include "liboamcpp.h" +#include "alarmmanager.h" + +void getSystemNetworkConfig(FILE * pOutputFile); +void getModuleTypeConfig(FILE * pOutputFile); +void getStorageConfig(FILE * pOutputFile); +void getStorageStatus(FILE * pOutputFile); +void getSystemInfo(FILE * pOutputFile); +void getSystemDirectories(FILE * pOutputFile); + +void printSystemStatus(FILE * pOutputFile); +void printProcessStatus(FILE * pOutputFile); +void printAlarmSummary(FILE * pOutputFile); + +void getActiveSql(FILE * pOutputFile); + +#endif diff --git a/oamapps/columnstoreSupport/resourceReport.sh b/oamapps/columnstoreSupport/resourceReport.sh index 5a7b26613..b0a092563 100755 --- a/oamapps/columnstoreSupport/resourceReport.sh +++ b/oamapps/columnstoreSupport/resourceReport.sh @@ -8,10 +8,11 @@ else MODULE="pm1" fi -#get temp directory -tmpDir=`mcsGetConfig SystemConfig SystemTempFileDir` - -rm -f ${tmpDir}/${MODULE}_resourceReport.txt +if [ $2 ] ; then + OUT_FILE=$2 +else + OUT_FILE=${MODULE}_logReport.txt +fi { echo " " @@ -60,6 +61,6 @@ echo "################# bin/editem -i #################" echo " " editem -i 2>/dev/null -} > ${tmpDir}/${MODULE}_resourceReport.txt +} >> $OUT_FILE exit 0 diff --git a/oamapps/columnstoreSupport/softwareReport.sh b/oamapps/columnstoreSupport/softwareReport.sh index 1befa7d78..92383feae 100755 --- a/oamapps/columnstoreSupport/softwareReport.sh +++ b/oamapps/columnstoreSupport/softwareReport.sh @@ -8,10 +8,11 @@ else MODULE="pm1" fi -#get temp directory -tmpDir=`mcsGetConfig SystemConfig SystemTempFileDir` - -rm -f ${tmpDir}/${MODULE}_softwareReport.txt +if [ $2 ] ; then + OUT_FILE=$2 +else + OUT_FILE=${MODULE}_logReport.txt +fi { echo " " @@ -23,15 +24,9 @@ echo "-- Columnstore Package Details --" echo " " echo "################# mcsadmin getcolumnstoresoftwareinfo #################" echo " " -mcsadmin getsoftwareinfo +rpm -qi MariaDB-columnstore-engine +echo " " -echo " " -echo "-- Columnstore Storage Configuration --" -echo " " -echo "################# mcsadmin getStorageConfig #################" -echo " " -mcsadmin getStorageConfig - -} > ${tmpDir}/${MODULE}_softwareReport.txt +} >> $OUT_FILE exit 0