File: 15_check_snmp_int_spaces

package info (click to toggle)
nagios-snmp-plugins 2.1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,244 kB
  • sloc: perl: 7,453; sh: 309; makefile: 50
file content (32 lines) | stat: -rw-r--r-- 1,073 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From 8f1c304b82c7bd9f5d1b23faa91ba86b0f99c4e2 Mon Sep 17 00:00:00 2001
From: PGranado <pgranado@pt.lu>
Date: Fri, 22 Mar 2019 15:05:32 +0100
Subject: [PATCH] Add spaces only if necessary, resolving bug #32

---
 plugins/check_snmp_int.pl | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/plugins/check_snmp_int.pl
+++ b/plugins/check_snmp_int.pl
@@ -777,7 +777,7 @@
 # make all checks and output for all interfaces
 for (my $i = 0; $i < $num_int; $i++) {
     $print_out .= ", " if (defined($print_out));
-    $perf_out  .= " "  if (defined($perf_out));
+    
     my $usable_data = 1;
 
     # Get the status of the current interface
@@ -785,7 +785,10 @@
         = defined($o_admin)
         ? $$result{ $admin_table . "." . $tindex[$i] }
         : $$result{ $oper_table . $tindex[$i] };
-
+    
+    # Add spaces only if necessary
+    $perf_out .= " " if (defined ($perf_out) && $int_status==2 ) ;
+    
     # Make the bandwith & error checks if necessary
     if (defined($o_checkperf) && $int_status == 1) {
         $temp_file_name = $descr[$i];