1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

more changes

This commit is contained in:
david hill
2016-10-10 14:03:26 -05:00
parent edbf5bd781
commit ebd3b05c5d
17 changed files with 49 additions and 981 deletions

View File

@ -449,7 +449,6 @@
<AmazonZone>unassigned</AmazonZone>
<AmazonSubNetID>unassigned</AmazonSubNetID>
<AmazonVPCNextPrivateIP>autoassign</AmazonVPCNextPrivateIP>
<EnableSNMP>y</EnableSNMP>
<UMInstanceType>unassigned</UMInstanceType>
<UMSecurityGroup>unassigned</UMSecurityGroup>
<UMVolumeSize>unassigned</UMVolumeSize>

View File

@ -438,7 +438,6 @@
<rpw>unassigned</rpw>
<Cloud>unassigned</Cloud>
<EEPackageType>rpm</EEPackageType>
<EnableSNMP>y</EnableSNMP>
<AmazonAccessKey>unassigned</AmazonAccessKey>
<AmazonSecretKey>unassigned</AmazonSecretKey>
<AmazonRegion>us-east-1</AmazonRegion>

View File

@ -449,7 +449,6 @@
<AmazonZone>unassigned</AmazonZone>
<AmazonSubNetID>unassigned</AmazonSubNetID>
<AmazonVPCNextPrivateIP>autoassign</AmazonVPCNextPrivateIP>
<EnableSNMP>y</EnableSNMP>
<UMInstanceType>unassigned</UMInstanceType>
<UMSecurityGroup>unassigned</UMSecurityGroup>
<UMVolumeSize>unassigned</UMVolumeSize>

View File

@ -438,7 +438,6 @@
<rpw>unassigned</rpw>
<Cloud>unassigned</Cloud>
<EEPackageType>rpm</EEPackageType>
<EnableSNMP>y</EnableSNMP>
<AmazonAccessKey>unassigned</AmazonAccessKey>
<AmazonSecretKey>unassigned</AmazonSecretKey>
<AmazonRegion>us-east-1</AmazonRegion>

View File

@ -22,29 +22,6 @@
<LogFile>off</LogFile>
</PROCESSCONFIG2>
<PROCESSCONFIG3>
<ProcessName>SNMPTrapDaemon</ProcessName>
<ModuleType>ParentOAMModule</ModuleType>
<ProcessLocation>$INSTALLDIR/sbin/snmptrapd</ProcessLocation>
<ProcessArg1>$INSTALLDIR/sbin/snmptrapd</ProcessArg1>
<ProcessArg2>-M</ProcessArg2>
<ProcessArg3>$INSTALLDIR/share/snmp/mibs</ProcessArg3>
<ProcessArg4>-m</ProcessArg4>
<ProcessArg5>$INSTALLDIR/share/snmp/mibs/CALPONT-MIB.txt</ProcessArg5>
<ProcessArg6>-c</ProcessArg6>
<ProcessArg7>$INSTALLDIR/etc/snmptrapd.conf</ProcessArg7>
<ProcessArg8>-C</ProcessArg8>
<ProcessArg9>-Lf</ProcessArg9>
<ProcessArg10>/var/log/mariadb/columnstore/snmptrapd.log</ProcessArg10>
<ProcessArg11>-p</ProcessArg11>
<ProcessArg12>/var/run/snmptrapd.pid</ProcessArg12>
<BootLaunch>1</BootLaunch>
<LaunchID>3</LaunchID>
<DepProcessName1>ProcessManager</DepProcessName1>
<DepModuleName1>@</DepModuleName1>
<RunType>SIMPLEX</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG3>
<PROCESSCONFIG4>
<ProcessName>DBRMControllerNode</ProcessName>
<ModuleType>ParentOAMModule</ModuleType>
<ProcessLocation>$INSTALLDIR/bin/controllernode</ProcessLocation>
@ -56,26 +33,8 @@
<DepModuleName1>@</DepModuleName1>
<RunType>SIMPLEX</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG4>
<PROCESSCONFIG5>
<ProcessName>SNMPAgent</ProcessName>
<ModuleType>ChildOAMModule</ModuleType>
<ProcessLocation>$INSTALLDIR/sbin/snmpd</ProcessLocation>
<ProcessArg1>$INSTALLDIR/sbin/snmpd</ProcessArg1>
<ProcessArg2>-c</ProcessArg2>
<ProcessArg3>$INSTALLDIR/etc/snmpd.conf</ProcessArg3>
<ProcessArg4>-C</ProcessArg4>
<ProcessArg5>-Lf</ProcessArg5>
<ProcessArg6>/var/log/Calpont/snmpd.log</ProcessArg6>
<ProcessArg7>-p</ProcessArg7>
<ProcessArg8>/var/run/snmpd.pid</ProcessArg8>
<BootLaunch>0</BootLaunch>
<LaunchID>0</LaunchID>
<DepProcessName/>
<RunType>LOADSHARE</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG5>
<PROCESSCONFIG6>
</PROCESSCONFIG3>
<PROCESSCONFIG4>
<ProcessName>ServerMonitor</ProcessName>
<ModuleType>ChildOAMModule</ModuleType>
<ProcessLocation>$INSTALLDIR/bin/ServerMonitor</ProcessLocation>
@ -85,8 +44,8 @@
<DepProcessName/>
<RunType>LOADSHARE</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG6>
<PROCESSCONFIG7>
</PROCESSCONFIG4>
<PROCESSCONFIG5>
<ProcessName>DBRMWorkerNode</ProcessName>
<ModuleType>ChildExtOAMModule</ModuleType>
<ProcessLocation>$INSTALLDIR/bin/workernode</ProcessLocation>
@ -98,8 +57,8 @@
<DepProcessName/>
<RunType>LOADSHARE</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG7>
<PROCESSCONFIG8>
</PROCESSCONFIG5>
<PROCESSCONFIG6>
<ProcessName>DecomSvr</ProcessName>
<ModuleType>pm</ModuleType>
<ProcessLocation>/$INSTALLDIR/bin/DecomSvr</ProcessLocation>
@ -108,8 +67,8 @@
<DepProcessName/>
<RunType>LOADSHARE</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG8>
<PROCESSCONFIG9>
</PROCESSCONFIG6>
<PROCESSCONFIG7>
<ProcessName>PrimProc</ProcessName>
<ModuleType>pm</ModuleType>
<ProcessLocation>$INSTALLDIR/bin/PrimProc</ProcessLocation>
@ -118,8 +77,8 @@
<DepProcessName/>
<RunType>LOADSHARE</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG9>
<PROCESSCONFIG10>
</PROCESSCONFIG7>
<PROCESSCONFIG8>
<ProcessName>ExeMgr</ProcessName>
<ModuleType>um</ModuleType>
<ProcessLocation>$INSTALLDIR/bin/ExeMgr</ProcessLocation>
@ -129,8 +88,8 @@
<DepModuleName1>pm*</DepModuleName1>
<RunType>LOADSHARE</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG10>
<PROCESSCONFIG11>
</PROCESSCONFIG8>
<PROCESSCONFIG9>
<ProcessName>WriteEngineServer</ProcessName>
<ModuleType>pm</ModuleType>
<ProcessLocation>$INSTALLDIR/bin/WriteEngineServer</ProcessLocation>
@ -138,8 +97,8 @@
<LaunchID>40</LaunchID>
<RunType>LOADSHARE</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG11>
<PROCESSCONFIG12>
</PROCESSCONFIG9>
<PROCESSCONFIG10>
<ProcessName>DDLProc</ProcessName>
<ModuleType>um</ModuleType>
<ProcessLocation>$INSTALLDIR/bin/DDLProc</ProcessLocation>
@ -153,8 +112,8 @@
<DepModuleName3>*</DepModuleName3>
<RunType>SIMPLEX</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG12>
<PROCESSCONFIG13>
</PROCESSCONFIG10>
<PROCESSCONFIG11>
<ProcessName>DMLProc</ProcessName>
<ModuleType>um</ModuleType>
<ProcessLocation>$INSTALLDIR/bin/DMLProc</ProcessLocation>
@ -168,8 +127,8 @@
<DepModuleName3>@</DepModuleName3>
<RunType>SIMPLEX</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG13>
<PROCESSCONFIG14>
</PROCESSCONFIG11>
<PROCESSCONFIG12>
<ProcessName>mysqld</ProcessName>
<ModuleType>um</ModuleType>
<ProcessLocation>$INSTALLDIR/mysql/libexec/mysqld</ProcessLocation>
@ -178,5 +137,5 @@
<DepProcessName/>
<RunType>LOADSHARE</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG14>
</PROCESSCONFIG12>
</Columnstore>

View File

@ -22,29 +22,6 @@
<LogFile>off</LogFile>
</PROCESSCONFIG2>
<PROCESSCONFIG3>
<ProcessName>SNMPTrapDaemon</ProcessName>
<ModuleType>ParentOAMModule</ModuleType>
<ProcessLocation>/usr/local/mariadb/columnstore/sbin/snmptrapd</ProcessLocation>
<ProcessArg1>/usr/local/mariadb/columnstore/sbin/snmptrapd</ProcessArg1>
<ProcessArg2>-M</ProcessArg2>
<ProcessArg3>/usr/local/mariadb/columnstore/share/snmp/mibs</ProcessArg3>
<ProcessArg4>-m</ProcessArg4>
<ProcessArg5>/usr/local/mariadb/columnstore/share/snmp/mibs/CALPONT-MIB.txt</ProcessArg5>
<ProcessArg6>-c</ProcessArg6>
<ProcessArg7>/usr/local/mariadb/columnstore/etc/snmptrapd.conf</ProcessArg7>
<ProcessArg8>-C</ProcessArg8>
<ProcessArg9>-Lf</ProcessArg9>
<ProcessArg10>/usr/local/mariadb/columnstore/snmptrapd.log</ProcessArg10>
<ProcessArg11>-p</ProcessArg11>
<ProcessArg12>/var/run/snmptrapd.pid</ProcessArg12>
<BootLaunch>1</BootLaunch>
<LaunchID>3</LaunchID>
<DepProcessName1>ProcessManager</DepProcessName1>
<DepModuleName1>@</DepModuleName1>
<RunType>SIMPLEX</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG3>
<PROCESSCONFIG4>
<ProcessName>DBRMControllerNode</ProcessName>
<ModuleType>ParentOAMModule</ModuleType>
<ProcessLocation>/usr/local/mariadb/columnstore/bin/controllernode</ProcessLocation>
@ -56,26 +33,8 @@
<DepModuleName1>@</DepModuleName1>
<RunType>SIMPLEX</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG4>
<PROCESSCONFIG5>
<ProcessName>SNMPAgent</ProcessName>
<ModuleType>ChildOAMModule</ModuleType>
<ProcessLocation>/usr/local/mariadb/columnstore/sbin/snmpd</ProcessLocation>
<ProcessArg1>/usr/local/mariadb/columnstore/sbin/snmpd</ProcessArg1>
<ProcessArg2>-c</ProcessArg2>
<ProcessArg3>/usr/local/mariadb/columnstore/etc/snmpd.conf</ProcessArg3>
<ProcessArg4>-C</ProcessArg4>
<ProcessArg5>-Lf</ProcessArg5>
<ProcessArg6>/usr/local/mariadb/columnstore/snmpd.log</ProcessArg6>
<ProcessArg7>-p</ProcessArg7>
<ProcessArg8>/var/run/snmpd.pid</ProcessArg8>
<BootLaunch>0</BootLaunch>
<LaunchID>0</LaunchID>
<DepProcessName/>
<RunType>LOADSHARE</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG5>
<PROCESSCONFIG6>
</PROCESSCONFIG3>
<PROCESSCONFIG4>
<ProcessName>ServerMonitor</ProcessName>
<ModuleType>ChildOAMModule</ModuleType>
<ProcessLocation>/usr/local/mariadb/columnstore/bin/ServerMonitor</ProcessLocation>
@ -85,8 +44,8 @@
<DepProcessName/>
<RunType>LOADSHARE</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG6>
<PROCESSCONFIG7>
</PROCESSCONFIG4>
<PROCESSCONFIG5>
<ProcessName>DBRMWorkerNode</ProcessName>
<ModuleType>ChildExtOAMModule</ModuleType>
<ProcessLocation>/usr/local/mariadb/columnstore/bin/workernode</ProcessLocation>
@ -98,8 +57,8 @@
<DepProcessName/>
<RunType>LOADSHARE</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG7>
<PROCESSCONFIG8>
</PROCESSCONFIG5>
<PROCESSCONFIG6>
<ProcessName>DecomSvr</ProcessName>
<ModuleType>pm</ModuleType>
<ProcessLocation>/usr/local/mariadb/columnstore/bin/DecomSvr</ProcessLocation>
@ -108,8 +67,8 @@
<DepProcessName/>
<RunType>LOADSHARE</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG8>
<PROCESSCONFIG9>
</PROCESSCONFIG6>
<PROCESSCONFIG7>
<ProcessName>PrimProc</ProcessName>
<ModuleType>pm</ModuleType>
<ProcessLocation>/usr/local/mariadb/columnstore/bin/PrimProc</ProcessLocation>
@ -118,8 +77,8 @@
<DepProcessName/>
<RunType>LOADSHARE</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG9>
<PROCESSCONFIG10>
</PROCESSCONFIG7>
<PROCESSCONFIG8>
<ProcessName>ExeMgr</ProcessName>
<ModuleType>pm</ModuleType>
<ProcessLocation>/usr/local/mariadb/columnstore/bin/ExeMgr</ProcessLocation>
@ -129,8 +88,8 @@
<DepModuleName1>pm*</DepModuleName1>
<RunType>LOADSHARE</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG10>
<PROCESSCONFIG11>
</PROCESSCONFIG8>
<PROCESSCONFIG9>
<ProcessName>WriteEngineServer</ProcessName>
<ModuleType>pm</ModuleType>
<ProcessLocation>/usr/local/mariadb/columnstore/bin/WriteEngineServer</ProcessLocation>
@ -138,8 +97,8 @@
<LaunchID>40</LaunchID>
<RunType>LOADSHARE</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG11>
<PROCESSCONFIG12>
</PROCESSCONFIG9>
<PROCESSCONFIG10>
<ProcessName>DDLProc</ProcessName>
<ModuleType>um</ModuleType>
<ProcessLocation>$INSTALLDIR/bin/DDLProc</ProcessLocation>
@ -153,8 +112,8 @@
<DepModuleName3>um*</DepModuleName3>
<RunType>SIMPLEX</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG12>
<PROCESSCONFIG13>
</PROCESSCONFIG10>
<PROCESSCONFIG11>
<ProcessName>DMLProc</ProcessName>
<ModuleType>um</ModuleType>
<ProcessLocation>$INSTALLDIR/bin/DMLProc</ProcessLocation>
@ -168,8 +127,8 @@
<DepModuleName3>@</DepModuleName3>
<RunType>SIMPLEX</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG13>
<PROCESSCONFIG14>
</PROCESSCONFIG11>
<PROCESSCONFIG12>
<ProcessName>mysqld</ProcessName>
<ModuleType>pm</ModuleType>
<ProcessLocation>/usr/local/mariadb/columnstore/mysql/libexe/mysqld</ProcessLocation>
@ -178,5 +137,5 @@
<DepProcessName/>
<RunType>LOADSHARE</RunType>
<LogFile>off</LogFile>
</PROCESSCONFIG14>
</PROCESSCONFIG12>
</Columnstore>

View File

@ -73,15 +73,6 @@ for lib in *.so.1.0.0; do
done
chown -h $user.$user *.so >/dev/null 2>&1
if [ -f libnetsnmp.so.30.0.3 ]; then
for lib in *.so.30.0.3; do
blib=`basename $lib .30.0.3`
ln -sf $lib $blib
ln -sf $lib ${blib}.30
done
chown -h $user.$user *.so *.so.30 >/dev/null 2>&1
fi
if [ -f libstdc++.so.6.0.14 ]; then
ln -sf libstdc++.so.6.0.14 libstdc++.so.6
chown -h $user.$user libstdc++.so.6 >/dev/null 2>&1

View File

@ -250,18 +250,6 @@ namespace oam
systemconfig.ParentOAMModule = sysConfig->getConfig(Section, "ParentOAMModuleName");
systemconfig.StandbyOAMModule = sysConfig->getConfig(Section, "StandbyOAMModuleName");
// added by Zhixuan
try
{
SNMPManager sm;
sm.getNMSAddr (systemconfig.NMSIPAddr);
}
catch(...)
{
systemconfig.NMSIPAddr = UnassignedIpAddr;
}
// end
Section = "SessionManager";
systemconfig.MaxConcurrentTransactions = strtol(sysConfig->getConfig(Section, "MaxConcurrentTransactions").c_str(), 0, 0);
@ -857,24 +845,7 @@ namespace oam
void Oam::getSystemConfig(const std::string&name, std::string& value)
{
// added by Zhixuan
// special handle to NMSIPAddr, which is in snmpdx.conf file
if (name.compare("NMSIPAddr") == 0)
{
try
{
SNMPManager sm;
sm.getNMSAddr (value);
return;
}
catch(...)
{
// error with SM API
exceptionControl("getSystemConfig", API_FAILURE);
}
}
Config* sysConfig = Config::makeConfig(CalpontConfigFile.c_str());
// get string variables
@ -982,8 +953,6 @@ namespace oam
void Oam::setSystemConfig(const std::string name, const std::string value)
{
// added by Zhixuan
// special handle to SNMP config, which is in snmpdx.conf file
string mem = "Mem";
string disk = "Disk";
string swap = "Swap";
@ -992,21 +961,6 @@ namespace oam
string major = "Major";
string minor = "Minor";
if (name.find("NMSIPAddr") != string::npos)
{
try
{
SNMPManager sm;
sm.setNMSAddr (value);
return;
}
catch(...)
{
// error with SM API
exceptionControl("setSystemConfig", API_FAILURE);
}
}
Config* sysConfig = Config::makeConfig(CalpontConfigFile.c_str());
string returnValue;

View File

@ -48,12 +48,10 @@
#include "liboamcpp.h"
#include "configcpp.h"
#include "snmpmanager.h"
using namespace std;
using namespace oam;
using namespace config;
using namespace snmpmanager;
#include "helpers.h"
using namespace installer;
@ -459,23 +457,6 @@ int main(int argc, char *argv[])
//create associated /local/etc directory for parentOAMModuleName
cmd = "mkdir " + installDir + "/local/etc/" + parentOAMModuleName + " > /dev/null 2>&1";
system(cmd.c_str());
if (sysConfig->getConfig("Installation", "EnableSNMP") == "y")
{
//set SNMP Trap config file
string NMSIPAddress;
try {
NMSIPAddress = sysConfig->getConfig(SystemSection, "NMSIPAddress");
SNMPManager sm;
sm.setNMSAddr(NMSIPAddress);
}
catch(...)
{
cout << "ERROR: Problem getting NMSIPAddress from MariaDB Columnstore System Configuration file" << endl;
exit(1);
}
}
}
//Get list of configured system modules
@ -689,9 +670,6 @@ int main(int argc, char *argv[])
cmd = "chmod 755 -R " + installDir + "/data1/systemFiles/dbrm > /dev/null 2>&1";
system(cmd.c_str());
SNMPManager sm;
sm.updateSNMPD("parentOAMIPStub", parentOAMModuleIPAddr);
}
string idbstartcmd = installDir + "/bin/columnstore start";
@ -959,53 +937,6 @@ bool setOSFiles(string parentOAMModuleName, int serverTypeInstall)
return allfound;
}
/*
* Updated snmpd.conf with parentOAMModuleIPAddr
*/
bool updateSNMPD(string parentOAMModuleIPAddr)
{
string fileName = installDir + "/etc/snmpd.conf";
ifstream oldFile (fileName.c_str());
if (!oldFile) return false;
vector <string> lines;
char line[200];
string buf;
string newLine;
string newLine1;
while (oldFile.getline(line, 200))
{
buf = line;
string::size_type pos = buf.find("parentOAMIPStub",0);
if (pos != string::npos)
{
newLine = buf.substr(0, pos);
newLine.append(parentOAMModuleIPAddr);
newLine1 = buf.substr(pos+15, 200);
newLine.append(newLine1);
buf = newLine;
}
//output to temp file
lines.push_back(buf);
}
oldFile.close();
unlink (fileName.c_str());
ofstream newFile (fileName.c_str());
//create new file
int fd = open(fileName.c_str(), O_RDWR|O_CREAT, 0666);
copy(lines.begin(), lines.end(), ostream_iterator<string>(newFile, "\n"));
newFile.close();
close(fd);
return true;
}
/*
* Create a module file
*/

View File

@ -21,8 +21,6 @@
*
*
* List of files being updated by post-install configure:
* mariadb/columnstore/etc/snmpd.conf
* mariadb/columnstore/etc/snmptrapd.conf
* mariadb/columnstore/etc/Columnstore.xml
* mariadb/columnstore/etc/ProcessConfig.xml
* /etc/rc.local
@ -62,12 +60,10 @@
#include "liboamcpp.h"
#include "configcpp.h"
#include "snmpmanager.h"
using namespace std;
using namespace oam;
using namespace config;
using namespace snmpmanager;
#include "helpers.h"
using namespace installer;
@ -91,13 +87,11 @@ typedef struct Performance_Module_struct
typedef std::vector<PerformanceModule> PerformanceModuleList;
void snmpAppCheck();
void offLineAppCheck();
bool setOSFiles(string parentOAMModuleName, int serverTypeInstall);
bool checkSaveConfigFile();
string getModuleName();
bool setModuleName(string moduleName);
bool updateSNMPD(string parentOAMModuleIPAddr);
bool updateBash();
bool makeModuleFile(string moduleName, string parentOAMModuleName);
bool updateProcessConfig(int serverTypeInstall);
@ -593,9 +587,6 @@ int main(int argc, char *argv[])
//check if dbrm data resides in older directory path and inform user if it does
dbrmDirCheck();
//check snmp Apps disable option
snmpAppCheck();
if (startOfflinePrompt)
offLineAppCheck();
@ -2711,9 +2702,6 @@ int main(int argc, char *argv[])
exit(1);
}
//check snmp Apps disable option
snmpAppCheck();
//setup local OS Files
if( !setOSFiles(parentOAMModuleName, IserverTypeInstall) ) {
cout << "setOSFiles error" << endl;
@ -3806,53 +3794,6 @@ bool setOSFiles(string parentOAMModuleName, int serverTypeInstall)
return allfound;
}
/*
* Updated snmpdx.conf with parentOAMModuleIPAddr
*/
bool updateSNMPD(string parentOAMModuleIPAddr)
{
string fileName = installDir + "/etc/snmpd.conf";
ifstream oldFile (fileName.c_str());
if (!oldFile) return true;
vector <string> lines;
char line[200];
string buf;
string newLine;
string newLine1;
while (oldFile.getline(line, 200))
{
buf = line;
string::size_type pos = buf.find("parentOAMIPStub",0);
if (pos != string::npos)
{
newLine = buf.substr(0, pos);
newLine.append(parentOAMModuleIPAddr);
newLine1 = buf.substr(pos+15, 200);
newLine.append(newLine1);
buf = newLine;
}
//output to temp file
lines.push_back(buf);
}
oldFile.close();
unlink (fileName.c_str());
ofstream newFile (fileName.c_str());
//create new file
int fd = open(fileName.c_str(), O_RDWR|O_CREAT, 0664);
copy(lines.begin(), lines.end(), ostream_iterator<string>(newFile, "\n"));
newFile.close();
close(fd);
return true;
}
/*
* Update ProcessConfig.xml file for a single server configuration
@ -4992,140 +4933,6 @@ bool storageSetup(bool amazonInstall)
return true;
}
void snmpAppCheck()
{
Oam oam;
cout << endl << "===== MariaDB Columnstore SNMP-Trap Process Check =====" << endl << endl;
cout << "MariaDB Columnstore is packaged with an SNMP-Trap process." << endl;
cout << "If the system where MariaDB Columnstore is being installed already has an SNMP-Trap process" << endl;
cout << "running, then you have the option of disabling MariaDB Columnstore's SNMP-Trap process." << endl;
cout << "Not having the MariaDB Columnstore SNMP-Trap process will affect the" << endl;
cout << "generation of MariaDB Columnstore alarms and associated SNMP traps." << endl;
cout << "Please reference the MariaDB Columnstore Installation Guide for" << endl;
cout << "additional information." << endl << endl;
string enableSNMP = "y";
if (geteuid() == 0)
enableSNMP = sysConfig->getConfig(InstallSection, "EnableSNMP");
else
enableSNMP = "n";
if (enableSNMP.empty())
enableSNMP = "y";
while(true)
{
if ( enableSNMP == "y" ) {
string disable = "n";
pcommand = callReadline("MariaDB Columnstore SNMP-Trap process is enabled, would you like to disable it [y,n] (n) > ");
if (pcommand)
{
if (strlen(pcommand) > 0) disable = pcommand;
callFree(pcommand);
}
if ( disable == "y" ) {
enableSNMP = "n";
break;
}
else if ( disable == "n" ) {
enableSNMP = "y";
break;
}
cout << "Invalid Entry, please retry" << endl;
if ( noPrompting )
exit(1);
}
else
{
string enable = "n";
pcommand = callReadline("MariaDB Columnstore SNMP-Trap process is disabled, would you like to enable it (y,n) [n] > ");
if (pcommand)
{
if (strlen(pcommand) > 0) enable = pcommand;
callFree(pcommand);
}
if ( enable == "y" || enable == "n" ) {
enableSNMP = enable;
break;
}
cout << "Invalid Entry, please retry" << endl;
if ( noPrompting )
exit(1);
}
}
sysConfig->setConfig(InstallSection, "EnableSNMP", enableSNMP);
if (enableSNMP == "y") {
//
// Configure SNMP / NMS Addresses
//
try
{
oam.setProcessConfig("SNMPTrapDaemon", "ParentOAMModule", "BootLaunch", "1");
oam.setProcessConfig("SNMPTrapDaemon", "ParentOAMModule", "LaunchID", "3");
cout << endl << "MariaDB Columnstore SNMP Process successfully enabled" << endl;
}
catch (exception& e)
{
cout << endl << "**** setProcessConfig Failed = " << e.what() << endl;
}
//set OAM Parent IP Address in snmpd.conf
if( !updateSNMPD(parentOAMModuleIPAddr) )
cout << "updateSNMPD error" << endl;
//get and set NMS IP address
string currentNMSIPAddress;
string NMSIPAddress;
SNMPManager sm;
sm.getNMSAddr(currentNMSIPAddress);
NMSIPAddress = currentNMSIPAddress;
cout << endl << "===== Setup the Network Management System (NMS) Server Configuration =====" << endl << endl;
cout << "This would be used to receive SNMP Traps from MariaDB Columnstore." << endl;
cout << "0.0.0.0 defaults to not sending off the system" << endl << endl;
prompt = "Enter IP Address(es) of where you want the SNMP Traps went (" + currentNMSIPAddress + ") > ";
pcommand = callReadline(prompt.c_str());
if (pcommand)
{
if (strlen(pcommand) > 0) NMSIPAddress = pcommand;
callFree(pcommand);
}
sm.setNMSAddr(NMSIPAddress);
}
else
{ //disabled, update config file
try
{
oam.setProcessConfig("SNMPTrapDaemon", "ParentOAMModule", "BootLaunch", "0");
oam.setProcessConfig("SNMPTrapDaemon", "ParentOAMModule", "LaunchID", "0");
cout << endl << "MariaDB Columnstore SNMP-Trap Process successfully disabled" << endl;
}
catch (exception& e)
{
cout << endl << "**** setProcessConfig Failed = " << e.what() << endl;
}
}
if ( !writeConfig(sysConfig) ) {
cout << "ERROR: Failed trying to update MariaDB Columnstore System Configuration file" << endl;
exit(1);
}
return;
}
void setSystemName()
{

View File

@ -8575,17 +8575,6 @@ int ProcessManager::switchParentOAMModule(std::string newActiveModuleName)
break;
}
// stop local SNMPTrapDaemon
string EnableSNMP = "y";
try {
oam.getSystemConfig("EnableSNMP", EnableSNMP);
}
catch(...)
{}
if ( EnableSNMP == "y" )
stopProcess(config.moduleName(), "SNMPTrapDaemon", oam::FORCEFUL, true);
// start processmanager on new active node
startProcess(newActiveModuleName, "ProcessManager", oam::FORCEFUL);

View File

@ -1546,27 +1546,6 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
break;
}
case UPDATESNMPD:
{
log.writeLog(__LINE__, "MSG RECEIVED: Update snmpd.conf file ");
string oldIPAddr;
string newIPAddr;
msg >> oldIPAddr;
msg >> newIPAddr;
//update snmpd.conf
SNMPManager sm;
sm.updateSNMPD(oldIPAddr, newIPAddr);
//reinit SNMPAgent
system("pkill -HUP snmpd");
log.writeLog(__LINE__, "UPDATESNMPD: ACK back to ProcMgr");
break;
}
case RUNUPGRADE:
{
@ -2252,16 +2231,6 @@ pid_t ProcessMonitor::startProcess(string processModuleType, string processName,
}//end of FOR
}
//Don't start certain processes if local module isn't Parent OAM PM
if ( processName == "SNMPTrapDaemon" ||
processName == "DBRMControllerNode" ) {
if (!gOAMParentModuleFlag) {
log.writeLog(__LINE__, "Fail Restoral, not on Parent OAM module", LOG_TYPE_ERROR);
//local PM doesn't have the read/write mount
return oam::API_MINOR_FAILURE;
}
}
for (i=0; i < MAXARGUMENTS - 1; i++)
{
if (arg_list[i].length() == 0)
@ -2456,13 +2425,6 @@ pid_t ProcessMonitor::startProcess(string processModuleType, string processName,
//sleep, give time for INIT state to be update, prevent race condition with ACTIVE
sleep(1);
//delete any old pid file for snmp processes
if (processLocation.find("snmp") != string::npos)
{
string pidFileLocation = argList[numAugs-1];
unlink (pidFileLocation.c_str());
}
//check and setup for logfile
time_t now;
now = time(NULL);
@ -2521,60 +2483,15 @@ pid_t ProcessMonitor::startProcess(string processModuleType, string processName,
updateProcessInfo(processName, oam::ACTIVE, newProcessID);
}
if (processLocation.find("snmp") != string::npos)
{ // snmp app is special...........
// wait for up to 30 seconds for the pid file to be created
//FYI - NEEDS TO STAY HERE TO HAVE newProcessID
//get snmp app pid which was stored when app was launched
//the location is the last augument
// open sometimes fail, so put in a retry loop
//record the process information into processList
config.buildList(processModuleType, processName, processLocation, arg_list,
launchID, newProcessID, initType, BootLaunch, RunType,
DepProcessName, DepModuleName, LogFile);
newProcessID = 0;
string pidFileLocation = argList[numAugs-1];
int i;
for (i=0; i < 30 ; i++)
{
sleep(1);
ifstream f(pidFileLocation.c_str(), ios::in);
if (f.good())
{
// store pid from PID file
f >> newProcessID;
//retry if pid is 0
if (newProcessID == 0)
continue;
break;
}
}
if (i == 30) {
log.writeLog(__LINE__, "FAILURE: no valid PID stored in " + pidFileLocation, LOG_TYPE_ERROR);
return oam::API_MINOR_FAILURE;
}
//record the process information into processList
config.buildList(processModuleType, processName, processLocation, arg_list,
launchID, newProcessID, oam::ACTIVE, BootLaunch, RunType,
DepProcessName, DepModuleName, LogFile);
//Update Process Status: Mark Process oam::ACTIVE state
updateProcessInfo(processName, oam::ACTIVE, newProcessID);
}
else
{
//FYI - NEEDS TO STAY HERE TO HAVE newProcessID
//record the process information into processList
config.buildList(processModuleType, processName, processLocation, arg_list,
launchID, newProcessID, initType, BootLaunch, RunType,
DepProcessName, DepModuleName, LogFile);
//Update Process Status: Update PID
updateProcessInfo(processName, PID_UPDATE, newProcessID);
}
//Update Process Status: Update PID
updateProcessInfo(processName, PID_UPDATE, newProcessID);
log.writeLog(__LINE__, processName + " PID is " + oam.itoa(newProcessID), LOG_TYPE_DEBUG);
@ -2619,8 +2536,7 @@ pid_t ProcessMonitor::startProcess(string processModuleType, string processName,
}
// open STDIN, STDOUT & STDERR for trapDaemon and DecomSvr
if (processName == "SNMPTrapDaemon" ||
processName == "DecomSvr" )
if (processName == "DecomSvr" )
{
open("/dev/null", O_RDONLY); //Should be fd 0
open("/dev/null", O_WRONLY); //Should be fd 1
@ -2690,7 +2606,7 @@ pid_t ProcessMonitor::startProcess(string processModuleType, string processName,
/******************************************************************************************
* @brief reinitProcess
*
* purpose: re-Init a process, an SNMP agent that will go re-read it's config file
* purpose: re-Init a process
*
******************************************************************************************/
int ProcessMonitor::reinitProcess(pid_t processID, std::string processName, int actionIndicator)

View File

@ -1,4 +1,3 @@
add_subdirectory(etc)
add_subdirectory(snmpmanager)

View File

@ -26,20 +26,8 @@
#include <string>
#include <stdint.h>
#ifndef SKIP_SNMP
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#else
typedef uint64_t oid;
#endif
namespace snmpmanager {
/** @brief oid type
*1, 3, 6, 1, 4, 1, 2021, 991
*/
typedef oid CALPONT_OID;
/** @brief constant define
*
@ -51,16 +39,6 @@ const std::string ACTIVE_ALARM_FILE = "/var/log/mariadb/columnstore/activeAlarms
const std::string ALARM_FILE = "/var/log/mariadb/columnstore/alarm.log";
const std::string ALARM_ARCHIVE_FILE = "/var/log/mariadb/columnstore/archive";
const CALPONT_OID SNMPTRAP_OID [] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
const CALPONT_OID CALPONT_TRAP_OID [] = { 1, 3, 6, 1, 4, 1, 2021, 991 };
const CALPONT_OID CALALARM_DATA_OID [] = { 1, 3, 6, 1, 4, 1, 2021, 991, 17 };
const CALPONT_OID COMPONENT_ID_OID [] = { 1, 3, 6, 1, 4, 1, 2021, 991, 18 };
const CALPONT_OID ALARM_ID_OID [] = { 1, 3, 6, 1, 4, 1, 2021, 991, 19 };
const CALPONT_OID STATE_OID [] = { 1, 3, 6, 1, 4, 1, 2021, 991, 20 };
const CALPONT_OID SNAME_OID [] = { 1, 3, 6, 1, 4, 1, 2021, 991, 21 };
const CALPONT_OID PNAME_OID [] = { 1, 3, 6, 1, 4, 1, 2021, 991, 22 };
const CALPONT_OID PID_OID [] = { 1, 3, 6, 1, 4, 1, 2021, 991, 23 };
const CALPONT_OID TID_OID [] = { 1, 3, 6, 1, 4, 1, 2021, 991, 24 };
const bool CALPONT_SNMP_DEBUG = false;
const uint16_t INVALID_ALARM_ID = 0;
}

View File

@ -644,351 +644,6 @@ void SNMPManager::getAlarm(std::string date, AlarmList& alarmList) const
}
}
/*****************************************************************************************
* @brief getNMSAddr API
*
* purpose: Get NMS IP Address from the snmptrapd config file
*
*****************************************************************************************/
void SNMPManager::getNMSAddr (string& addr)
{
getSNMPConfig (SNMPManager::parentOAMModuleName, TRAPD, "NMSADDR", addr);
}
/*****************************************************************************************
* @brief setNMSAddr API
*
* purpose: Set NMS IP Address from the snmptrapd config file
*
*****************************************************************************************/
void SNMPManager::setNMSAddr (const string addr)
{
setSNMPConfig (SNMPManager::parentOAMModuleName, TRAPD, "NMSADDR", addr);
}
/*****************************************************************************************
* @brief setSNMPConfig API
*
* purpose: Set a SNMP monitoring threashold value in the snmpdx config file
* Set NMS IP Address in snmptrapd config file
*
*
*****************************************************************************************/
void SNMPManager::setSNMPConfig (const string ModuleName, const std::string agentName,
const string paramName, const string value)
{
string fileName;
makeFileName (agentName, fileName);
vector <string> lines;
string calParamName = "CALPONT_" + paramName;
Oam oam;
ifstream oldFile (fileName.c_str());
if (!oldFile) throw runtime_error ("No configuration file found");
char line[200];
string buf;
string changeValue;
string delimiters = " ";
while (oldFile.getline(line, 200))
{
buf = line;
if (buf.find(calParamName) != string::npos)
{
lines.push_back(buf);
// change next line
oldFile.getline(line, 200);
buf = line;
// if change NMS IP Addr to 0.0.0.0, then comment out forward line if not already
if ( paramName == "NMSADDR" && value == oam::UnassignedIpAddr ) {
string::size_type pos = buf.find("#", 0);
if ( string::npos == pos ) {
string templine = line;
buf = "#" + templine;
}
}
// if change NMS IP Addr to NOT 0.0.0.0, then un-comment line if needed
if ( paramName == "NMSADDR" && value != oam::UnassignedIpAddr ) {
string::size_type pos = buf.find("#", 0);
if ( string::npos != pos )
buf = buf.substr(1,200);
}
string::size_type lastPos = buf.find_first_not_of(delimiters, 0);
string::size_type pos = buf.find_first_of(delimiters, lastPos);
// find the last token, which is the value to be changed
while (string::npos != pos || string::npos != lastPos)
{
changeValue = buf.substr(lastPos, pos - lastPos);
lastPos = buf.find_first_not_of(delimiters, pos);
pos = buf.find_first_of(delimiters, lastPos);
}
pos = buf.find(changeValue);
buf.replace(pos, 20, value);
}
// output to temp file
lines.push_back(buf);
}
oldFile.close();
unlink (fileName.c_str());
ofstream newFile (fileName.c_str());
// create new file
int fd = open(fileName.c_str(),O_RDWR|O_CREAT, 0664);
// Aquire an exclusive lock
if (flock(fd,LOCK_EX) == -1) {
throw runtime_error ("Lock SNMP configuration file error");
}
copy(lines.begin(), lines.end(), ostream_iterator<string>(newFile, "\n"));
newFile.close();
// Release lock
if (flock(fd,LOCK_UN) == -1)
{
throw runtime_error ("Release lock SNMP configuration file error");
}
close(fd);
//re-init snmp processes
string processName;
makeProcessName (agentName, processName);
/* try {
oam.reinitProcessType(processName);
}
catch(...)
{}
*/
}
/*****************************************************************************************
* @brief getSNMPConfig API
*
* purpose: Get a SNMP monitoring threashold value in the snmpdx config file
*
* paramName options: DISK_CRITICAL, DISK_MAJOR, DISK_MINOR
* MEM_CRITICAL, MEM_MAJOR, MEM_MINOR
* SWAP_CRITICAL, SWAP_MAJOR, SWAP_MINOR
*
*****************************************************************************************/
void SNMPManager::getSNMPConfig (const string ModuleName, const std::string agentName,
const string paramName, string& value)
{
string fileName;
makeFileName (agentName, fileName);
ifstream configFile (fileName.c_str());
char line[200];
string buf;
string delimiters = " ";
string calParamName = "CALPONT_" + paramName;
while (configFile.getline(line, 200))
{
buf = line;
if (buf.find(calParamName) != string::npos)
{
configFile.getline(line, 200);
buf = line;
string::size_type lastPos = buf.find_first_not_of(delimiters, 0);
string::size_type pos = buf.find_first_of(delimiters, lastPos);
// find the last token, which is the value to be read
while (string::npos != pos || string::npos != lastPos)
{
value = buf.substr(lastPos, pos - lastPos);
lastPos = buf.find_first_not_of(delimiters, pos);
pos = buf.find_first_of(delimiters, lastPos);
}
return;
}
}
throw runtime_error("Error processing snmptrapd configuration file");
}
/*****************************************************************************************
* @brief setSNMPModuleName API
*
* purpose: Set SNMP Module name in the snmpdx.conf file
*
*****************************************************************************************/
void SNMPManager::setSNMPModuleName ()
{
// get current Module name
Oam oam;
string ModuleName;
oamModuleInfo_t st;
try {
st = oam.getModuleInfo();
ModuleName = boost::get<0>(st);
}
catch (...) {
ModuleName = "Unknown Report Module";
}
string agentName = SUB_AGENT;
string fileName;
makeFileName (agentName, fileName);
vector <string> lines;
ifstream oldFile (fileName.c_str());
if (!oldFile) throw runtime_error ("No configuration file found");
char line[200];
string buf;
string newLine;
string newLine1;
string delimiters = " ";
while (oldFile.getline(line, 200))
{
buf = line;
string::size_type pos = buf.find("ModuleNameStub",0);
if (pos != string::npos)
{
newLine = buf.substr(0, pos);
newLine.append(ModuleName);
string::size_type pos1 = buf.find("|",pos);
if (pos1 != string::npos)
{
newLine1 = buf.substr(pos1, 200);
newLine.append(newLine1);
}
buf = newLine;
}
// output to temp file
lines.push_back(buf);
}
oldFile.close();
unlink (fileName.c_str());
ofstream newFile (fileName.c_str());
// create new file
int fd = open(fileName.c_str(), O_RDWR|O_CREAT, 0664);
// Aquire an exclusive lock
if (flock(fd,LOCK_EX) == -1) {
throw runtime_error ("Lock SNMP configuration file error");
}
copy(lines.begin(), lines.end(), ostream_iterator<string>(newFile, "\n"));
newFile.close();
// Release lock
if (flock(fd,LOCK_UN) == -1)
{
throw runtime_error ("Release lock SNMP configuration file error");
}
close(fd);
}
/**
* @brief Private functions definition
*/
/*****************************************************************************************
* @brief makeFileName API
*
* purpose: returns path for associated snmp conf file
*
*****************************************************************************************/
void SNMPManager::makeFileName (const std::string agentName, std::string& fileName)
{
string defaultPath = startup::StartUp::installDir() + "/etc/";
string localPath = startup::StartUp::installDir() + "/local/";
if (agentName.compare (MASTER_AGENT) == 0) {
fileName = defaultPath;
fileName += "snmpd.conf";
}
else if (agentName.compare (TRAPD) == 0) {
fileName = defaultPath;
fileName += "snmptrapd.conf";
}
else {
fileName = localPath;
fileName += "snmpdx.conf";
}
}
/*****************************************************************************************
* @brief makeProcessName API
*
* purpose: returns process name for AGENT
*
*****************************************************************************************/
void SNMPManager::makeProcessName (const std::string agentName, std::string& processName)
{
if (agentName.compare (MASTER_AGENT) == 0) {
processName = "SNMPParentAgent";
}
else if (agentName.compare (TRAPD) == 0) {
processName = "SNMPTrapDaemon";
}
else {
processName = "SNMPSubagent";
}
}
/*****************************************************************************************
* @brief updateSNMPD API
*
* purpose: updates Parent OAm IP address in snmpd.conf file
*
*****************************************************************************************/
void SNMPManager::updateSNMPD(std::string oldIPAddr, std::string parentOAMModuleIPAddr)
{
string fileName = startup::StartUp::installDir() + "/etc/snmpd.conf";
ifstream oldFile (fileName.c_str());
if (!oldFile) return;
vector <string> lines;
char line[200];
string buf;
string newLine;
string newLine1;
while (oldFile.getline(line, 200))
{
buf = line;
string::size_type pos = buf.find(oldIPAddr,0);
if (pos != string::npos)
{
newLine = buf.substr(0, pos);
newLine.append(parentOAMModuleIPAddr);
newLine1 = buf.substr(pos + oldIPAddr.size(), 200);
newLine.append(newLine1);
buf = newLine;
}
//output to temp file
lines.push_back(buf);
}
oldFile.close();
unlink (fileName.c_str());
ofstream newFile (fileName.c_str());
//create new file
int fd = open(fileName.c_str(), O_RDWR|O_CREAT, 0664);
copy(lines.begin(), lines.end(), ostream_iterator<string>(newFile, "\n"));
newFile.close();
close(fd);
return;
}
} //namespace snmpmanager
// vim:ts=4 sw=4:

View File

@ -45,10 +45,6 @@ typedef std::multimap<int, Alarm> AlarmList;
/** @brief constant define
*
*/
const std::string MASTER_AGENT = "MASTER";
const std::string SUB_AGENT = "SUB";
const std::string TRAPD = "TRAPD";
/** @brief SNMPManager class interface
*
@ -98,47 +94,6 @@ public:
*
* @param addr the reference to store addr
*/
EXPORT void getNMSAddr (std::string& addr);
/** @brief set NMS address for trapd
*
* @param addr the changed value
*/
EXPORT void setNMSAddr (const std::string addr);
/** @brief get SNMP configuration in subagent config file
*
* @param ModuleName the Module the file resides on
* @param agentName the SNMP agent config file it resides in
* @param paramName the parameter to change
* @param value the reference to store value
*/
EXPORT void getSNMPConfig (const std::string ModuleName,
const std::string agentName,
const std::string paramName,
std::string& value);
/** @brief set SNMP configuration in subagent config file
*
* @param ModuleName the Module the file resides on
* @param agentName the SNMP agent config file it resides in
* @param paramName the paramerter name to config
* @param value the changed value
*/
EXPORT void setSNMPConfig (const std::string ModuleName,
const std::string agentName,
const std::string paramName,
const std::string value);
/** @brief set SNMP Module Name in subagent config file
*
*/
EXPORT void setSNMPModuleName ();
/** @brief updates Parent OAm IP address in snmpd.conf file
*
*/
EXPORT void updateSNMPD(std::string oldIPAddr, std::string parentOAMModuleIPAddr);
private:
/** @brief copy ctor. keep private for now
@ -151,20 +106,6 @@ private:
*/
SNMPManager& operator=(const SNMPManager& rhs);
/** @brief make agent configuration file name
*
* @param agentName the snmp agent to change config
* @param fileName the reference to store the file name
*/
void makeFileName (const std::string agentName, std::string& fileName);
/** @brief make agent configuration file name
*
* @param agentName the snmp agent to change config
* @param processName the process name for agent
*/
void makeProcessName (const std::string agentName, std::string& processName);
/**
* this is to avoid running create_trap_session more than once.
*/

View File

@ -432,20 +432,17 @@ int main(int argc, char *argv[])
catch(...)
{}
//save EEPackageType and EnableSNMP
//save EEPackageType
string EEPackageType = "rpm";
string EnableSNMP = "y";
try {
EEPackageType = sysConfigOld->getConfig(InstallSection, "EEPackageType");
EnableSNMP = sysConfigOld->getConfig(InstallSection, "EnableSNMP");
}
catch(...)
{ }
try {
sysConfigNew->setConfig(InstallSection, "EEPackageType", EEPackageType);
sysConfigNew->setConfig(InstallSection, "EnableSNMP", EnableSNMP);
}
catch(...)
{ }
@ -453,12 +450,8 @@ int main(int argc, char *argv[])
if ( EEPackageType.empty() )
EEPackageType = "rpm";
if ( EnableSNMP.empty() )
EnableSNMP = "y";
try {
sysConfigNew->setConfig(InstallSection, "EEPackageType", EEPackageType);
sysConfigNew->setConfig(InstallSection, "EnableSNMP", EnableSNMP);
}
catch(...)
{}