����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/task/1630575/root/lib64/nagios/plugins/base/ |
Upload File : |
#!/usr/bin/env perl
use strict;
use warnings;
use Carp;
use Getopt::Long;
sub usage {
print <<"END_USAGE";
Usage:
$0 [ options ]
Options:
--sudo - request nf_conntrack_count through sudo. default false
--warn - warning nf_conntrack_count connections. default 80
--crit - critical nf_conntrack_count connections. default 90
Values is percents of net.nf_conntrack_max.
END_USAGE
exit 1;
}
my $help;
my $sudo;
my $warn = 80;
my $crit = 90;
GetOptions(
'sudo' => \$sudo,
'warn=i' => \$warn,
'crit=i' => \$crit,
'h|help' => \$help,
) || usage;
return usage() if $help;
my $nf_conntrack_max = `sysctl -n net.nf_conntrack_max`;
my $nf_conntrack_count = $sudo
? `sudo sysctl -n net.netfilter.nf_conntrack_count`
: `sysctl -n net.netfilter.nf_conntrack_count`;
chomp $nf_conntrack_max;
chomp $nf_conntrack_count;
my $percents = sprintf "%.1f", ($nf_conntrack_count / $nf_conntrack_max * 100);
my $msg = 'UNKNOWN';
my $state = 3;
if ( $percents > $crit ) {
$msg = "CRITICAL - $percents% ($nf_conntrack_count)";
$state = 2;
}
elsif ( $percents > $warn ) {
$msg = "WARNING - $percents% ($nf_conntrack_count)";
$state = 1;
}
else {
$msg = "OK - $percents% ($nf_conntrack_count)";
$state = 0;
}
my $perfdata_string =
"nf_conntrack_count=$nf_conntrack_count;".
int($nf_conntrack_max*$warn / 100) .';'.
int($nf_conntrack_max*$crit / 100) .";0;$nf_conntrack_max";
print "$msg";
print "|$perfdata_string\n";
exit $state;
1;