The name of the initial branch for new projects is now "main" instead of "master". Existing projects remain unchanged. More information: https://doku.lrz.de/display/PUBLIC/GitLab

Commit 2d8dc277 authored by Michael Ott's avatar Michael Ott
Browse files

Remove port configuration parameter in SNMP plugin. This is to be configured via the host parameter

parent 4904e57d
...@@ -521,8 +521,7 @@ Explanation of the values specific for the SNMP plugin: ...@@ -521,8 +521,7 @@ Explanation of the values specific for the SNMP plugin:
|:----- |:----------- | |:----- |:----------- |
| connection | An aggregating connection | connection | An aggregating connection
| Type | Type of the SNMP application which runs on the device queried by the connection. Currently only the type Agent is supported. | Type | Type of the SNMP application which runs on the device queried by the connection. Currently only the type Agent is supported.
| Host | Host name of the device which is to be queried. | Host | Host name of the device which is to be queried. Follows net-snmp's [<transport-specifier>:]<transport-address> format, e.g. udp:hostname:161
| Port | The SNMP port should be usually 161. No changes should be required here.
| OIDPrefix | This OIDPrefix is used for all following sensors. | OIDPrefix | This OIDPrefix is used for all following sensors.
| | | |
| Version | Which SNMP version to use (either 2 (maps to 2c) or 3). | Version | Which SNMP version to use (either 2 (maps to 2c) or 3).
......
...@@ -13,7 +13,6 @@ template_single_sensor temp1 { ...@@ -13,7 +13,6 @@ template_single_sensor temp1 {
connection name1 { connection name1 {
Type Agent ; Type of connection Type Agent ; Type of connection
Host test.net-snmp.org ; Hostname of the SNMP agent Host test.net-snmp.org ; Hostname of the SNMP agent
Port 161 ; Port of the SNMP agent
OIDPrefix 1.3.6.1.2.1.1 ; When querying OIDs, we'll OIDPrefix 1.3.6.1.2.1.1 ; When querying OIDs, we'll
; always use this prefix ; always use this prefix
Version 3 Version 3
......
...@@ -56,7 +56,6 @@ void SNMPConfigurator::sensorEntity(SNMPConnection& s, CFG_VAL config) { ...@@ -56,7 +56,6 @@ void SNMPConfigurator::sensorEntity(SNMPConnection& s, CFG_VAL config) {
//ATTRIBUTE("Type", setType) //TODO would be relevant if we would support more than just agent mode... //ATTRIBUTE("Type", setType) //TODO would be relevant if we would support more than just agent mode...
//at the moment we just ignore it, as it can be only "Agent" anyways //at the moment we just ignore it, as it can be only "Agent" anyways
ATTRIBUTE("Host", setHost); ATTRIBUTE("Host", setHost);
ATTRIBUTE("Port", setPort);
ATTRIBUTE("Community", setSNMPCommunity); ATTRIBUTE("Community", setSNMPCommunity);
ATTRIBUTE("OIDPrefix", setOIDPrefix); ATTRIBUTE("OIDPrefix", setOIDPrefix);
ATTRIBUTE("Version", setVersion); ATTRIBUTE("Version", setVersion);
......
...@@ -40,7 +40,6 @@ SNMPConnection::SNMPConnection(const std::string& name) : ...@@ -40,7 +40,6 @@ SNMPConnection::SNMPConnection(const std::string& name) :
_privProto(NULL), _privProto(NULL),
_authProtoLen(0), _authProtoLen(0),
_privProtoLen(0), _privProtoLen(0),
_port(0),
_securityLevel(-1), _securityLevel(-1),
_version(-1), _version(-1),
_snmpSessp(NULL) { _snmpSessp(NULL) {
...@@ -60,7 +59,6 @@ SNMPConnection::SNMPConnection(const SNMPConnection& other) : ...@@ -60,7 +59,6 @@ SNMPConnection::SNMPConnection(const SNMPConnection& other) :
_privProto(other._privProto), _privProto(other._privProto),
_authProtoLen(other._authProtoLen), _authProtoLen(other._authProtoLen),
_privProtoLen(other._privProtoLen), _privProtoLen(other._privProtoLen),
_port(other._port),
_securityLevel(other._securityLevel), _securityLevel(other._securityLevel),
_version(other._version), _version(other._version),
_snmpSession(other._snmpSession), _snmpSession(other._snmpSession),
...@@ -92,7 +90,6 @@ SNMPConnection& SNMPConnection::operator=(const SNMPConnection& other) { ...@@ -92,7 +90,6 @@ SNMPConnection& SNMPConnection::operator=(const SNMPConnection& other) {
_privProto = other._privProto; _privProto = other._privProto;
_authProtoLen = other._authProtoLen; _authProtoLen = other._authProtoLen;
_privProtoLen = other._privProtoLen; _privProtoLen = other._privProtoLen;
_port = other._port;
_securityLevel = other._securityLevel; _securityLevel = other._securityLevel;
_version = other._version; _version = other._version;
_snmpSessp = NULL; _snmpSessp = NULL;
...@@ -248,7 +245,6 @@ int64_t SNMPConnection::get(const oid* const OID, size_t OIDLen) { ...@@ -248,7 +245,6 @@ int64_t SNMPConnection::get(const oid* const OID, size_t OIDLen) {
void SNMPConnection::printEntityConfig(LOG_LEVEL ll, unsigned int leadingSpaces) { void SNMPConnection::printEntityConfig(LOG_LEVEL ll, unsigned int leadingSpaces) {
std::string leading(leadingSpaces, ' '); std::string leading(leadingSpaces, ' ');
LOG_VAR(ll) << leading << "Port: " << getPort();
LOG_VAR(ll) << leading << "OIDPrefix: " << getOIDPrefix(); LOG_VAR(ll) << leading << "OIDPrefix: " << getOIDPrefix();
std::string version("unknown"); std::string version("unknown");
switch(getVersion()) { switch(getVersion()) {
......
...@@ -87,7 +87,6 @@ public: ...@@ -87,7 +87,6 @@ public:
} }
} }
void setHost(const std::string& host) { _name = host; } void setHost(const std::string& host) { _name = host; }
void setPort(const std::string& port) { _port = stoi(port); }
void setSecurityLevel(const std::string& securityLevel) { void setSecurityLevel(const std::string& securityLevel) {
if (boost::iequals(securityLevel, SEC_NOAUTHNOPRIV)) { if (boost::iequals(securityLevel, SEC_NOAUTHNOPRIV)) {
_securityLevel = SNMP_SEC_LEVEL_NOAUTH; _securityLevel = SNMP_SEC_LEVEL_NOAUTH;
...@@ -142,7 +141,6 @@ public: ...@@ -142,7 +141,6 @@ public:
} }
} }
const std::string& getHost() const { return _name; } const std::string& getHost() const { return _name; }
int getPort() const { return _port; }
int getSecurityLevel() const { return _securityLevel; } int getSecurityLevel() const { return _securityLevel; }
const std::string getSecurityLevelString() const { const std::string getSecurityLevelString() const {
if (_securityLevel == SNMP_SEC_LEVEL_NOAUTH) { if (_securityLevel == SNMP_SEC_LEVEL_NOAUTH) {
...@@ -194,7 +192,6 @@ private: ...@@ -194,7 +192,6 @@ private:
oid* _privProto; oid* _privProto;
size_t _authProtoLen; size_t _authProtoLen;
size_t _privProtoLen; size_t _privProtoLen;
int _port;
int _securityLevel; int _securityLevel;
long int _version; long int _version;
struct snmp_session _snmpSession; struct snmp_session _snmpSession;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment