Browse Source

check_junos: Added support for the exclude feature to all checks.

Sebastian Harl 12 năm trước cách đây
mục cha
commit
c559d48491
1 tập tin đã thay đổi với 19 bổ sung1 xóa
  1. 19 1
      check_junos.pl

+ 19 - 1
check_junos.pl

@@ -278,7 +278,13 @@ sub check_interfaces
 	foreach my $iface (@interfaces) {
 		my $name = $plugin->get_query_object_value($iface, 'name');
 		my $desc = $plugin->get_query_object_value($iface, 'description');
-		my $status = check_interface($plugin, $iface, $opts, @$targets);
+		my $status;
+
+		if (grep { m/^$name$/ } @$exclude) {
+			next;
+		}
+
+		$status = check_interface($plugin, $iface, $opts, @$targets);
 
 		my $tmp;
 
@@ -383,6 +389,10 @@ sub check_interface_forwarding
 			next;
 		}
 
+		if (grep { m/^$name$/ } @$exclude) {
+			next;
+		}
+
 		foreach my $vlan_member ($plugin->get_query_object($iface,
 				['interface-vlan-member-list', 'interface-vlan-member'])) {
 			my $status = $plugin->get_query_object_value($vlan_member,
@@ -444,6 +454,10 @@ sub check_chassis_environment
 			next;
 		}
 
+		if (grep { m/^$name$/ } @$exclude) {
+			next;
+		}
+
 		if ($plugin->get_query_object_value($item, 'class')) {
 			$class = $plugin->get_query_object_value($item, 'class');
 		}
@@ -539,6 +553,10 @@ sub check_system_storage
 				next;
 			}
 
+			if (grep { m/^$mnt_pt$/ } @$exclude) {
+				next;
+			}
+
 			my $used = $plugin->get_query_object_value($fs, 'used-percent') + 0;
 
 			my $state = $plugin->check_threshold($used);