ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ#!/usr/bin/perl ############### # # Check ICMP connectivity for various IPs # see https://incidencias.irontec.com/view.php?id=39261 # # this script is a wrapper for /usr/lib/nagios/plugins/check_icmp # see it for more options # ############### use strict; use Getopt::Long; use Data::Dumper; use File::Basename; use Switch; use vars qw($opt_h $output $exit_status $perfdata $path); my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); $path="/usr/lib64/nagios/plugins"; Getopt::Long::Configure('bundling'); GetOptions ("h|help" => \$opt_h, "help"); my $program = basename($0); sub print_help () { print " Check ICMP status, it allows multiple IPs separated by commas (,) Example: $program 10.10.0.81,10.10.0.39 200.000ms,40% 500.000ms,80% \$ARG1\$ specify a target \$ARG2\$ warning threshold (currently 200.000ms,40%) \$ARG3\$ critical threshold (currently 500.000ms,80%) -h, --help Show this help "; } sub usage { my $format=shift; printf($format,@_); exit $ERRORS{'UNKNOWN'}; } if ($opt_h) { print_help(); exit $ERRORS{'OK'}; } if (@ARGV < 1) { print "NOT HOST EXPLAINED\n"; exit $ERRORS{'CRITICAL'}; } $output=""; $perfdata=""; $exit_status=0; my @output; my @perfdata; my $outpout; my $perfdata; for my $host (split(/,/,@ARGV[0])){ my $command="sudo $path/check_icmp -H $host"; $command .= " -w @ARGV[1]" if @ARGV[1]; $command .= " -c @ARGV[2]" if @ARGV[2]; my $out = `$command`; if ($? > 0) { $exit_status=2; } my @data = split /\|/, $out; my @rta = split / /, $data[0]; $output = $data[0]; $output = "$data[0]" if $rta[0] ne "OK"; push @output, $output; @rta = split / /, $data[1]; push @perfdata, "$host-$rta[0]"; } $output = join '
', @output; $perfdata = join ' ', @perfdata; print "$output|$perfdata\n"; if ($exit_status > 0){ exit $ERRORS{'CRITICAL'}; } exit $ERRORS{'OK'};