Parcourir la source

fixed parameter transmission to snmp plugins nagios

root il y a 1 an
Parent
commit
4b05511

+ 2 - 2
docs/nagios/scripts/plugins/check_snmp_bandwidth.pl

@@ -28,14 +28,14 @@ my $RET_CRITICAL=2;
 
 if (scalar @ARGV <= 2) {
     print "Usage: $0 <host> <snmp_string> <port> <32|64> [warning] [critical]\n";
-    print "<snmp_string> => community;version;user;auth;priv\n";
+    print "<snmp_string> => community::version::user::auth::priv\n";
     print "for version 3: community = password\n";
     exit $RET_OK;
     }
 
 my $host = shift @ARGV;
 my $snmp_str = shift @ARGV;
-my ($community,$version,$user,$auth,$priv) = split(/;/,$snmp_str);
+my ($community,$version,$user,$auth,$priv) = split(/\:\:/,$snmp_str);
 
 my $snmp;
 $snmp->{version} = $version || '2';

+ 2 - 2
docs/nagios/scripts/plugins/check_snmp_crc.pl

@@ -24,14 +24,14 @@ my $err_step = 100;
 
 if (scalar @ARGV <= 2) {
     print "Usage: $0 <host> <snmp_string> <port> <32|64> [warning] [critical]\n";
-    print "<snmp_string> => community;version;user;auth;priv\n";
+    print "<snmp_string> => community::version::user::auth::priv\n";
     print "for version 3: community = password\n";
     exit $RET_OK;
     }
 
 my $host = shift @ARGV;
 my $snmp_str = shift @ARGV;
-my ($community,$version,$user,$auth,$priv) = split(/;/,$snmp_str);
+my ($community,$version,$user,$auth,$priv) = split(/\:\:/,$snmp_str);
 
 my $snmp;
 $snmp->{version} = $version || '2';

+ 2 - 2
docs/nagios/scripts/plugins/check_snmp_crc_simple.pl

@@ -23,14 +23,14 @@ my $err_step = 100;
 
 if (scalar @ARGV <= 2) {
     print "Usage: $0 <host> <snmp_string> <port> [warning] [critical]\n";
-    print "<snmp_string> => community;version;user;auth;priv\n";
+    print "<snmp_string> => community::version::user::auth::priv\n";
     print "for version 3: community = password\n";
     exit $RET_OK;
     }
 
 my $host = shift @ARGV;
 my $snmp_str = shift @ARGV;
-my ($community,$version,$user,$auth,$priv) = split(/;/,$snmp_str);
+my ($community,$version,$user,$auth,$priv) = split(/\:\:/,$snmp_str);
 
 my $snmp;
 $snmp->{version} = $version || '2';

+ 3 - 2
docs/nagios/scripts/plugins/check_snmp_db_bandwidth.pl

@@ -30,15 +30,16 @@ my $RET_UNKNOWN=3;
 my $RET_CRITICAL=2;
 
 if (scalar @ARGV <= 2) {
+    print "Run: ".join(';',@ARGV)."\n";
     print "Usage: $0 <host> <snmp_string> <port> <32|64> [warning] [critical]\n";
-    print "<snmp_string> => community;version;user;auth;priv\n";
+    print "<snmp_string> => community::version::user::auth::priv\n";
     print "for version 3: community = password\n";
     exit $RET_OK;
     }
 
 my $host = shift @ARGV;
 my $snmp_str = shift @ARGV;
-my ($community,$version,$user,$auth,$priv) = split(/;/,$snmp_str);
+my ($community,$version,$user,$auth,$priv) = split(/\:\:/,$snmp_str);
 
 my $snmp;
 $snmp->{version} = $version || '2';

+ 2 - 2
docs/nagios/scripts/plugins/check_snmp_db_crc.pl

@@ -23,14 +23,14 @@ my $RET_CRITICAL=2;
 
 if (scalar @ARGV <= 2) {
     print "Usage: $0 <host> <snmp_string> <port> [warning] [critical]\n";
-    print "<snmp_string> => community;version;user;auth;priv\n";
+    print "<snmp_string> => community::version::user::auth::priv\n";
     print "for version 3: community = password\n";
     exit $RET_OK;
     }
 
 my $host = shift @ARGV;
 my $snmp_str = shift @ARGV;
-my ($community,$version,$user,$auth,$priv) = split(/;/,$snmp_str);
+my ($community,$version,$user,$auth,$priv) = split(/\:\:/,$snmp_str);
 
 my $snmp;
 $snmp->{version} = $version || '2';

+ 4 - 4
scripts/eyelib/nagios.pm

@@ -109,9 +109,9 @@ my $device = shift;
 my $host_template = 'generic-host';
 my $default_service="local-service";
 
-my $snmp_string = $device->{snmp}->{'ro-community'};
-if ($device->{snmp}->{version} > 2) {
-    $snmp_string = join(";",$device->{snmp}->{'ro-password'},$device->{snmp}->{version},$device->{snmp}->{'ro-user'},$device->{snmp}->{'auth-proto'},$device->{snmp}->{'priv-proto'});
+my $snmp_string = $device->{parent_snmp}->{'ro-community'};
+if ($device->{parent_snmp}->{version} > 2) {
+    $snmp_string = join("::",$device->{parent_snmp}->{'ro-password'},$device->{parent_snmp}->{version},$device->{parent_snmp}->{'ro-user'},$device->{parent_snmp}->{'auth-proto'},$device->{parent_snmp}->{'priv-proto'});
     }
 
 my $ping_enable = $device->{ou}->{nagios_ping};
@@ -187,7 +187,7 @@ if (!$device->{ou}->{nagios_dir}) { print Dumper($device); }
 
 my $snmp_string = $device->{snmp}->{'ro-community'};
 if ($device->{snmp}->{version} > 2) {
-    $snmp_string = join(";",$device->{snmp}->{'ro-password'},$device->{snmp}->{version},$device->{snmp}->{'ro-user'},$device->{snmp}->{'auth-proto'},$device->{snmp}->{'priv-proto'});
+    $snmp_string = join("::",$device->{snmp}->{'ro-password'},$device->{snmp}->{version},$device->{snmp}->{'ro-user'},$device->{snmp}->{'auth-proto'},$device->{snmp}->{'priv-proto'});
     }
 
 my $cfg_file = $device->{ou}->{nagios_dir}."/".$device->{name}.".cfg";