diff options
author | Adam Rayner <adam.rayner@gmail.com> | 2022-06-20 20:06:35 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-06-20 20:38:07 +0000 |
commit | 451d1b53f1993bef6293de321d807f99778a848d (patch) | |
tree | 98e0a807dcb6aa77e1745217d30328a33c8e2046 /src/mongo | |
parent | 77ee09ff95f6f51483ed1cde01198879adaa71ad (diff) | |
download | mongo-451d1b53f1993bef6293de321d807f99778a848d.tar.gz |
SERVER-65733: remove SNMP module
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/SConscript | 12 | ||||
-rw-r--r-- | src/mongo/db/initialize_snmp.cpp | 48 | ||||
-rw-r--r-- | src/mongo/db/initialize_snmp.h | 52 | ||||
-rw-r--r-- | src/mongo/db/mongod_main.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/stats/counters.h | 2 | ||||
-rw-r--r-- | src/mongo/installer/msi/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/installer/msi/wxs/BinaryFragment.wxs | 39 | ||||
-rw-r--r-- | src/mongo/installer/msi/wxs/Installer_64.wxs | 1 | ||||
-rw-r--r-- | src/mongo/util/procparser_test.cpp | 19 |
9 files changed, 1 insertions, 176 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript index 88a299aa8e1..ea0817030cc 100644 --- a/src/mongo/db/SConscript +++ b/src/mongo/db/SConscript @@ -108,16 +108,6 @@ env.Library( ) env.Library( - target='initialize_snmp', - source=[ - 'initialize_snmp.cpp', - ], - LIBDEPS=[ - '$BUILD_DIR/mongo/base', - ], -) - -env.Library( target="dbmessage", source=[ "dbmessage.cpp", @@ -2441,7 +2431,6 @@ env.Library( 'index/index_access_methods', 'index/index_descriptor', 'index_builds_coordinator_mongod', - 'initialize_snmp', 'introspect', 'keys_collection_client_direct', 'kill_sessions_local', @@ -2551,7 +2540,6 @@ env.Library( 'index/index_access_method_factory', 'index/index_access_methods', 'index_builds_coordinator_mongod', - 'initialize_snmp', 'keys_collection_client_direct', 'kill_sessions', 'kill_sessions_local', diff --git a/src/mongo/db/initialize_snmp.cpp b/src/mongo/db/initialize_snmp.cpp deleted file mode 100644 index c623b8c91f7..00000000000 --- a/src/mongo/db/initialize_snmp.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * 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 - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/db/initialize_snmp.h" -#include "mongo/util/assert_util.h" - -namespace mongo { -namespace { -bool initSet = false; -std::function<void()> snmpInitializer = [] {}; -} // namespace -} // namespace mongo - -void mongo::registerSNMPInitializer(std::function<void()> init) { - invariant(!initSet); - snmpInitializer = std::move(init); - initSet = true; -} - -void mongo::initializeSNMP() { - return snmpInitializer(); -} diff --git a/src/mongo/db/initialize_snmp.h b/src/mongo/db/initialize_snmp.h deleted file mode 100644 index 5fb85193b43..00000000000 --- a/src/mongo/db/initialize_snmp.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * 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 - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - - -#pragma once - -#include <functional> - -namespace mongo { -/** - * Registers the specified initializer function `init` as the initialization handler for SNMP - * enterprise modules. - * - * NOTE: This function may only be called once. - * NOTE: This function is not multithread safe. - */ -void registerSNMPInitializer(std::function<void()> init); - -/** - * Performs initialization for SNMP enterprise modules, if present, otherwise does nothing. - * - * This will call the function registered by `registerSNMPInitializer`. It is safe to call when no - * function has been registered. - */ -void initializeSNMP(); -} // namespace mongo diff --git a/src/mongo/db/mongod_main.cpp b/src/mongo/db/mongod_main.cpp index b47ed584b9b..92601ca6a5d 100644 --- a/src/mongo/db/mongod_main.cpp +++ b/src/mongo/db/mongod_main.cpp @@ -89,7 +89,6 @@ #include "mongo/db/index_builds_coordinator_mongod.h" #include "mongo/db/index_names.h" #include "mongo/db/initialize_server_global_state.h" -#include "mongo/db/initialize_snmp.h" #include "mongo/db/internal_transactions_reap_service.h" #include "mongo/db/introspect.h" #include "mongo/db/json.h" @@ -543,8 +542,6 @@ ExitCode _initAndListen(ServiceContext* serviceContext, int listenPort) { startMongoDFTDC(); - initializeSNMP(); - if (mongodGlobalParams.scriptingEnabled) { ScriptEngine::setup(); } diff --git a/src/mongo/db/stats/counters.h b/src/mongo/db/stats/counters.h index 3d054806f46..cbf429127f6 100644 --- a/src/mongo/db/stats/counters.h +++ b/src/mongo/db/stats/counters.h @@ -113,7 +113,7 @@ public: _checkWrap(&OpCounters::_acceptableErrorInCommand, 1); } - // thse are used by snmp, and other things, do not remove + // thse are used by metrics things, do not remove const AtomicWord<long long>* getInsert() const { return &*_insert; } diff --git a/src/mongo/installer/msi/SConscript b/src/mongo/installer/msi/SConscript index 9bc64115bde..a0d68195d88 100644 --- a/src/mongo/installer/msi/SConscript +++ b/src/mongo/installer/msi/SConscript @@ -121,7 +121,6 @@ candle_targets = env.Command( ' -dTargetExt=.msi'
' -dTargetFileName=${SERVER_ARCHIVE}'
r' -dSaslSource=c:\sasl\bin'
- r' -dSnmpSource=c:\snmp\bin'
r' -dSslSource=' + env['WINDOWS_OPENSSL_BIN'] + ' -out ' + buildDir + r'\msi\\'
' -arch ' + msi_platform + ' -ext "$WIXUIEXT"'
' -ext "$WIXUTILEXT"'
diff --git a/src/mongo/installer/msi/wxs/BinaryFragment.wxs b/src/mongo/installer/msi/wxs/BinaryFragment.wxs index d82cbb04536..c0e2ad23db8 100644 --- a/src/mongo/installer/msi/wxs/BinaryFragment.wxs +++ b/src/mongo/installer/msi/wxs/BinaryFragment.wxs @@ -72,14 +72,6 @@ <File Id="f_saslPdb" Name="libsasl.pdb" Source="$(var.SaslSource)\libsasl.pdb"
DiskId="1" KeyPath="yes" />
</Component>
- <Component Id="c_snmp" Guid="F5E5A889-FC9F-4B9A-BEFD-C8ABC9A92D8D">
- <File Id="f_ssnmp" Name="netsnmp.dll" Source="$(var.SnmpSource)\netsnmp.dll"
- DiskId="1" KeyPath="yes" />
- </Component>
- <Component Id="c_snmpPdb" Guid="6AAB0ACE-C354-4D3A-B490-2AA235647AB3">
- <File Id="f_snmpPdb" Name="netsnmp.pdb" Source="$(var.SnmpSource)\netsnmp.pdb"
- DiskId="1" KeyPath="yes" />
- </Component>
<Component Id="c_mongocryptd" Guid="D243D194-B765-4DF8-BC67-8F4C329AD1B5">
<File Id="f_mongocryptd" Name="mongocryptd.exe" Source="$(var.BinarySource)\mongocryptd.exe"
DiskId ="1" KeyPath="yes"/>
@@ -90,30 +82,6 @@ </Component>
<?endif ?>
</DirectoryRef>
- <?if $(var.Edition) = Enterprise ?>
- <DirectoryRef Id="SNMP">
- <Component Id="c_snmpReadme" Guid="B968FBAC-1813-4039-9FED-A607A0E4CBB3">
- <File Id="f_snmpReadme" Name="README-snmp.txt" Source="$(var.EnterpriseBase)\docs\snmp\README-snmp.txt"
- DiskId="1" KeyPath="yes" />
- </Component>
- <Component Id="c_snmpConfMaster" Guid="0C8CAA6C-1473-4B14-9EE5-AF5A35B1DD8D">
- <File Id="f_snmpConfMaster" Name="mongod.conf.master" Source="$(var.EnterpriseBase)\docs\snmp\mongod.conf.master"
- DiskId="1" KeyPath="yes" />
- </Component>
- <Component Id="c_snmpConfSubagent" Guid="6FB66102-41A7-41BD-BB1F-1987E150FA78">
- <File Id="f_snmpConfSubagent" Name="mongod.conf.subagent" Source="$(var.EnterpriseBase)\docs\snmp\mongod.conf.subagent"
- DiskId="1" KeyPath="yes" />
- </Component>
- <Component Id="c_snmpMongodMib" Guid="F3E98C6B-FE42-44E7-8A1F-E47BDDD0A3D7">
- <File Id="f_snmpMongodMib" Name="MONGOD-MIB.txt" Source="$(var.EnterpriseBase)\docs\snmp\MONGOD-MIB.txt"
- DiskId="1" KeyPath="yes" />
- </Component>
- <Component Id="c_snmpMongodbincMib" Guid="58c6bd8e-a785-48a0-af48-42f6bf9f68b4">
- <File Id="f_snmpMongodbincMib" Name="MONGODBINC-MIB.txt" Source="$(var.EnterpriseBase)\docs\snmp\MONGODBINC-MIB.txt"
- DiskId="1" KeyPath="yes" />
- </Component>
- </DirectoryRef>
- <?endif ?>
<DirectoryRef Id="MONGO_DATA_PATH" >
<Component Id="c_MONGO_DATA_PATH" Guid="F695F048-E262-4871-A31B-0E2361BB4BCB">
<CreateFolder Directory="MONGO_DATA_PATH" >
@@ -143,13 +111,6 @@ </ComponentGroup>
<ComponentGroup Id="cg_EnterpriseServer">
<ComponentGroupRef Id="cg_EnterpriseBase" />
- <ComponentRef Id="c_snmp" />
- <ComponentRef Id="c_snmpPdb" />
- <ComponentRef Id="c_snmpReadme" />
- <ComponentRef Id="c_snmpConfMaster" />
- <ComponentRef Id="c_snmpConfSubagent" />
- <ComponentRef Id="c_snmpMongodMib" />
- <ComponentRef Id="c_snmpMongodbincMib" />
</ComponentGroup>
<?endif ?>
</Fragment>
diff --git a/src/mongo/installer/msi/wxs/Installer_64.wxs b/src/mongo/installer/msi/wxs/Installer_64.wxs index 1eb5266fe3f..96f87899f1c 100644 --- a/src/mongo/installer/msi/wxs/Installer_64.wxs +++ b/src/mongo/installer/msi/wxs/Installer_64.wxs @@ -47,7 +47,6 @@ <Directory Id="BIN" Name="bin" />
<Directory Id="MONGO_DATA_PATH" Name="data" />
<Directory Id="MONGO_LOG_PATH" Name="log" />
- <Directory Id="SNMP" Name="snmp" />
</Directory>
</Directory>
</Directory>
diff --git a/src/mongo/util/procparser_test.cpp b/src/mongo/util/procparser_test.cpp index 08db075dbf7..f2cda841579 100644 --- a/src/mongo/util/procparser_test.cpp +++ b/src/mongo/util/procparser_test.cpp @@ -510,25 +510,6 @@ TEST(FTDCProcNetstat, TestLocalNetstat) { ASSERT_KEY("IpExt:InOctets"); } -// Test we can parse the /proc/net/snmp on this machine and assert we have some expected fields -// Some keys can vary between distros, so we test only for the existence of a few basic ones -TEST(FTDCProcNetstat, TestLocalNetSnmp) { - - BSONObjBuilder builder; - - std::vector<StringData> keys{"Tcp:"_sd, "Ip:"_sd}; - - ASSERT_OK(procparser::parseProcNetstatFile(keys, "/proc/net/snmp", &builder)); - - BSONObj obj = builder.obj(); - auto stringMap = toStringMap(obj); - LOGV2(23367, "OBJ:{obj}", "obj"_attr = obj); - ASSERT_KEY("Ip:InReceives"); - ASSERT_KEY("Ip:OutRequests"); - ASSERT_KEY("Tcp:InSegs"); - ASSERT_KEY("Tcp:OutSegs"); -} - TEST(FTDCProcNetstat, TestLocalNonExistentNetstat) { std::vector<StringData> keys{}; BSONObjBuilder builder; |