����JFIF��x�x����'403WebShell
403Webshell
Server IP : 78.140.185.180  /  Your IP : 3.14.248.120
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib64/nagios/plugins/base/check_journalctl
#!/usr/bin/env perl

use extreme;
use Getopt::Long;

my %O_CODES = ( 0 => 'OK', 1=> 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN');

my ( $w, $c, $h );

Getopt::Long::Configure('pass_through');
GetOptions(
    'w|warningregexp=s'  => \$w,
    'c|criticalregexp=s' => \$c,
    'h|help'             => \$h,
) or die 'Error in command line arguments';

if ($h) {
    say
      "Plugin parses arguments: \n  -w|warningregexp\n  -c|criticalregexp,\n"
      . "call journalctl with all the remaining arguments and\n"
      . "check is the journal output match warningregexp or criticalregexp.\n"
      . "Example: \n"
      . "$0 -w WARNING -c \"changed state to: Invalid and should be removed\" -t lvm --since \"'128 hour ago'\"";
    exit 3;
}

my @j_args   = @ARGV;
my @messages = qw();
my $status   = 0;

open( my $ch, '-|', "/bin/journalctl --quiet @j_args" ) or die $!;
while ( my $line = <$ch> ) {
    chomp $line;
    if ( $line =~ qr/$c/ ) {
        $status = 2;
        push @messages, "critical: $line";
        next;
    }
    if ( $line =~ qr/$w/ ) {
        $status = 1 if $status < 1;
        push @messages, "warning: $line";
    }
}

say $O_CODES{$status};
say join( "\n", @messages ) if @messages;
exit $status;

Youez - 2016 - github.com/yon3zu
LinuXploit