Date: Sun, 3 Jan 2010 17:32:08 +0100 (CET) From: olli hauer <ohauer@gmx.de> To: FreeBSD-gnats-submit@FreeBSD.org Cc: ohauer@gmx.de Subject: ports/142266: [patch] port net-mgmt/nagios-pf-plugin add nagios performance data Message-ID: <20100103163208.5513E2614E@u18-124.dsl.vianetworks.de> Resent-Message-ID: <201001031640.o03Ge1O1040270@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 142266 >Category: ports >Synopsis: [patch] port net-mgmt/nagios-pf-plugin add nagios performance data >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Sun Jan 03 16:40:01 UTC 2010 >Closed-Date: >Last-Modified: >Originator: olli hauer <ohauer@gmx.de> >Release: >Organization: >Environment: >Description: The following patch adds an additional parameter '-p' display nagios performance data in the output. This output can the easily graphed with pnp. I send the patch additional to the author of check_pf (maintainer of the port) but I don't know if he is reachable (website in port is not updated and now parked by a domain-grabber) >How-To-Repeat: >Fix: --- patch_nagios-pf-plugin.txt begins here --- --- files/patch-check_pf.c +++ files/patch-check_pf.c @@ -0,0 +1,74 @@ +--- ./check_pf.c.orig 2007-03-08 07:19:40.000000000 +0100 ++++ ./check_pf.c 2010-01-03 00:24:23.000000000 +0100 +@@ -70,12 +70,13 @@ + int ch, wflag, cflag, dev; + int states_warning; + int states_critical; ++ int show_perf=0; + + pf_device = "/dev/pf"; + + wflag = cflag = 0; + +- while ((ch = getopt(argc, argv, "Vhw:c:")) != -1) { ++ while ((ch = getopt(argc, argv, "Vhpw:c:")) != -1) { + switch (ch) { + case 'V': + version(); +@@ -84,6 +85,9 @@ + case 'h': + help(); + break; ++ case 'p': ++ show_perf = 1; ++ break; + case 'w': + wflag = 1; + states_warning = strtonum(optarg, 0, ULONG_MAX, +@@ -151,19 +155,34 @@ + } + + if (ps.states >= states_critical) { +- (void)printf("PF CRITICAL - states: %u (%.1f%% - limit: %u)\n", ++ (void)printf("PF CRITICAL - states: %u (%.1f%% - limit: %u)", + ps.states, percent, pl.limit); ++ if(!show_perf) ++ (void)printf("\n"); ++ else ++ (void)printf("|current=%u;%u;%u; percent=%.1f%%; limit=%u;\n", ++ ps.states, states_warning, states_critical, percent, pl.limit); + return (STATE_CRITICAL); + } + + if (ps.states >= states_warning) { +- (void)printf("PF WARNING - states: %u (%.1f%% - limit: %u)\n", ++ (void)printf("PF WARNING - states: %u (%.1f%% - limit: %u)", + ps.states, percent, pl.limit); ++ if(!show_perf) ++ (void)printf("\n"); ++ else ++ (void)printf("|current=%u;%u;%u; percent=%.1f%%; limit=%u;\n", ++ ps.states, states_warning, states_critical, percent, pl.limit); + return (STATE_WARNING); + } + +- (void)printf("PF OK - states: %u (%.1f%% - limit: %u)\n", ++ (void)printf("PF OK - states: %u (%.1f%% - limit: %u)", + ps.states, percent, pl.limit); ++ if(!show_perf) ++ (void)printf("\n"); ++ else ++ (void)printf("|current=%u;%u;%u; percent=%.1f%%; limit=%u;\n", ++ ps.states, states_warning, states_critical, percent, pl.limit); + return (STATE_OK); + } + +@@ -183,6 +202,8 @@ + (void)fprintf(stderr, " "); + (void)fprintf(stderr, "-h - Print the plugin help\n"); + (void)fprintf(stderr, " "); ++ (void)fprintf(stderr, "-p - Display additional nagios performance data\n"); ++ (void)fprintf(stderr, " "); + (void)fprintf(stderr, "-w number - Warning when <number> states" + " (default: %u%% of state limit)\n", DEFAULT_WARN_PERCENT); + (void)fprintf(stderr, " "); --- patch_nagios-pf-plugin.txt ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100103163208.5513E2614E>