summaryrefslogtreecommitdiff
path: root/net-mgmt/nagios-pf-plugin
diff options
context:
space:
mode:
authorMartin Wilke <miwi@FreeBSD.org>2010-02-13 11:28:36 +0000
committerMartin Wilke <miwi@FreeBSD.org>2010-02-13 11:28:36 +0000
commita341e3503d1af3d4ae312816dedcfd9040522e68 (patch)
treecec9431a862937e71f4c2d5ffb22b6bf4eda9158 /net-mgmt/nagios-pf-plugin
parentxml-commons is focussed on common code and guidelines for xml projects. The (diff)
- Add an additional parameter '-p' display nagios
performance data in the output. This output can the easily graphed with pnp. PR: 142266 Submitted by: olli hauer <ohauer@gmx.de> Approved by: maintainer
Notes
Notes: svn path=/head/; revision=249770
Diffstat (limited to 'net-mgmt/nagios-pf-plugin')
-rw-r--r--net-mgmt/nagios-pf-plugin/Makefile1
-rw-r--r--net-mgmt/nagios-pf-plugin/files/patch-check_pf.c74
2 files changed, 75 insertions, 0 deletions
diff --git a/net-mgmt/nagios-pf-plugin/Makefile b/net-mgmt/nagios-pf-plugin/Makefile
index f1bc44cae6ca..55d4b234014c 100644
--- a/net-mgmt/nagios-pf-plugin/Makefile
+++ b/net-mgmt/nagios-pf-plugin/Makefile
@@ -7,6 +7,7 @@
PORTNAME= nagios-pf-plugin
PORTVERSION= 0.1
+PORTREVISION= 1
CATEGORIES= net-mgmt
MASTER_SITES= http://www.zampanosbits.com/check_pf/ \
http://restek.wwu.edu/~kian/
diff --git a/net-mgmt/nagios-pf-plugin/files/patch-check_pf.c b/net-mgmt/nagios-pf-plugin/files/patch-check_pf.c
new file mode 100644
index 000000000000..a12e15e37f39
--- /dev/null
+++ b/net-mgmt/nagios-pf-plugin/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, " ");