summaryrefslogtreecommitdiff
path: root/net-mgmt
diff options
context:
space:
mode:
authorMathieu Arnold <mat@FreeBSD.org>2017-08-30 14:35:00 +0000
committerMathieu Arnold <mat@FreeBSD.org>2017-08-30 14:35:00 +0000
commitcfba48c1e53967334ce58bc439ad77ea618c87a6 (patch)
treeea6f7c8ecc0a5218e3c3dd1a0878c8e77c057416 /net-mgmt
parentMFH: r445516 r448688 (diff)
MFH: r448907 r448913 r448920 r448923 r448927 r448983
Add jail support to check_procs, restore check_http's -C option to its former glory. Sponsored by: Absolight
Diffstat (limited to 'net-mgmt')
-rw-r--r--net-mgmt/monitoring-plugins/Makefile2
-rw-r--r--net-mgmt/monitoring-plugins/files/patch-configure18
-rw-r--r--net-mgmt/monitoring-plugins/files/patch-plugins_check__nagios.c10
-rw-r--r--net-mgmt/monitoring-plugins/files/patch-plugins_check__procs.c107
-rw-r--r--net-mgmt/nagios-plugins/Makefile2
-rw-r--r--net-mgmt/nagios-plugins/files/patch-configure27
-rw-r--r--net-mgmt/nagios-plugins/files/patch-plugins_check__http.c17
-rw-r--r--net-mgmt/nagios-plugins/files/patch-plugins_check__nagios.c10
-rw-r--r--net-mgmt/nagios-plugins/files/patch-plugins_check__procs.c107
-rw-r--r--net-mgmt/nagios-plugins/files/patch-plugins_sslutils.c21
10 files changed, 304 insertions, 17 deletions
diff --git a/net-mgmt/monitoring-plugins/Makefile b/net-mgmt/monitoring-plugins/Makefile
index 801b113207ba..0cbec71f0457 100644
--- a/net-mgmt/monitoring-plugins/Makefile
+++ b/net-mgmt/monitoring-plugins/Makefile
@@ -3,7 +3,7 @@
PORTNAME= monitoring-plugins
PORTVERSION= 2.2
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= net-mgmt
MASTER_SITES= https://www.monitoring-plugins.org/download/ LOCAL/mat/${PORTNAME}
diff --git a/net-mgmt/monitoring-plugins/files/patch-configure b/net-mgmt/monitoring-plugins/files/patch-configure
index 306b52efc7b9..d9ef14e7f6d9 100644
--- a/net-mgmt/monitoring-plugins/files/patch-configure
+++ b/net-mgmt/monitoring-plugins/files/patch-configure
@@ -1,11 +1,19 @@
--- configure.orig 2016-11-29 08:48:11 UTC
+++ configure
-@@ -16748,7 +16748,7 @@ then
+@@ -16747,6 +16747,16 @@ then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_ps_command" >&5
$as_echo "$ac_cv_ps_command" >&6; }
++elif ps -axwo 'stat comm vsz rss user uid pid ppid args jid' 2>/dev/null | \
++ egrep -i "^ *STAT +COMMAND +VSZ +RSS +USER +UID +PID +PPID +COMMAND +JID" > /dev/null
++then
++ ac_cv_ps_varlist="procstat,&procuid,&procpid,&procppid,&procjid,&procvsz,&procrss,&procpcpu,procprog,&pos"
++ ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid jid vsz rss pcpu comm args'"
++ ac_cv_ps_format="%s %d %d %d %d %d %d %f %s %n"
++ ac_cv_ps_cols=10
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_ps_command" >&5
++$as_echo "$ac_cv_ps_command" >&6; }
++
elif ps -axwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
-- egrep -i "^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND" > /dev/null
-+ egrep -i "^ *STAT +COMMAND +VSZ +RSS +USER +UID +PID +PPID +COMMAND" > /dev/null
+ egrep -i "^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND" > /dev/null
then
- ac_cv_ps_varlist="procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos"
- ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid vsz rss pcpu comm args'"
diff --git a/net-mgmt/monitoring-plugins/files/patch-plugins_check__nagios.c b/net-mgmt/monitoring-plugins/files/patch-plugins_check__nagios.c
new file mode 100644
index 000000000000..376fe088e309
--- /dev/null
+++ b/net-mgmt/monitoring-plugins/files/patch-plugins_check__nagios.c
@@ -0,0 +1,10 @@
+--- plugins/check_nagios.c.orig 2016-11-29 08:45:08 UTC
++++ plugins/check_nagios.c
+@@ -64,6 +64,7 @@ main (int argc, char **argv)
+ int procuid = 0;
+ int procpid = 0;
+ int procppid = 0;
++ int procjid = 0;
+ int procvsz = 0;
+ int procrss = 0;
+ float procpcpu = 0;
diff --git a/net-mgmt/monitoring-plugins/files/patch-plugins_check__procs.c b/net-mgmt/monitoring-plugins/files/patch-plugins_check__procs.c
new file mode 100644
index 000000000000..5f71cf21e0cb
--- /dev/null
+++ b/net-mgmt/monitoring-plugins/files/patch-plugins_check__procs.c
@@ -0,0 +1,107 @@
+--- plugins/check_procs.c.orig 2016-11-29 08:45:08 UTC
++++ plugins/check_procs.c
+@@ -70,6 +70,7 @@ int options = 0; /* bitmask of filter cr
+ #define PCPU 256
+ #define ELAPSED 512
+ #define EREG_ARGS 1024
++#define JID 2048
+
+ #define KTHREAD_PARENT "kthreadd" /* the parent process of kernel threads:
+ ppid of procs are compared to pid of this proc*/
+@@ -101,6 +102,7 @@ char *fails;
+ char tmp[MAX_INPUT_BUFFER];
+ int kthread_filter = 0;
+ int usepid = 0; /* whether to test for pid or /proc/pid/exe */
++int jid;
+
+ FILE *ps_input = NULL;
+
+@@ -130,6 +132,7 @@ main (int argc, char **argv)
+ int procuid = 0;
+ pid_t procpid = 0;
+ pid_t procppid = 0;
++ int procjid = 0;
+ pid_t kthread_ppid = 0;
+ int procvsz = 0;
+ int procrss = 0;
+@@ -230,9 +233,9 @@ main (int argc, char **argv)
+ procseconds = convert_to_seconds(procetime);
+
+ if (verbose >= 3)
+- printf ("proc#=%d uid=%d vsz=%d rss=%d pid=%d ppid=%d pcpu=%.2f stat=%s etime=%s prog=%s args=%s\n",
++ printf ("proc#=%d uid=%d vsz=%d rss=%d pid=%d ppid=%d jid=%d pcpu=%.2f stat=%s etime=%s prog=%s args=%s\n",
+ procs, procuid, procvsz, procrss,
+- procpid, procppid, procpcpu, procstat,
++ procpid, procppid, procjid, procpcpu, procstat,
+ procetime, procprog, procargs);
+
+ /* Ignore self */
+@@ -275,6 +278,8 @@ main (int argc, char **argv)
+ resultsum |= PROG;
+ if ((options & PPID) && (procppid == ppid))
+ resultsum |= PPID;
++ if ((options & JID) && (procjid == jid))
++ resultsum |= JID;
+ if ((options & USER) && (procuid == uid))
+ resultsum |= USER;
+ if ((options & VSZ) && (procvsz >= vsz))
+@@ -292,9 +297,9 @@ main (int argc, char **argv)
+
+ procs++;
+ if (verbose >= 2) {
+- printf ("Matched: uid=%d vsz=%d rss=%d pid=%d ppid=%d pcpu=%.2f stat=%s etime=%s prog=%s args=%s\n",
++ printf ("Matched: uid=%d vsz=%d rss=%d pid=%d ppid=%d jid=%d pcpu=%.2f stat=%s etime=%s prog=%s args=%s\n",
+ procuid, procvsz, procrss,
+- procpid, procppid, procpcpu, procstat,
++ procpid, procppid, procjid, procpcpu, procstat,
+ procetime, procprog, procargs);
+ }
+
+@@ -409,6 +414,7 @@ process_arguments (int argc, char **argv
+ {"input-file", required_argument, 0, CHAR_MAX+2},
+ {"no-kthreads", required_argument, 0, 'k'},
+ {"traditional-filter", no_argument, 0, 'T'},
++ {"jid", required_argument, 0, 'j'},
+ {0, 0, 0, 0}
+ };
+
+@@ -417,7 +423,7 @@ process_arguments (int argc, char **argv
+ strcpy (argv[c], "-t");
+
+ while (1) {
+- c = getopt_long (argc, argv, "Vvhkt:c:w:p:s:u:C:a:z:r:m:P:T",
++ c = getopt_long (argc, argv, "Vvhkt:c:w:p:s:u:C:a:z:r:m:P:Tj:",
+ longopts, &option);
+
+ if (c == -1 || c == EOF)
+@@ -451,6 +457,12 @@ process_arguments (int argc, char **argv
+ break;
+ }
+ usage4 (_("Parent Process ID must be an integer!"));
++ case 'j': /* jail id */
++ if (sscanf (optarg, "%d%[^0-9]", &jid, tmp) == 1) {
++ asprintf (&fmt, "%s%sJID = %d", (fmt ? fmt : "") , (options ? ", " : ""), jid);
++ options |= JID;
++ break;
++ }
+ case 's': /* status */
+ if (statopts)
+ break;
+@@ -731,6 +743,8 @@ print_help (void)
+ printf (" %s\n", _("RSZDT, plus others based on the output of your 'ps' command)."));
+ printf (" %s\n", "-p, --ppid=PPID");
+ printf (" %s\n", _("Only scan for children of the parent process ID indicated."));
++ printf (" %s\n", "-j, --jid=JID");
++ printf (" %s\n", _("Only scan for process running in jail which ID is JID."));
+ printf (" %s\n", "-z, --vsz=VSZ");
+ printf (" %s\n", _("Only scan for processes with VSZ higher than indicated."));
+ printf (" %s\n", "-r, --rss=RSS");
+@@ -779,7 +793,7 @@ void
+ print_usage (void)
+ {
+ printf ("%s\n", _("Usage:"));
+- printf ("%s -w <range> -c <range> [-m metric] [-s state] [-p ppid]\n", progname);
++ printf ("%s -w <range> -c <range> [-m metric] [-s state] [-p ppid] [-j jid]\n", progname);
+ printf (" [-u user] [-r rss] [-z vsz] [-P %%cpu] [-a argument-array]\n");
+ printf (" [-C command] [-k] [-t timeout] [-v]\n");
+ }
diff --git a/net-mgmt/nagios-plugins/Makefile b/net-mgmt/nagios-plugins/Makefile
index 15305eff4b93..e415a99e76e6 100644
--- a/net-mgmt/nagios-plugins/Makefile
+++ b/net-mgmt/nagios-plugins/Makefile
@@ -3,7 +3,7 @@
PORTNAME= nagios-plugins
PORTVERSION= 2.2.1
-PORTREVISION= 1
+PORTREVISION= 4
PORTEPOCH= 1
CATEGORIES= net-mgmt
MASTER_SITES= https://www.nagios-plugins.org/download/ \
diff --git a/net-mgmt/nagios-plugins/files/patch-configure b/net-mgmt/nagios-plugins/files/patch-configure
index 683ce1be1e89..602247d66039 100644
--- a/net-mgmt/nagios-plugins/files/patch-configure
+++ b/net-mgmt/nagios-plugins/files/patch-configure
@@ -1,15 +1,22 @@
---- configure.orig 2017-04-19 18:03:27.000000000 +0200
-+++ configure
-@@ -22004,7 +22004,7 @@
- $as_echo "$ac_cv_ps_command" >&6; }
+--- configure.orig 2017-04-19 16:03:27 UTC
++++ configure
+@@ -21973,6 +21973,15 @@ $as_echo "$as_me: error: I don't know ho
+ fi
- elif ps -axwwo 'stat comm vsz rss user uid pid ppid args' 2>/dev/null | \
-- egrep -i "^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND" > /dev/null
-+ egrep -i "^ *STAT +COMMAND +VSZ +RSS +USER +UID +PID +PPID +COMMAND" > /dev/null
+
++elif ps -axwo 'stat comm vsz rss user uid pid ppid jid args' 2>/dev/null | \
++ egrep -i "^ *STAT +COMMAND +VSZ +RSS +USER +UID +PID +PPID +JID +COMMAND" > /dev/null
++then
++ ac_cv_ps_varlist="procstat,&procuid,&procpid,&procppid,&procjid,&procvsz,&procrss,&procpcpu,procprog,&pos"
++ ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid jid vsz rss pcpu comm args'"
++ ac_cv_ps_format="%s %d %d %d %d %d %d %f %s %n"
++ ac_cv_ps_cols=10
++ { $as_echo "$as_me:$LINENO: result: $ac_cv_ps_command" >&5
++ $as_echo "$ac_cv_ps_command" >&6; }
+ elif ps axwwo 'stat comm vsz rss user uid pid ppid args cgroup:256' 2>/dev/null | \
+ egrep -i "^ *STAT +[UCOMAND]+ +VSZ +RSS +USER +UID +PID +PPID +COMMAND +CGROUP" > /dev/null
then
- ac_cv_ps_varlist="procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos"
- ac_cv_ps_command="$PATH_TO_PS -axwwo 'stat uid pid ppid vsz rss pcpu comm args'"
-@@ -23798,7 +23798,7 @@
+@@ -23798,7 +23807,7 @@ then
if $PATH_TO_SWAPINFO -k 2>/dev/null | egrep -i "^Device +1K-blocks +Used +Avail" >/dev/null
then
diff --git a/net-mgmt/nagios-plugins/files/patch-plugins_check__http.c b/net-mgmt/nagios-plugins/files/patch-plugins_check__http.c
new file mode 100644
index 000000000000..cff5d3ee45ee
--- /dev/null
+++ b/net-mgmt/nagios-plugins/files/patch-plugins_check__http.c
@@ -0,0 +1,17 @@
+--- plugins/check_http.c.orig 2017-04-19 16:03:12 UTC
++++ plugins/check_http.c
+@@ -1026,11 +1026,9 @@ check_http (void)
+ elapsed_time_ssl = (double)microsec_ssl / 1.0e6;
+ if (check_cert == TRUE) {
+ result = np_net_ssl_check_cert(days_till_exp_warn, days_till_exp_crit);
+- if (result != STATE_OK) {
+- np_net_ssl_cleanup();
+- if (sd) close(sd);
+- return result;
+- }
++ np_net_ssl_cleanup();
++ if (sd) close(sd);
++ return result;
+ }
+ }
+ #endif /* HAVE_SSL */
diff --git a/net-mgmt/nagios-plugins/files/patch-plugins_check__nagios.c b/net-mgmt/nagios-plugins/files/patch-plugins_check__nagios.c
new file mode 100644
index 000000000000..d96c844083be
--- /dev/null
+++ b/net-mgmt/nagios-plugins/files/patch-plugins_check__nagios.c
@@ -0,0 +1,10 @@
+--- plugins/check_nagios.c.orig 2017-01-19 16:01:31 UTC
++++ plugins/check_nagios.c
+@@ -64,6 +64,7 @@ main (int argc, char **argv)
+ int procuid = 0;
+ int procpid = 0;
+ int procppid = 0;
++ int procjid = 0;
+ int procvsz = 0;
+ int procrss = 0;
+ char proc_cgroup_hierarchy[MAX_INPUT_BUFFER];
diff --git a/net-mgmt/nagios-plugins/files/patch-plugins_check__procs.c b/net-mgmt/nagios-plugins/files/patch-plugins_check__procs.c
new file mode 100644
index 000000000000..11ea7d2df207
--- /dev/null
+++ b/net-mgmt/nagios-plugins/files/patch-plugins_check__procs.c
@@ -0,0 +1,107 @@
+--- plugins/check_procs.c.orig 2017-01-16 17:24:03 UTC
++++ plugins/check_procs.c
+@@ -71,6 +71,7 @@ int options = 0; /* bitmask of filter cr
+ #define ELAPSED 512
+ #define EREG_ARGS 1024
+ #define CGROUP_HIERARCHY 2048
++#define JID 4096
+
+ #define KTHREAD_PARENT "kthreadd" /* the parent process of kernel threads:
+ ppid of procs are compared to pid of this proc*/
+@@ -103,6 +104,7 @@ char *fails;
+ char tmp[MAX_INPUT_BUFFER];
+ int kthread_filter = 0;
+ int usepid = 0; /* whether to test for pid or /proc/pid/exe */
++int jid;
+
+ FILE *ps_input = NULL;
+
+@@ -133,6 +135,7 @@ main (int argc, char **argv)
+ int procuid = 0;
+ pid_t procpid = 0;
+ pid_t procppid = 0;
++ int procjid = 0;
+ pid_t kthread_ppid = 0;
+ int procvsz = 0;
+ int procrss = 0;
+@@ -236,9 +239,9 @@ main (int argc, char **argv)
+ procseconds = convert_to_seconds(procetime);
+
+ if (verbose >= 3) {
+- printf ("proc#=%d uid=%d vsz=%d rss=%d pid=%d ppid=%d pcpu=%.2f stat=%s etime=%s prog=%s args=%s",
+++ printf ("proc#=%d uid=%d vsz=%d rss=%d pid=%d ppid=%d jid=%d pcpu=%.2f stat=%s etime=%s prog=%s args=%s\n",
+ procs, procuid, procvsz, procrss,
+- procpid, procppid, procpcpu, procstat,
++ procpid, procppid, procjid, procpcpu, procstat,
+ procetime, procprog, procargs);
+ if (strstr(PS_COMMAND, "cgroup") != NULL) {
+ printf(" proc_cgroup_hierarchy=%s\n", proc_cgroup_hierarchy);
+@@ -287,6 +290,8 @@ main (int argc, char **argv)
+ resultsum |= PROG;
+ if ((options & PPID) && (procppid == ppid))
+ resultsum |= PPID;
++ if ((options & JID) && (procjid == jid))
++ resultsum |= JID;
+ if ((options & USER) && (procuid == uid))
+ resultsum |= USER;
+ if ((options & VSZ) && (procvsz >= vsz))
+@@ -315,9 +320,9 @@ main (int argc, char **argv)
+
+ procs++;
+ if (verbose >= 2) {
+- printf ("Matched: uid=%d vsz=%d rss=%d pid=%d ppid=%d pcpu=%.2f stat=%s etime=%s prog=%s args=%s",
+++ printf ("Matched: uid=%d vsz=%d rss=%d pid=%d ppid=%d jid=%d pcpu=%.2f stat=%s etime=%s prog=%s args=%s\n",
+ procuid, procvsz, procrss,
+- procpid, procppid, procpcpu, procstat,
++ procpid, procppid, procjid, procpcpu, procstat,
+ procetime, procprog, procargs);
+ if (strstr(PS_COMMAND, "cgroup") != NULL) {
+ printf(" cgroup_hierarchy=%s\n", cgroup_hierarchy);
+@@ -438,6 +443,7 @@ process_arguments (int argc, char **argv
+ {"no-kthreads", required_argument, 0, 'k'},
+ {"traditional-filter", no_argument, 0, 'T'},
+ {"cgroup-hierarchy", required_argument, 0, 'g'},
++ {"jid", required_argument, 0, 'j'},
+ {0, 0, 0, 0}
+ };
+
+@@ -446,7 +452,7 @@ process_arguments (int argc, char **argv
+ strcpy (argv[c], "-t");
+
+ while (1) {
+- c = getopt_long (argc, argv, "Vvhkt:c:w:p:s:u:C:a:z:r:m:P:Tg:",
++ c = getopt_long (argc, argv, "Vvhkt:c:w:p:s:u:C:a:z:r:m:P:Tg:j:",
+ longopts, &option);
+
+ if (c == -1 || c == EOF)
+@@ -477,6 +483,12 @@ process_arguments (int argc, char **argv
+ break;
+ }
+ usage4 (_("Parent Process ID must be an integer!"));
++ case 'j': /* jail id */
++ if (sscanf (optarg, "%d%[^0-9]", &jid, tmp) == 1) {
++ asprintf (&fmt, "%s%sJID = %d", (fmt ? fmt : "") , (options ? ", " : ""), jid);
++ options |= JID;
++ break;
++ }
+ case 's': /* status */
+ if (statopts)
+ break;
+@@ -766,6 +778,8 @@ print_help (void)
+ printf (" %s\n", _("RSZDT, plus others based on the output of your 'ps' command)."));
+ printf (" %s\n", "-p, --ppid=PPID");
+ printf (" %s\n", _("Only scan for children of the parent process ID indicated."));
++ printf (" %s\n", "-j, --jid=JID");
++ printf (" %s\n", _("Only scan for process running in jail which ID is JID."));
+ printf (" %s\n", "-z, --vsz=VSZ");
+ printf (" %s\n", _("Only scan for processes with VSZ higher than indicated."));
+ printf (" %s\n", "-r, --rss=RSS");
+@@ -818,7 +832,7 @@ void
+ print_usage (void)
+ {
+ printf ("%s\n", _("Usage:"));
+- printf ("%s -w <range> -c <range> [-m metric] [-s state] [-p ppid]\n", progname);
++ printf ("%s -w <range> -c <range> [-m metric] [-s state] [-p ppid] [-j jid]\n", progname);
+ printf (" [-u user] [-r rss] [-z vsz] [-P %%cpu] [-a argument-array]\n");
+ printf (" [-C command] [-k] [-t timeout] [-v]\n");
+ }
diff --git a/net-mgmt/nagios-plugins/files/patch-plugins_sslutils.c b/net-mgmt/nagios-plugins/files/patch-plugins_sslutils.c
new file mode 100644
index 000000000000..57cbd74156e3
--- /dev/null
+++ b/net-mgmt/nagios-plugins/files/patch-plugins_sslutils.c
@@ -0,0 +1,21 @@
+--- plugins/sslutils.c.orig 2017-04-19 16:03:12 UTC
++++ plugins/sslutils.c
+@@ -211,9 +211,6 @@ int np_net_ssl_check_cert(int days_till_
+ int time_remaining;
+ time_t tm_t;
+
+- // Prefix whatever we're about to print with SSL
+- printf("SSL ");
+-
+ certificate=SSL_get_peer_certificate(s);
+ if (!certificate) {
+ printf("%s\n",_("CRITICAL - Cannot retrieve server certificate."));
+@@ -304,7 +301,7 @@ int np_net_ssl_check_cert(int days_till_
+ else
+ status = STATE_CRITICAL;
+ } else {
+- printf(_("OK - Certificate '%s' will expire on %s. "), cn, timestamp);
++ printf(_("OK - Certificate '%s' will expire on %s.\n"), cn, timestamp);
+ status = STATE_OK;
+ }
+ X509_free(certificate);