From 9b1a3fb86ae57ea62c9c225334e6f933a20e7eb3 Mon Sep 17 00:00:00 2001 From: Neil Lathwood Date: Thu, 12 Apr 2018 04:35:51 +0100 Subject: [PATCH] refactor: Use snmp.version config option to allow users to set versions available (#8512) * refactor: Use snmp.version config option to allow users to set versions available * Updated to just use snmp default version for auto discovery * remove additional spaces * remove use Config --- doc/Support/Configuration.md | 2 +- includes/defaults.inc.php | 2 +- includes/functions.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/Support/Configuration.md b/doc/Support/Configuration.md index 74db7429e6..9a8f35e541 100644 --- a/doc/Support/Configuration.md +++ b/doc/Support/Configuration.md @@ -350,7 +350,7 @@ $config['poller_modules']['bgp-peers'] = 0; $config['snmp']['timeout'] = 1; # timeout in seconds $config['snmp']['retries'] = 5; # how many times to retry the query $config['snmp']['transports'] = array('udp', 'udp6', 'tcp', 'tcp6'); -$config['snmp']['version'] = "v2c"; # Default version to use +$config['snmp']['version'] = ['v2c', 'v3', 'v1']; # Default versions to use $config['snmp']['port'] = 161; ``` Default SNMP options including retry and timeout settings and also default version and port. diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 36dfb58eb8..4ff6df8acc 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -157,7 +157,7 @@ $config['snmp']['transports'] = array( 'tcp6', ); -$config['snmp']['version'] = 'v2c'; +$config['snmp']['version'] = ['v2c', 'v3', 'v1']; // Default version to use // SNMPv1/2c default settings $config['snmp']['community'][0] = 'public'; diff --git a/includes/functions.php b/includes/functions.php index 86161986f1..8f06073c14 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -504,7 +504,7 @@ function addHost($host, $snmp_version = '', $port = '161', $transport = 'udp', $ // if $snmpver isn't set, try each version of snmp if (empty($snmp_version)) { - $snmpvers = array('v2c', 'v3', 'v1'); + $snmpvers = Config::get('snmp.version'); } else { $snmpvers = array($snmp_version); }