����JFIF��x�x����'
Server IP : 78.140.185.180 / Your IP : 3.15.31.240 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 : /usr/lib64/nagios/plugins/base/ |
Upload File : |
#!/usr/bin/env perl use extreme; use IPC::Run qw(run); use Getopt::Long; my ( $opt_d, @incidents ); my $exitcode = '0'; help() if !(@ARGV); # Set options GetOptions( "help|h" => \&help, "d=s" => \$opt_d ); &help unless ($opt_d); my @paths = split( ',', $opt_d ); for my $path (@paths) { next if $path !~ /^(\/[a-zA-Z0-9\.\-_]+\/?)+$/; my $mount = run_cmd( '/bin/mountpoint', $path ); if ($mount) { push @incidents, "The mountpoint $path is not mounted!"; $exitcode = '2'; next; } my $write = run_cmd( '/bin/touch', $path . '/check_mount' ); if ($write) { push @incidents, "Cannot write to $path!"; $exitcode = '2'; next; } unlink $path . '/check_mount'; } say join( "\n", @incidents ) if @incidents; exit $exitcode; # subs sub run_cmd { my @cmd = @_; my ( $out, $err ); run \@cmd, \undef, \$out, \$err; return 1 if $? != 0; return; } sub help { print "Usage : $0 -d DIR \n\n"; print "Options :\n"; print " -d\n\tPath to directories to be checked, separated by commas\n"; print " -h, --help\n\tPrint this help screen\n"; print "\nExample : check_mount -d /var/lib/pterodactyl/backups,/mnt/nfs\n"; exit 3; }