summaryrefslogtreecommitdiff
path: root/net-mgmt
diff options
context:
space:
mode:
authorPav Lucistnik <pav@FreeBSD.org>2004-04-01 13:45:58 +0000
committerPav Lucistnik <pav@FreeBSD.org>2004-04-01 13:45:58 +0000
commit1b5c8d5e9dce1135c4383b1e7bb0edb76fa69f70 (patch)
treeab5d45f3030bf2982dae51ff60837f863ebd16d6 /net-mgmt
parentQuick fix to avoid DoS attack due to malloc(3) bug. (diff)
Add apan, an addon to Nagios that is used to collect results from Nagios
plugins and store it in RRD-files. You can the use Apan to view graphs of the data in Nagios web-interface. WWW: http://apan.sourceforge.net PR: ports/64941 Submitted by: Janos Mohacsi <janos.mohacsi@bsd.hu>
Notes
Notes: svn path=/head/; revision=105876
Diffstat (limited to 'net-mgmt')
-rw-r--r--net-mgmt/Makefile1
-rw-r--r--net-mgmt/apan/Makefile84
-rw-r--r--net-mgmt/apan/distinfo2
-rw-r--r--net-mgmt/apan/files/patch-README156
-rw-r--r--net-mgmt/apan/files/patch-apan.cgi76
-rw-r--r--net-mgmt/apan/files/patch-apan.defs36
-rw-r--r--net-mgmt/apan/files/patch-apan.sh24
-rw-r--r--net-mgmt/apan/files/patch-generate.cgi20
-rw-r--r--net-mgmt/apan/files/patch-libexec_check__megaide20
-rw-r--r--net-mgmt/apan/files/patch-libexec_check__nt__load14
-rw-r--r--net-mgmt/apan/files/patch-libexec_check__unix__load14
-rw-r--r--net-mgmt/apan/files/patch-libexec_disk__by__snmp14
-rw-r--r--net-mgmt/apan/files/patch-libexec_uptime__by__snmp14
-rw-r--r--net-mgmt/apan/files/patch-plugs_utils.sh46
-rw-r--r--net-mgmt/apan/pkg-descr5
-rw-r--r--net-mgmt/apan/pkg-plist27
16 files changed, 553 insertions, 0 deletions
diff --git a/net-mgmt/Makefile b/net-mgmt/Makefile
index 64c585af2106..7d0efb3f811c 100644
--- a/net-mgmt/Makefile
+++ b/net-mgmt/Makefile
@@ -8,6 +8,7 @@
SUBDIR += angst
SUBDIR += annextools
SUBDIR += ap-utils
+ SUBDIR += apan
SUBDIR += argus
SUBDIR += arpscan
SUBDIR += arpwatch
diff --git a/net-mgmt/apan/Makefile b/net-mgmt/apan/Makefile
new file mode 100644
index 000000000000..8fad5477d77a
--- /dev/null
+++ b/net-mgmt/apan/Makefile
@@ -0,0 +1,84 @@
+# New ports collection makefile for: apan
+# Date created: 26 March 2004
+# Whom: Janos.Mohacsi@bsd.hu
+#
+# $FreeBSD$
+#
+
+PORTNAME= apan
+PORTVERSION= 0.2.1
+CATEGORIES= net-mgmt
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
+MASTER_SITE_SUBDIR= ${PORTNAME}
+
+MAINTAINER= janos.mohacsi@bsd.hu
+COMMENT= Tool for integrating Nagios with RRDTOOL
+
+RUN_DEPENDS= rrdtool:${PORTSDIR}/net/rrdtool \
+ nagios:${PORTSDIR}/net-mgmt/nagios \
+ bash:${PORTSDIR}/shells/bash2
+
+NO_BUILD= yes
+USE_REINPLACE= yes
+NAGIOSDIR?= /var/spool/nagios
+DOC_FILES= README CHANGELOG
+
+WRKSRC= ${WRKDIR}/${PORTNAME}
+
+do-configure:
+ @${REINPLACE_CMD} \
+ -e 's|%%APANCONFDIR%%|${PREFIX}/etc/apan/|' \
+ -e 's|%%NAGIOSPLUGINSDIR%%|${PREFIX}/libexec/nagios/|' \
+ -e 's|%%APANPLUGSDIR%%|${PREFIX}/libexec/${PORTNAME}/|' \
+ -e 's|%%PREFIX%%|${PREFIX}|' \
+ -e 's|/bin/sh|${PREFIX}/bin/bash|' \
+ ${WRKSRC}/*.* ${WRKSRC}/README
+ @${REINPLACE_CMD} \
+ -e 's|%%APANCONFDIR%%|${PREFIX}/etc/apan/|' \
+ -e 's|%%NAGIOSPLUGINSDIR%%|${PREFIX}/libexec/nagios/|' \
+ -e 's|%%APANPLUGSDIR%%|${PREFIX}/libexec/${PORTNAME}/|' \
+ -e 's|%%PREFIX%%|${PREFIX}|' \
+ -e 's|/bin/bash|${PREFIX}/bin/bash|' \
+ -e 's|/bin/sh|${PREFIX}/bin/bash|' \
+ ${WRKSRC}/plugs/*
+ @${REINPLACE_CMD} \
+ -e 's|%%APANCONFDIR%%|${PREFIX}/etc/apan/|' \
+ -e 's|%%NAGIOSPLUGINSDIR%%|${PREFIX}/libexec/nagios/|' \
+ -e 's|%%APANPLUGSDIR%%|${PREFIX}/libexec/${PORTNAME}/|' \
+ -e 's|%%PREFIX%%|${PREFIX}|' \
+ -e 's|/bin/bash|${PREFIX}/bin/bash|' \
+ -e 's|/bin/sh|${PREFIX}/bin/bash|' \
+ ${WRKSRC}/libexec/*
+
+do-install:
+ @${MKDIR} ${PREFIX}/libexec/${PORTNAME}
+ @${MKDIR} ${PREFIX}/etc/${PORTNAME}
+ @${MKDIR} ${NAGIOSDIR}/rrd
+ @${INSTALL_SCRIPT} ${WRKSRC}/apan.sh ${PREFIX}/libexec/nagios/
+ @${INSTALL_SCRIPT} ${WRKSRC}/apan.cgi ${PREFIX}/share/nagios/cgi-bin
+ @${INSTALL_SCRIPT} ${WRKSRC}/generate.cgi ${PREFIX}/share/nagios/cgi-bin
+ @${INSTALL_SCRIPT} ${WRKSRC}/libexec/check_megaide ${PREFIX}/libexec/nagios
+ @${INSTALL_SCRIPT} ${WRKSRC}/libexec/check_nt_load ${PREFIX}/libexec/nagios
+ @${INSTALL_SCRIPT} ${WRKSRC}/libexec/check_unix_load ${PREFIX}/libexec/nagios
+ @${INSTALL_SCRIPT} ${WRKSRC}/libexec/disk_by_snmp ${PREFIX}/libexec/nagios
+ @${INSTALL_SCRIPT} ${WRKSRC}/libexec/uptime_by_snmp ${PREFIX}/libexec/nagios
+ @${INSTALL_SCRIPT} ${WRKSRC}/plugs/debug.sh ${PREFIX}/libexec/${PORTNAME}
+ @${INSTALL_SCRIPT} ${WRKSRC}/plugs/disk.sh ${PREFIX}/libexec/${PORTNAME}
+ @${INSTALL_SCRIPT} ${WRKSRC}/plugs/load.sh ${PREFIX}/libexec/${PORTNAME}
+ @${INSTALL_SCRIPT} ${WRKSRC}/plugs/nt_utils.sh ${PREFIX}/libexec/${PORTNAME}
+ @${INSTALL_SCRIPT} ${WRKSRC}/plugs/printer.sh ${PREFIX}/libexec/${PORTNAME}
+ @${INSTALL_SCRIPT} ${WRKSRC}/plugs/snmp.sh ${PREFIX}/libexec/${PORTNAME}
+ @${INSTALL_SCRIPT} ${WRKSRC}/plugs/utils.sh ${PREFIX}/libexec/${PORTNAME}
+ @${INSTALL_DATA} ${WRKSRC}/apan.cfg ${PREFIX}/etc/${PORTNAME}/apan.cfg-sample
+ @${INSTALL_DATA} ${WRKSRC}/apan.defs ${PREFIX}/etc/${PORTNAME}/apan.defs-sample
+ @${INSTALL_DATA} ${WRKSRC}/graph.png ${PREFIX}/share/nagios/images/logos
+
+post-install:
+.if !defined(NOPORTDOCS)
+ @${MKDIR} ${DOCSDIR}
+.for file in ${DOC_FILES}
+ @${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR}
+.endfor
+.endif
+
+.include <bsd.port.mk>
diff --git a/net-mgmt/apan/distinfo b/net-mgmt/apan/distinfo
new file mode 100644
index 000000000000..d3f4b28e8e4e
--- /dev/null
+++ b/net-mgmt/apan/distinfo
@@ -0,0 +1,2 @@
+MD5 (apan-0.2.1.tar.gz) = 2e0ffbddf6073cf5cc38efa501200dfa
+SIZE (apan-0.2.1.tar.gz) = 19083
diff --git a/net-mgmt/apan/files/patch-README b/net-mgmt/apan/files/patch-README
new file mode 100644
index 000000000000..2598918ca105
--- /dev/null
+++ b/net-mgmt/apan/files/patch-README
@@ -0,0 +1,156 @@
+
+$FreeBSD$
+
+--- README.orig Fri Mar 26 12:44:00 2004
++++ README Fri Mar 26 13:01:48 2004
+@@ -61,7 +61,7 @@
+ 7) Add apan.sh to checkcommands.cfg;
+ define command {
+ command_name apan
+- command_line /usr/local/nagios/apan/apan.sh $ARG1$ $HOSTNAME$ "$SERVICEDESC$" $TIMET$ $ARG2$ $ARG3$
++ command_line /%%NAGIOSPLUGINSDIR%%/apan.sh $ARG1$ $HOSTNAME$ "$SERVICEDESC$" $TIMET$ $ARG2$ $ARG3$
+ }
+
+ 8) Add sevices to nagios;
+@@ -73,12 +73,118 @@
+ normal_check_interval 5
+ }
+
+-9) Add the host/service to apan.cfg
+- host1;Disk-usage;/usr/local/nagios/rrd/host1_Disk-usage.rrd;c|d;c-used:AREA c-free:STACK d-used:AREA d-free:STACK;Disk usage;Bytes;-l 1 -b 1024
++or ping service
++
++ define service {
++ host_name sheriff,bandit,WC-router-holland
++ service_description Ping
++ check_command apan!ping!100.0,20%!500.0,60%
++ name Ping
++ use generic-service
++ normal_check_interval 1
++}
++
++Note:
++- The second argument in the check_command is the name of the plugin that
++apan will use. Read more about each plugin in next section of the docs.
++- The third and fourth argument is used by the plugins, mainly to specify
++warning and critical levels.
++
++9) Creating RRD's
++I am no expert on RRD-tool, so maybe these examples are not so optimized..
++For example:
++ rrdtool create /usr/local/nagios/rrd/raket_Net-use.rrd -s 60 \
++ DS:IN:COUNTER:300:0:U DS:OUT:COUNTER:300:U:U RRA:AVERAGE:0.5:1:50400 \
++ RRA:AVERAGE:0.5:60:43800
++
++Creates an RRD with two datasets named IN and OUT. The datasets are counters
++supposed to store the number of network packages sent and received on a
++network-interface. Samplerate is one minute and RRA's are set up to store
++minut-average for 35 days and hour-average for 5 years.
++
++To store Pig round-trip times you can use the same syntax, but change the
++DS-type to 'GAUGE';
++rrdtool create /usr/local/nagios/rrd/bandit-ping.rrd -s 60 \
++DS:ping:GAUGE:300:0:U RRA:AVERAGE:0.5:1:50400 RRA:AVERAGE:0.5:60:43800
++
++The thing you probably want to look more at is the samplerate and heartbeat
++values. Read more about RRD-tool at
++
++http://people.ee.ethz.ch/~oetiker/webtools/rrdtool
++
++10) Configuring Apan
++
++Now its time for the hard step, the config-file apan.cfg. For each service
++you want apan to handle you must add a line in apan.cfg. The line is made
++up of 8 fields separated by ';'.
++
++The fields are:
++
++Host name ; Service name ; RRD-file ; argument-1|argument-2|..argument-n ;
++DS-name-1:plot-function-1 DS-name-2:plot-function-2
++DS-name-n:plot-function-n ; Comment ; Y-unit ; Extra command
++
++In more detail:
++
++Host name
++The name of the host, should be exactly the same name as in Nagios.
++
++Service name
++The name of the service, should be exactly the same name as in Nagios.
++
++RRD-file
++Full name of the RRD-file including the full path.
++
++argument-1|argument-2|..argument-n
++Arguments to be used by the plugin. The plugin will be called one time for
++each argument. Arguments can contain any character exept '|'.
++
++DS-name-1:plot-function-1 DS-name-2:plot-function-2 DS-name-n:plot-function-n
++DS-name is the name of the dataset that corresponds to the argument in the
++previous field. Plot-function is the format that rrdtool will use to plot
++the corresponding dataset when the graphs are constructed.
++
++Comment
++An additional informativ string that is displayed on the we-page with the
++graphs.
++
++Y-unit
++The unit displayed on the Y-axis in the graphs.
++
++Extra command
++Here you can define extra command-line arguments that will be used by
++rrdtool when the graps are created.
++
++OK, that's the theoretical part, maybe some examples could help?
++
++barbar;apan-disk;/usr/local/nagios/rrd/barbar_disk.rrd;/;-:LINE2;Disk-usage;%
++
++This line defines the service 'apan-disk' for host 'barbar'. The RRD,
++/usr/local/nagios/rrd/barbar_disk.rrd, have one DS named '-'. The plugin
++is called once with the argument '/'. When a graph is plotted, LINE2 (a
++medium-thick line) is used for drawing and the Y-axis is labeled '%'.
++
++sdl-www-01;Network-10;/usr/local/nagios/rrd/sdl-www-01_Network-10.rrd;public:.1.3.6.1.2.1.2.2.1.10.16777220|public:.1.3.6.1.2.1.2.2.1.16.16777220;10_IN:LINE2
++10_OUT:LINE2;Network throughput;Bytes/sek;
++
++In this definition, the RRD have two datasets named '10_IN' and '10_OUT'.
++The plugin is called twice with the arguments
++'public:.1.3.6.1.2.1.2.2.1.10.16777220' and
++'public:.1.3.6.1.2.1.2.2.1.16.16777220' (The SNMP oid's for sent and
++received network packages).
++
++adsrv;Disk-usage;/usr/local/nagios/rrd/adsrv_disk.rrd;c;c-used:AREA c-free:STACK;Disk usage;Bytes;-l 1 -b 1024
++
++Here, the RRD have the datasets 'c-used' and 'c-free'. The plugin is
++called once wit the argument 'c'. When we generate a graph for this data,
++'c-used' will become a filled area with 'c-free' stacked upon it. When the
++y-axis is scaled, 1024 will be used as base-value and it will always start
++from 0 (-l 1 -b 1024 in the 'Extra command'-field).
++
++Simple?? For more information on the arguments, DS-values, etc - look at
++the plugin-documentation for the specific plugin used.
++
+
+-10) Create a RRD-file;
+-rrdtool create /usr/local/nagios/rrd/host1_Disk-usage.rrd -s 60 DS:c-used:GAUGE:900:0:U DS:c-free:GAUGE:900:0:U DS:d-used:GAUGE:900:0:U DS:d-free:GAUGE:900:0:U RRA:AVERAGE:0.5:1:50400 RRA:AVERAGE:0.5:60:43800
+- Make sure that the Nagios-user have write-permissions on the file.
+
+ 11) Add a link to the graphs as an extended service info;
+ define serviceextinfo{
+@@ -90,6 +196,17 @@
+ }
+
+ 12) Start Nagios!
++
++13) Debugging
++
++To enable debugging output from Apan, set the variables DEBUG to 1 and the
++variable DEBUGFILE to point to a file in apan.defs; Debugging output from
++the cgi's ic controlled by CGIDEBUG and CGIDEBUGFILE
++
++DEBUG=1
++DEBUGFILE=/tmp/apan.debug
++CGIDEBUG=1
++CGIDEBUGFILE=/tmp/apancgi.debug
+
+
+
diff --git a/net-mgmt/apan/files/patch-apan.cgi b/net-mgmt/apan/files/patch-apan.cgi
new file mode 100644
index 000000000000..4d7fb7e0fba0
--- /dev/null
+++ b/net-mgmt/apan/files/patch-apan.cgi
@@ -0,0 +1,76 @@
+
+$FreeBSD$
+
+--- apan.cgi.orig Fri Jan 17 12:18:11 2003
++++ apan.cgi Mon Mar 29 17:08:42 2004
+@@ -1,11 +1,11 @@
+-#!/bin/bash
++#!%%PREFIX%%/bin/bash
+ # This file is used to generate the graphs. It should reside in
+ # Nagios cgi-bin directory (Noramally the sbin-dir in your Nagios
+ # installation).
+ #
+ #
+ # Change this if you are not installing apan in /usr/local/nagios/apan
+-DEFSFILE=/usr/local/nagios/apan/apan.defs
++DEFSFILE=%%APANCONFDIR%%/apan.defs
+ #
+ # Don't change anything below...
+ #
+@@ -63,38 +63,38 @@
+
+ if [ $N -ne 2 ]; then
+ echo "Statistics for the last 10 minutes:<BR>"
+- echo "<IMG SRC=generate.cgi?$HOST&$CHECK&600><BR>"
++ echo "<IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&600><BR>"
+ echo "Statistics for the last hour:<BR>"
+- echo "<IMG SRC=generate.cgi?$HOST&$CHECK&3600><BR>"
++ echo "<IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&3600><BR>"
+ echo "Statistics for the last 24 hours:<BR>"
+- echo "<IMG SRC=generate.cgi?$HOST&$CHECK&86400><BR>"
++ echo "<IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&86400><BR>"
+ echo "Statistics for the last week:<BR>"
+- echo "<IMG SRC=generate.cgi?$HOST&$CHECK&604800><BR>"
++ echo "<IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&604800><BR>"
+ echo "Statistics for the last Month:<BR>"
+- echo "<IMG SRC=generate.cgi?$HOST&$CHECK&2851200><BR>"
++ echo "<IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&2851200><BR>"
+ echo "Statistics for the last Year:<BR>"
+- echo "<IMG SRC=generate.cgi?$HOST&$CHECK&31557600><BR>"
++ echo "<IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&31557600><BR>"
+ else
+ echo "<TABLE COLS=2 BORDER=1>"
+ echo "<TR><TD COLSPAN=2>Statistics for the last 10 minutes:</TD></TR>"
+- echo "<TR><TD><IMG SRC=generate.cgi?$HOST&$CHECK&600&0></TD>"
+- echo "<TD><IMG SRC=generate.cgi?$HOST&$CHECK&300&1></TD></TR>"
++ echo "<TR><TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&600&0></TD>"
++ echo "<TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&300&1></TD></TR>"
+ echo "<TR><TD COLSPAN=2>Statistics for the last hour:</TD></TR>"
+- echo "<TR><TD><IMG SRC=generate.cgi?$HOST&$CHECK&3600&0></TD>"
+- echo "<TD><IMG SRC=generate.cgi?$HOST&$CHECK&3600&1></TD></TR>"
++ echo "<TR><TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&3600&0></TD>"
++ echo "<TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&3600&1></TD></TR>"
+ echo "<TR><TD COLSPAN=2>Statistics for the last 24 hours:</TD></TR>"
+- echo "<TR><TD><IMG SRC=generate.cgi?$HOST&$CHECK&86400&0><BR></TD>"
+- echo "<TD><IMG SRC=generate.cgi?$HOST&$CHECK&86400&1></TD></TR>"
++ echo "<TR><TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&86400&0><BR></TD>"
++ echo "<TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&86400&1></TD></TR>"
+ echo "<TR><TD COLSPAN=2>Statistics for the last week:</TD></TR>"
+- echo "<TR><TD><IMG SRC=generate.cgi?$HOST&$CHECK&604800&0></TD>"
+- echo "<TD><IMG SRC=generate.cgi?$HOST&$CHECK&604800&1></TD></TR>"
++ echo "<TR><TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&604800&0></TD>"
++ echo "<TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&604800&1></TD></TR>"
+
+ echo "<TR><TD COLSPAN=2>Statistics for the last month:</TD></TR>"
+- echo "<TR><TD><IMG SRC=generate.cgi?$HOST&$CHECK&2851200&0></TD>"
+- echo "<TD><IMG SRC=generate.cgi?$HOST&$CHECK&2851200&1></TD></TR>"
++ echo "<TR><TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&2851200&0></TD>"
++ echo "<TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&2851200&1></TD></TR>"
+ echo "<TR><TD COLSPAN=2>Statistics for the last year:</TD></TR>"
+- echo "<TR><TD><IMG SRC=generate.cgi?$HOST&$CHECK&31557600&0></TD>"
+- echo "<TD><IMG SRC=generate.cgi?$HOST&$CHECK&31557600&1></TD></TR>"
++ echo "<TR><TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&31557600&0></TD>"
++ echo "<TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&31557600&1></TD></TR>"
+ echo "</TABLE>"
+ fi
+
diff --git a/net-mgmt/apan/files/patch-apan.defs b/net-mgmt/apan/files/patch-apan.defs
new file mode 100644
index 000000000000..45fda2521f9b
--- /dev/null
+++ b/net-mgmt/apan/files/patch-apan.defs
@@ -0,0 +1,36 @@
+
+$FreeBSD$
+
+--- apan.defs.orig Fri Mar 26 12:01:53 2004
++++ apan.defs Fri Mar 26 12:14:02 2004
+@@ -1,23 +1,23 @@
+ #Base-directory for nagios:
+-NAGIOSDIR=/usr/local/nagios
++NAGIOSDIR=%%PREFIX%%/share/nagios
+
+ #The directory where apan is installed
+-APANDIR=$NAGIOSDIR/apan
++APANDIR=%%PREFIX%%/share/apan
+
+ #The directory where Nagios plugins resides
+-PLUGINSDIR=$NAGIOSDIR/libexec
++PLUGINSDIR=%%NAGIOSPLUGINSDIR%%
+
+ #The directory where Nagios .cfg-files resides
+-ETCDIR=$NAGIOSDIR/etc
++ETCDIR=%%PREFIX%%/etc/nagios
+
+ # The directory where apans plugins resides
+-PLUGSDIR=$APANDIR/plugs
++PLUGSDIR=%%APANPLUGSDIR%%
+
+ # The main config-file for apan
+-CFGFILE=$APANDIR/apan.cfg
++CFGFILE=%%APANCONFDIR%%/apan.cfg
+
+ # Path to rrdtool
+-RRDTOOL=/usr/local/bin/rrdtool
++RRDTOOL=%%PREFIX%%/bin/rrdtool
+
+ # Set DEBUG to 1 and define a DEBUGFILE to get debug-info from apan
+ DEBUG=1
diff --git a/net-mgmt/apan/files/patch-apan.sh b/net-mgmt/apan/files/patch-apan.sh
new file mode 100644
index 000000000000..ff4e9ecf5fb0
--- /dev/null
+++ b/net-mgmt/apan/files/patch-apan.sh
@@ -0,0 +1,24 @@
+
+$FreeBSD$
+
+--- apan.sh.orig Fri Mar 26 12:14:40 2004
++++ apan.sh Fri Mar 26 12:17:04 2004
+@@ -1,7 +1,7 @@
+-#!/bin/bash
++#!%%PREFIX%%/bin/bash
+
+ # Change this if you are not installing apan in /usr/local/nagios/apan
+-DEFSFILE=/usr/local/nagios/apan/apan.defs
++DEFSFILE=%%APANCONFDIR%%/apan.defs
+ #
+ # Don't change anything below...
+ #
+@@ -66,6 +66,8 @@
+ load) load
+ ;;
+ ping) ping
++ ;;
++ fping) fping
+ ;;
+ lxk_pages) lxk_pages
+ ;;
diff --git a/net-mgmt/apan/files/patch-generate.cgi b/net-mgmt/apan/files/patch-generate.cgi
new file mode 100644
index 000000000000..e31dbfb85588
--- /dev/null
+++ b/net-mgmt/apan/files/patch-generate.cgi
@@ -0,0 +1,20 @@
+
+$FreeBSD$
+
+--- generate.cgi.orig Fri Mar 26 12:17:34 2004
++++ generate.cgi Fri Mar 26 12:41:55 2004
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!%%PREFIX%%/bin/bash
+ #
+ # This file is used to generate the graphs. It should reside in
+ # Nagios cgi-bin directory (Noramally the sbin-dir in your Nagios
+@@ -6,7 +6,7 @@
+ #
+ #
+ # Change this if you are not installing apan in /usr/local/nagios/apan
+-DEFSFILE=/usr/local/nagios/apan/apan.defs
++DEFSFILE=%%APANCONFDIR%%/apan.defs
+ #
+ # Don't change anything below...
+ #
diff --git a/net-mgmt/apan/files/patch-libexec_check__megaide b/net-mgmt/apan/files/patch-libexec_check__megaide
new file mode 100644
index 000000000000..e70e70dd8313
--- /dev/null
+++ b/net-mgmt/apan/files/patch-libexec_check__megaide
@@ -0,0 +1,20 @@
+
+$FreeBSD$
+
+--- libexec/check_megaide.orig Fri Jan 17 11:45:55 2003
++++ libexec/check_megaide Mon Mar 29 17:09:48 2004
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!%%PREFIX%%/bin/bash
+ #
+ # 2002-12-16, Fredrik Wanglund
+ #
+@@ -33,7 +33,7 @@
+ #
+ # If you have installed Nagios in a non-default location, you need
+ # to change the path in the check-command and the variable below
+-NAGIOSPLUGSDIR=/usr/local/nagios/libexec
++NAGIOSPLUGSDIR=%%NAGIOSPLUGINSDIR%%
+
+
+
diff --git a/net-mgmt/apan/files/patch-libexec_check__nt__load b/net-mgmt/apan/files/patch-libexec_check__nt__load
new file mode 100644
index 000000000000..71d706745e88
--- /dev/null
+++ b/net-mgmt/apan/files/patch-libexec_check__nt__load
@@ -0,0 +1,14 @@
+
+$FreeBSD$
+
+--- libexec/check_nt_load.orig Fri Mar 26 12:24:44 2004
++++ libexec/check_nt_load Fri Mar 26 12:25:15 2004
+@@ -11,7 +11,7 @@
+ #
+ #
+ # Change this if you don't have a default installation
+-. /usr/local/nagios/apan/apan.defs
++. %%APANCONFDIR%%/apan.defs
+
+
+ HOST=$1
diff --git a/net-mgmt/apan/files/patch-libexec_check__unix__load b/net-mgmt/apan/files/patch-libexec_check__unix__load
new file mode 100644
index 000000000000..ad9fc7580133
--- /dev/null
+++ b/net-mgmt/apan/files/patch-libexec_check__unix__load
@@ -0,0 +1,14 @@
+
+$FreeBSD$
+
+--- libexec/check_unix_load.orig Fri Mar 26 12:25:41 2004
++++ libexec/check_unix_load Fri Mar 26 12:28:41 2004
+@@ -6,7 +6,7 @@
+ #
+ #
+ # Change this if you don't have a default installation
+-. /usr/local/nagios/apan/apan.defs
++. %%APANCONFDIR%%/apan.defs
+
+
+ HOST=$1
diff --git a/net-mgmt/apan/files/patch-libexec_disk__by__snmp b/net-mgmt/apan/files/patch-libexec_disk__by__snmp
new file mode 100644
index 000000000000..0b38d2adb25d
--- /dev/null
+++ b/net-mgmt/apan/files/patch-libexec_disk__by__snmp
@@ -0,0 +1,14 @@
+
+$FreeBSD$
+
+--- libexec/disk_by_snmp.orig Fri Mar 26 12:29:05 2004
++++ libexec/disk_by_snmp Fri Mar 26 12:30:45 2004
+@@ -82,7 +82,7 @@
+ #
+ #
+ # Change this if you have installed NAgios in a non-default place:
+-NAGIOSPLUGSDIR=/usr/local/nagios/libexec
++NAGIOSPLUGSDIR=%%NAGIOSPLUGINSDIR%%
+
+ HOST=$1
+ COMM=$2
diff --git a/net-mgmt/apan/files/patch-libexec_uptime__by__snmp b/net-mgmt/apan/files/patch-libexec_uptime__by__snmp
new file mode 100644
index 000000000000..caa8024cc5b7
--- /dev/null
+++ b/net-mgmt/apan/files/patch-libexec_uptime__by__snmp
@@ -0,0 +1,14 @@
+
+$FreeBSD$
+
+--- libexec/uptime_by_snmp.orig Fri Mar 26 12:31:02 2004
++++ libexec/uptime_by_snmp Fri Mar 26 12:31:57 2004
+@@ -40,7 +40,7 @@
+ #
+ #
+ # Change this if you have installed NAgios in a non-default place:
+-NAGIOSPLUGSDIR=/usr/local/nagios/libexec
++NAGIOSPLUGSDIR=%%NAGIOSPLUGINSDIR%%
+
+
+
diff --git a/net-mgmt/apan/files/patch-plugs_utils.sh b/net-mgmt/apan/files/patch-plugs_utils.sh
new file mode 100644
index 000000000000..c89c69b66743
--- /dev/null
+++ b/net-mgmt/apan/files/patch-plugs_utils.sh
@@ -0,0 +1,46 @@
+
+$FreeBSD$
+
+--- plugs/utils.sh.orig Fri Mar 26 13:44:47 2004
++++ plugs/utils.sh Mon Mar 29 16:58:13 2004
+@@ -20,7 +20,39 @@
+ ERR=1
+ fi
+ #debug "Ping: $HOST, RTT: $RTT"
+- RTT=`echo $RTT/1000|bc -l`
++ #RTT=`echo $RTT/1000|bc -l`
++ dsname=${NAMELIST[$N]}
++ RETVAL=$STATUS
++ TEMPL=`echo "${TEMPL}:$dsname"`
++ DATA=`echo "${DATA}:$RTT"`
++ N=`expr $N + 1`
++ done
++ RETSTR="$RES"
++}
++
++
++fping() {
++ RETSTR=""
++ #debug "FPING1: $HOST, '$ARGS'"
++ for if in `echo $ARGS|tr "|" " "`; do
++ RES=`$PLUGINSDIR/check_fping $HOST -w $WARN -c $CRIT -n 5`
++ STATUS=$?
++ #debug "FPING2: $HOST, $STATUS, '$RES'"
++ if [ $STATUS -gt 2 ]; then
++ RETVAL=3
++ RETSTR=$RES
++ ERR=1
++ break
++ fi
++ RTT=`echo $RES|cut -d "," -f 2|cut -d "=" -f 2|tr -d " [a-zA-Z)]"`
++ #debug "FPing3: $HOST, RTT: $RTT"
++
++ MINUS=`echo $RTT|grep "-"`
++ if [ "$MINUS" != "" ]; then
++ ERR=1
++ fi
++ #debug "FPing4: $HOST, RTT: $RTT"
++ #RTT=`echo $RTT*1000|bc -l`
+ dsname=${NAMELIST[$N]}
+ RETVAL=$STATUS
+ TEMPL=`echo "${TEMPL}:$dsname"`
diff --git a/net-mgmt/apan/pkg-descr b/net-mgmt/apan/pkg-descr
new file mode 100644
index 000000000000..af10980f18ac
--- /dev/null
+++ b/net-mgmt/apan/pkg-descr
@@ -0,0 +1,5 @@
+Apan is an addon to Nagios that is used to collect results from Nagios
+plugins and store it in RRD-files. You can the use Apan to view graphs of
+the data in Nagios web-interface.
+
+WWW: http://apan.sourceforge.net
diff --git a/net-mgmt/apan/pkg-plist b/net-mgmt/apan/pkg-plist
new file mode 100644
index 000000000000..3d3aa9268d23
--- /dev/null
+++ b/net-mgmt/apan/pkg-plist
@@ -0,0 +1,27 @@
+@exec mkdir -p /var/spool/nagios/rrd
+@exec chmod 775 /var/spool/nagios/rrd
+@exec chmod nagios:nagios /var/spool/nagios/rrd
+@unexec rmdir /var/spool/nagios/rrd 2>/dev/null || true
+etc/apan/apan.cfg-sample
+etc/apan/apan.defs-sample
+share/nagios/cgi-bin/apan.cgi
+share/nagios/cgi-bin/generate.cgi
+libexec/nagios/apan.sh
+libexec/nagios/check_megaide
+libexec/nagios/check_nt_load
+libexec/nagios/check_unix_load
+libexec/nagios/disk_by_snmp
+libexec/nagios/uptime_by_snmp
+libexec/apan/debug.sh
+libexec/apan/disk.sh
+libexec/apan/load.sh
+libexec/apan/nt_utils.sh
+libexec/apan/printer.sh
+libexec/apan/snmp.sh
+libexec/apan/utils.sh
+share/nagios/images/logos/graph.png
+%%PORTDOCS%%%%DOCSDIR%%/README
+%%PORTDOCS%%%%DOCSDIR%%/CHANGELOG
+@dirrm libexec/apan
+@dirrm etc/apan
+%%PORTDOCS%%@dirrm %%DOCSDIR%%