mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-03 06:04:53 +00:00
Add support for opensmtp in check_mailq.
PR: 222237
Submitted by: mmokhi
Obtained from: d56818f512
Obtained from: https://github.com/monitoring-plugins/monitoring-plugins/pull/1495
Sponsored by: Absolight
This commit is contained in:
parent
efb523fb48
commit
6da19f7139
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=449835
@ -3,7 +3,7 @@
|
||||
|
||||
PORTNAME= monitoring-plugins
|
||||
PORTVERSION= 2.2
|
||||
PORTREVISION= 2
|
||||
PORTREVISION= 3
|
||||
CATEGORIES= net-mgmt
|
||||
MASTER_SITES= https://www.monitoring-plugins.org/download/ LOCAL/mat/${PORTNAME}
|
||||
|
||||
|
@ -0,0 +1,56 @@
|
||||
From 94acff9f2616fbca8fd31292d374d9ce8a45263a Mon Sep 17 00:00:00 2001
|
||||
From: Filias Heidt <fh@netzkommune.de>
|
||||
Date: Fri, 9 Jun 2017 14:46:00 +0200
|
||||
Subject: [PATCH] add support for opensmtpd
|
||||
|
||||
--- plugins-scripts/check_mailq.pl.orig 2016-11-29 08:45:08 UTC
|
||||
+++ plugins-scripts/check_mailq.pl
|
||||
@@ -550,6 +550,39 @@ elsif ( $mailq eq "nullmailer" ) {
|
||||
}
|
||||
} # end of ($mailq eq "nullmailer")
|
||||
|
||||
+elsif ( $mailq eq "opensmtp" ) {
|
||||
+ ## open mailq
|
||||
+ if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
|
||||
+ if (! open (MAILQ, "$sudo $utils::PATH_TO_MAILQ | " ) ) {
|
||||
+ print "ERROR: could not open $utils::PATH_TO_MAILQ \n";
|
||||
+ exit $ERRORS{'UNKNOWN'};
|
||||
+ }
|
||||
+ }elsif( defined $utils::PATH_TO_MAILQ){
|
||||
+ unless (-x $utils::PATH_TO_MAILQ) {
|
||||
+ print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($)))\n";
|
||||
+ exit $ERRORS{'UNKNOWN'};
|
||||
+ }
|
||||
+ } else {
|
||||
+ print "ERROR: \$utils::PATH_TO_MAILQ is not defined\n";
|
||||
+ exit $ERRORS{'UNKNOWN'};
|
||||
+ }
|
||||
+
|
||||
+ $msg_q++ while (<MAILQ>);
|
||||
+
|
||||
+ close(MAILQ) ;
|
||||
+ if ($msg_q < $opt_w) {
|
||||
+ $msg = "OK: $mailq mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
|
||||
+ $state = $ERRORS{'OK'};
|
||||
+ }elsif ($msg_q >= $opt_w && $msg_q < $opt_c) {
|
||||
+ $msg = "WARNING: $mailq mailq is $msg_q (threshold w = $opt_w)";
|
||||
+ $state = $ERRORS{'WARNING'};
|
||||
+ }else {
|
||||
+ $msg = "CRITICAL: $mailq mailq is $msg_q (threshold c = $opt_c)";
|
||||
+ $state = $ERRORS{'CRITICAL'};
|
||||
+ }
|
||||
+} # end of ($mailq eq "opensmtp")
|
||||
+
|
||||
+
|
||||
# Perfdata support
|
||||
print "$msg|unsent=$msg_q;$opt_w;$opt_c;0\n";
|
||||
exit $state;
|
||||
@@ -610,7 +643,7 @@ sub process_arguments(){
|
||||
}
|
||||
|
||||
if (defined $opt_M) {
|
||||
- if ($opt_M =~ /^(sendmail|qmail|postfix|exim|nullmailer)$/) {
|
||||
+ if ($opt_M =~ /^(sendmail|qmail|postfix|exim|nullmailer|opensmtp)$/) {
|
||||
$mailq = $opt_M ;
|
||||
}elsif( $opt_M eq ''){
|
||||
$mailq = 'sendmail';
|
@ -3,7 +3,7 @@
|
||||
|
||||
PORTNAME= nagios-plugins
|
||||
PORTVERSION= 2.2.1
|
||||
PORTREVISION= 4
|
||||
PORTREVISION= 5
|
||||
PORTEPOCH= 1
|
||||
CATEGORIES= net-mgmt
|
||||
MASTER_SITES= https://www.nagios-plugins.org/download/ \
|
||||
|
@ -0,0 +1,57 @@
|
||||
commit d56818f5121b05439c7b7a1655d96ab39e066797
|
||||
Author: Filias Heidt <fh@netzkommune.de>
|
||||
Date: 2017-04-24 11:00:43 +0200
|
||||
|
||||
add support for opensmtpd
|
||||
|
||||
--- plugins-scripts/check_mailq.pl.orig 2017-04-19 16:03:12 UTC
|
||||
+++ plugins-scripts/check_mailq.pl
|
||||
@@ -558,6 +558,39 @@ elsif ( $mailq eq "nullmailer" ) {
|
||||
}
|
||||
} # end of ($mailq eq "nullmailer")
|
||||
|
||||
+elsif ( $mailq eq "opensmtp" ) {
|
||||
+ ## open mailq
|
||||
+ if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
|
||||
+ if (! open (MAILQ, "$sudo $utils::PATH_TO_MAILQ | " ) ) {
|
||||
+ print "ERROR: could not open $utils::PATH_TO_MAILQ \n";
|
||||
+ exit $ERRORS{'UNKNOWN'};
|
||||
+ }
|
||||
+ }elsif( defined $utils::PATH_TO_MAILQ){
|
||||
+ unless (-x $utils::PATH_TO_MAILQ) {
|
||||
+ print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($)))\n";
|
||||
+ exit $ERRORS{'UNKNOWN'};
|
||||
+ }
|
||||
+ } else {
|
||||
+ print "ERROR: \$utils::PATH_TO_MAILQ is not defined\n";
|
||||
+ exit $ERRORS{'UNKNOWN'};
|
||||
+ }
|
||||
+
|
||||
+ $msg_q++ while (<MAILQ>);
|
||||
+
|
||||
+ close(MAILQ) ;
|
||||
+ if ($msg_q < $opt_w) {
|
||||
+ $msg = "OK: $mailq mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
|
||||
+ $state = $ERRORS{'OK'};
|
||||
+ }elsif ($msg_q >= $opt_w && $msg_q < $opt_c) {
|
||||
+ $msg = "WARNING: $mailq mailq is $msg_q (threshold w = $opt_w)";
|
||||
+ $state = $ERRORS{'WARNING'};
|
||||
+ }else {
|
||||
+ $msg = "CRITICAL: $mailq mailq is $msg_q (threshold c = $opt_c)";
|
||||
+ $state = $ERRORS{'CRITICAL'};
|
||||
+ }
|
||||
+} # end of ($mailq eq "opensmtp")
|
||||
+
|
||||
+
|
||||
# Perfdata support
|
||||
print "$msg|unsent=$msg_q;$opt_w;$opt_c;0\n";
|
||||
exit $state;
|
||||
@@ -618,7 +651,7 @@ sub process_arguments(){
|
||||
}
|
||||
|
||||
if (defined $opt_M) {
|
||||
- if ($opt_M =~ /^(sendmail|qmail|postfix|exim|nullmailer)$/) {
|
||||
+ if ($opt_M =~ /^(sendmail|qmail|postfix|exim|nullmailer|opensmtp)$/) {
|
||||
$mailq = $opt_M ;
|
||||
}elsif( $opt_M eq ''){
|
||||
$mailq = 'sendmail';
|
Loading…
Reference in New Issue
Block a user