From aca9814e0f3a538d15ba8dc9ec81c63886cbf367 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 15 Feb 2021 19:10:49 +0100 Subject: [PATCH] uniqid pandora_snmp_bandwidth --- pandora_server/util/plugin/pandora_snmp_bandwidth.pl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pandora_server/util/plugin/pandora_snmp_bandwidth.pl b/pandora_server/util/plugin/pandora_snmp_bandwidth.pl index 100147a905..d6edf5d897 100644 --- a/pandora_server/util/plugin/pandora_snmp_bandwidth.pl +++ b/pandora_server/util/plugin/pandora_snmp_bandwidth.pl @@ -56,6 +56,7 @@ Where OPTIONS could be: [EXTRA] -ifIndex Target interface to retrieve, if not specified, total bandwith will be reported. + -uniqid Use custom temporary file name. Note: You can also use snmpget/snmpwalk argument notation, e.g. -v is equal to -version, -c to -community, etc. @@ -124,6 +125,9 @@ sub update_config_key ($) { if ($arg eq 'ifIndex') { return "ifIndex"; } +if ($arg eq 'uniqid') { + return "uniqid"; +} } ################################################################################ @@ -478,6 +482,10 @@ if(snmp_walk({ # Create unique name for tmp and log file for host my $filename = $config->{'tmp'}.'/pandora_bandwith_'.$config->{'host'}; +if (!empty($config->{'uniqid'})) { + $filename = $config->{'tmp'}.'/pandora_bandwith_'.$config->{'uniqid'}; +} + # Replace every dot for underscore $filename =~ tr/./_/; $config->{'tmp_file'} = $filename.'.idx' if empty($config->{'tmp_file'});