Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Mar 2004 19:04:26 +0200 (CEST)
From:      Janos Mohacsi <mohacsi@niif.hu>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/64941: New port: net-mgmt/apan version 0.2.1
Message-ID:  <200403301704.i2UH4QUj021882@norfolk.ki.iif.hu>
Resent-Message-ID: <200403301610.i2UGAFdX030266@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         64941
>Category:       ports
>Synopsis:       New port: net-mgmt/apan version 0.2.1
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 30 08:10:15 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Janos Mohacsi
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
NIIF
>Environment:
System: FreeBSD norfolk.ki.iif.hu 5.2-CURRENT FreeBSD 5.2-CURRENT #10: Wed Mar 24 17:08:06 CET 2004 root@norfolk.ki.iif.hu:/usr/obj/usr/src/sys/NORFOLK i386

>Description:
	New port: net-mgmt/apan version 0.2.1
	This tools tries to combine the flexibility of nagios and usefulness 
	of rrdtool.
	The apan also installes some nagios plugins, that  can be used for 
	monitoring purpose.
	There is already an apan version 0.3.0 but it it requires mysql 
	for storing configuration. I decided to not introduce further
	requirements for apan. 
	
>How-To-Repeat:
	Apply this shar.
>Fix:
	
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	apan
#	apan/files
#	apan/files/patch-README
#	apan/files/patch-apan.cgi
#	apan/files/patch-apan.defs
#	apan/files/patch-apan.sh
#	apan/files/patch-generate.cgi
#	apan/files/patch-libexec_check__megaide
#	apan/files/patch-libexec_check__nt__load
#	apan/files/patch-libexec_check__unix__load
#	apan/files/patch-libexec_disk__by__snmp
#	apan/files/patch-libexec_uptime__by__snmp
#	apan/files/patch-plugs_utils.sh
#	apan/Makefile
#	apan/distinfo
#	apan/pkg-descr
#	apan/pkg-plist
#
echo c - apan
mkdir -p apan > /dev/null 2>&1
echo c - apan/files
mkdir -p apan/files > /dev/null 2>&1
echo x - apan/files/patch-README
sed 's/^X//' >apan/files/patch-README << 'END-of-apan/files/patch-README'
X
X$FreeBSD$
X
X--- README.orig	Fri Mar 26 12:44:00 2004
X+++ README	Fri Mar 26 13:01:48 2004
X@@ -61,7 +61,7 @@
X 7)  Add apan.sh to checkcommands.cfg;
X 	define command {
X 	command_name                   apan
X-	command_line                   /usr/local/nagios/apan/apan.sh $ARG1$ $HOSTNAME$ "$SERVICEDESC$" $TIMET$ $ARG2$ $ARG3$
X+	command_line                   /%%NAGIOSPLUGINSDIR%%/apan.sh $ARG1$ $HOSTNAME$ "$SERVICEDESC$" $TIMET$ $ARG2$ $ARG3$
X 	}
X 
X 8)  Add sevices to nagios;
X@@ -73,12 +73,118 @@
X 	normal_check_interval          5
X }
X 
X-9)  Add the host/service to apan.cfg
X-	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
X+or  ping service
X+
X+	define service {
X+	host_name                      sheriff,bandit,WC-router-holland
X+	service_description            Ping
X+	check_command                  apan!ping!100.0,20%!500.0,60%
X+	name                           Ping
X+	use                            generic-service
X+	normal_check_interval          1
X+}
X+
X+Note: 
X+- The second argument in the check_command is the name of the plugin that 
X+apan will use. Read more about each plugin in next section of the docs. 
X+- The third and fourth argument is used by the plugins, mainly to specify 
X+warning and critical levels. 
X+
X+9) Creating RRD's
X+I am no expert on RRD-tool, so maybe these examples are not so optimized.. 
X+For example: 
X+ rrdtool create /usr/local/nagios/rrd/raket_Net-use.rrd -s 60  \
X+ DS:IN:COUNTER:300:0:U DS:OUT:COUNTER:300:U:U RRA:AVERAGE:0.5:1:50400 \
X+ RRA:AVERAGE:0.5:60:43800
X+
X+Creates an RRD with two datasets named IN and OUT. The datasets are counters 
X+supposed to store the number of network packages sent and received on a 
X+network-interface. Samplerate is one minute and RRA's are set up to store 
X+minut-average for 35 days and hour-average for 5 years. 
X+
X+To store Pig round-trip times you can use the same syntax, but change the 
X+DS-type to 'GAUGE'; 
X+rrdtool create /usr/local/nagios/rrd/bandit-ping.rrd -s 60 \
X+DS:ping:GAUGE:300:0:U RRA:AVERAGE:0.5:1:50400 RRA:AVERAGE:0.5:60:43800
X+
X+The thing you probably want to look more at is the samplerate and heartbeat 
X+values. Read more about RRD-tool at 
X+
X+http://people.ee.ethz.ch/~oetiker/webtools/rrdtool
X+
X+10) Configuring Apan
X+
X+Now its time for the hard step, the config-file apan.cfg. For each service
X+you want apan to handle you must add a line in apan.cfg. The line is made
X+up of 8 fields separated by ';'.
X+
X+The fields are: 
X+
X+Host name ; Service name ; RRD-file ; argument-1|argument-2|..argument-n ;
X+DS-name-1:plot-function-1 DS-name-2:plot-function-2
X+DS-name-n:plot-function-n ; Comment ; Y-unit ; Extra command
X+
X+In more detail: 
X+
X+Host name
X+The name of the host, should be exactly the same name as in Nagios. 
X+
X+Service name
X+The name of the service, should be exactly the same name as in Nagios. 
X+
X+RRD-file
X+Full name of the RRD-file including the full path. 
X+
X+argument-1|argument-2|..argument-n 
X+Arguments to be used by the plugin. The plugin will be called one time for
X+each argument. Arguments can contain any character exept '|'.
X+
X+DS-name-1:plot-function-1 DS-name-2:plot-function-2 DS-name-n:plot-function-n
X+DS-name is the name of the dataset that corresponds to the argument in the
X+previous field. Plot-function is the format that rrdtool will use to plot
X+the corresponding dataset when the graphs are constructed.
X+
X+Comment
X+An additional informativ string that is displayed on the we-page with the
X+graphs.
X+
X+Y-unit
X+The unit displayed on the Y-axis in the graphs. 
X+
X+Extra command
X+Here you can define extra command-line arguments that will be used by
X+rrdtool when the graps are created.
X+
X+OK, that's the theoretical part, maybe some examples could help? 
X+
X+barbar;apan-disk;/usr/local/nagios/rrd/barbar_disk.rrd;/;-:LINE2;Disk-usage;%
X+
X+This line defines the service 'apan-disk' for host 'barbar'. The RRD,
X+/usr/local/nagios/rrd/barbar_disk.rrd, have one DS named '-'. The plugin
X+is called once with the argument '/'. When a graph is plotted, LINE2 (a
X+medium-thick line) is used for drawing and the Y-axis is labeled '%'.
X+
X+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 
X+10_OUT:LINE2;Network throughput;Bytes/sek;
X+
X+In this definition, the RRD have two datasets named '10_IN' and '10_OUT'.
X+The plugin is called twice with the arguments
X+'public:.1.3.6.1.2.1.2.2.1.10.16777220' and
X+'public:.1.3.6.1.2.1.2.2.1.16.16777220' (The SNMP oid's for sent and
X+received network packages).
X+
X+adsrv;Disk-usage;/usr/local/nagios/rrd/adsrv_disk.rrd;c;c-used:AREA c-free:STACK;Disk usage;Bytes;-l 1 -b 1024
X+
X+Here, the RRD have the datasets 'c-used' and 'c-free'. The plugin is
X+called once wit the argument 'c'. When we generate a graph for this data,
X+'c-used' will become a filled area with 'c-free' stacked upon it. When the
X+y-axis is scaled, 1024 will be used as base-value and it will always start
X+from 0 (-l 1 -b 1024 in the 'Extra command'-field).
X+
X+Simple?? For more information on the arguments, DS-values, etc - look at
X+the plugin-documentation for the specific plugin used.
X+
X 
X-10)  Create a RRD-file;
X-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
X-    Make sure that the Nagios-user have write-permissions on the file.
X 
X 11) Add a link to the graphs as an extended service info;
X 	define serviceextinfo{  
X@@ -90,6 +196,17 @@
X }
X 
X 12) Start Nagios!
X+
X+13) Debugging
X+
X+To enable debugging output from Apan, set the variables DEBUG to 1 and the
X+variable DEBUGFILE to point to a file in apan.defs; Debugging output from
X+the cgi's ic controlled by CGIDEBUG and CGIDEBUGFILE
X+
X+DEBUG=1
X+DEBUGFILE=/tmp/apan.debug
X+CGIDEBUG=1
X+CGIDEBUGFILE=/tmp/apancgi.debug
X 
X 
X 
END-of-apan/files/patch-README
echo x - apan/files/patch-apan.cgi
sed 's/^X//' >apan/files/patch-apan.cgi << 'END-of-apan/files/patch-apan.cgi'
X
X$FreeBSD$
X
X--- apan.cgi.orig	Fri Jan 17 12:18:11 2003
X+++ apan.cgi	Mon Mar 29 17:08:42 2004
X@@ -1,11 +1,11 @@
X-#!/bin/bash
X+#!%%PREFIX%%/bin/bash
X # This file is used to generate the graphs. It should reside in
X # Nagios cgi-bin directory (Noramally the sbin-dir in your Nagios
X # installation).
X #
X #
X # Change this if you are not installing apan in /usr/local/nagios/apan
X-DEFSFILE=/usr/local/nagios/apan/apan.defs
X+DEFSFILE=%%APANCONFDIR%%/apan.defs
X #
X # Don't change anything below...
X #
X@@ -63,38 +63,38 @@
X 
X 	if [ $N -ne 2 ]; then
X 		echo "Statistics for the last 10 minutes:<BR>"
X-		echo "<IMG SRC=generate.cgi?$HOST&$CHECK&600><BR>"
X+		echo "<IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&600><BR>"
X 		echo "Statistics for the last hour:<BR>"
X-		echo "<IMG SRC=generate.cgi?$HOST&$CHECK&3600><BR>"
X+		echo "<IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&3600><BR>"
X 		echo "Statistics for the last 24 hours:<BR>"
X-		echo "<IMG SRC=generate.cgi?$HOST&$CHECK&86400><BR>"
X+		echo "<IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&86400><BR>"
X 		echo "Statistics for the last week:<BR>"
X-		echo "<IMG SRC=generate.cgi?$HOST&$CHECK&604800><BR>"
X+		echo "<IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&604800><BR>"
X 		echo "Statistics for the last Month:<BR>"
X-		echo "<IMG SRC=generate.cgi?$HOST&$CHECK&2851200><BR>"
X+		echo "<IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&2851200><BR>"
X 		echo "Statistics for the last Year:<BR>"
X-		echo "<IMG SRC=generate.cgi?$HOST&$CHECK&31557600><BR>"
X+		echo "<IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&31557600><BR>"
X 	else
X 		echo "<TABLE COLS=2 BORDER=1>"
X 		echo "<TR><TD COLSPAN=2>Statistics for the last 10 minutes:</TD></TR>"
X-		echo "<TR><TD><IMG SRC=generate.cgi?$HOST&$CHECK&600&0></TD>"
X-		echo "<TD><IMG SRC=generate.cgi?$HOST&$CHECK&300&1></TD></TR>"
X+		echo "<TR><TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&600&0></TD>"
X+		echo "<TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&300&1></TD></TR>"
X 		echo "<TR><TD COLSPAN=2>Statistics for the last hour:</TD></TR>"
X-		echo "<TR><TD><IMG SRC=generate.cgi?$HOST&$CHECK&3600&0></TD>"
X-		echo "<TD><IMG SRC=generate.cgi?$HOST&$CHECK&3600&1></TD></TR>"
X+		echo "<TR><TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&3600&0></TD>"
X+		echo "<TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&3600&1></TD></TR>"
X 		echo "<TR><TD COLSPAN=2>Statistics for the last 24 hours:</TD></TR>"
X-		echo "<TR><TD><IMG SRC=generate.cgi?$HOST&$CHECK&86400&0><BR></TD>"
X-		echo "<TD><IMG SRC=generate.cgi?$HOST&$CHECK&86400&1></TD></TR>"
X+		echo "<TR><TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&86400&0><BR></TD>"
X+		echo "<TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&86400&1></TD></TR>"
X 		echo "<TR><TD COLSPAN=2>Statistics for the last week:</TD></TR>"
X-		echo "<TR><TD><IMG SRC=generate.cgi?$HOST&$CHECK&604800&0></TD>"
X-		echo "<TD><IMG SRC=generate.cgi?$HOST&$CHECK&604800&1></TD></TR>"
X+		echo "<TR><TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&604800&0></TD>"
X+		echo "<TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&604800&1></TD></TR>"
X 
X 		echo "<TR><TD COLSPAN=2>Statistics for the last month:</TD></TR>"
X-		echo "<TR><TD><IMG SRC=generate.cgi?$HOST&$CHECK&2851200&0></TD>"
X-		echo "<TD><IMG SRC=generate.cgi?$HOST&$CHECK&2851200&1></TD></TR>"
X+		echo "<TR><TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&2851200&0></TD>"
X+		echo "<TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&2851200&1></TD></TR>"
X 		echo "<TR><TD COLSPAN=2>Statistics for the last year:</TD></TR>"
X-		echo "<TR><TD><IMG SRC=generate.cgi?$HOST&$CHECK&31557600&0></TD>"
X-		echo "<TD><IMG SRC=generate.cgi?$HOST&$CHECK&31557600&1></TD></TR>"
X+		echo "<TR><TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&31557600&0></TD>"
X+		echo "<TD><IMG SRC=/nagios/cgi-bin/generate.cgi?$HOST&$CHECK&31557600&1></TD></TR>"
X 		echo "</TABLE>"
X 	fi
X 
END-of-apan/files/patch-apan.cgi
echo x - apan/files/patch-apan.defs
sed 's/^X//' >apan/files/patch-apan.defs << 'END-of-apan/files/patch-apan.defs'
X
X$FreeBSD$
X
X--- apan.defs.orig	Fri Mar 26 12:01:53 2004
X+++ apan.defs	Fri Mar 26 12:14:02 2004
X@@ -1,23 +1,23 @@
X #Base-directory for nagios:
X-NAGIOSDIR=/usr/local/nagios
X+NAGIOSDIR=%%PREFIX%%/share/nagios
X 
X #The directory where apan is installed
X-APANDIR=$NAGIOSDIR/apan
X+APANDIR=%%PREFIX%%/share/apan
X 
X #The directory where Nagios plugins resides
X-PLUGINSDIR=$NAGIOSDIR/libexec
X+PLUGINSDIR=%%NAGIOSPLUGINSDIR%%
X 
X #The directory where Nagios .cfg-files resides
X-ETCDIR=$NAGIOSDIR/etc
X+ETCDIR=%%PREFIX%%/etc/nagios
X 
X # The directory where apans plugins resides
X-PLUGSDIR=$APANDIR/plugs
X+PLUGSDIR=%%APANPLUGSDIR%%
X 
X # The main config-file for apan
X-CFGFILE=$APANDIR/apan.cfg
X+CFGFILE=%%APANCONFDIR%%/apan.cfg
X 
X # Path to rrdtool
X-RRDTOOL=/usr/local/bin/rrdtool
X+RRDTOOL=%%PREFIX%%/bin/rrdtool
X 
X # Set DEBUG to 1 and define a DEBUGFILE to get debug-info from apan
X DEBUG=1
END-of-apan/files/patch-apan.defs
echo x - apan/files/patch-apan.sh
sed 's/^X//' >apan/files/patch-apan.sh << 'END-of-apan/files/patch-apan.sh'
X
X$FreeBSD$
X
X--- apan.sh.orig	Fri Mar 26 12:14:40 2004
X+++ apan.sh	Fri Mar 26 12:17:04 2004
X@@ -1,7 +1,7 @@
X-#!/bin/bash
X+#!%%PREFIX%%/bin/bash
X 
X # Change this if you are not installing apan in /usr/local/nagios/apan
X-DEFSFILE=/usr/local/nagios/apan/apan.defs
X+DEFSFILE=%%APANCONFDIR%%/apan.defs
X #
X # Don't change anything below...
X #
X@@ -66,6 +66,8 @@
X 	load) load
X 	;;
X 	ping) ping
X+	;;
X+	fping) fping
X 	;;
X 	lxk_pages) lxk_pages
X 	;;
END-of-apan/files/patch-apan.sh
echo x - apan/files/patch-generate.cgi
sed 's/^X//' >apan/files/patch-generate.cgi << 'END-of-apan/files/patch-generate.cgi'
X
X$FreeBSD$
X
X--- generate.cgi.orig	Fri Mar 26 12:17:34 2004
X+++ generate.cgi	Fri Mar 26 12:41:55 2004
X@@ -1,4 +1,4 @@
X-#!/bin/sh
X+#!%%PREFIX%%/bin/bash
X # 
X # This file is used to generate the graphs. It should reside in
X # Nagios cgi-bin directory (Noramally the sbin-dir in your Nagios
X@@ -6,7 +6,7 @@
X #
X #
X # Change this if you are not installing apan in /usr/local/nagios/apan
X-DEFSFILE=/usr/local/nagios/apan/apan.defs
X+DEFSFILE=%%APANCONFDIR%%/apan.defs
X #
X # Don't change anything below...
X #
END-of-apan/files/patch-generate.cgi
echo x - apan/files/patch-libexec_check__megaide
sed 's/^X//' >apan/files/patch-libexec_check__megaide << 'END-of-apan/files/patch-libexec_check__megaide'
X
X$FreeBSD$
X
X--- libexec/check_megaide.orig	Fri Jan 17 11:45:55 2003
X+++ libexec/check_megaide	Mon Mar 29 17:09:48 2004
X@@ -1,4 +1,4 @@
X-#!/bin/bash
X+#!%%PREFIX%%/bin/bash
X #
X # 2002-12-16, Fredrik Wanglund
X #
X@@ -33,7 +33,7 @@
X #
X # If you have installed Nagios in a non-default location, you need
X # to change the path in the check-command and the variable below
X-NAGIOSPLUGSDIR=/usr/local/nagios/libexec
X+NAGIOSPLUGSDIR=%%NAGIOSPLUGINSDIR%%
X 
X 
X 
END-of-apan/files/patch-libexec_check__megaide
echo x - apan/files/patch-libexec_check__nt__load
sed 's/^X//' >apan/files/patch-libexec_check__nt__load << 'END-of-apan/files/patch-libexec_check__nt__load'
X
X$FreeBSD$
X
X--- libexec/check_nt_load.orig	Fri Mar 26 12:24:44 2004
X+++ libexec/check_nt_load	Fri Mar 26 12:25:15 2004
X@@ -11,7 +11,7 @@
X #
X #
X # Change this if you don't have a default installation
X-. /usr/local/nagios/apan/apan.defs
X+. %%APANCONFDIR%%/apan.defs
X 
X 
X HOST=$1
END-of-apan/files/patch-libexec_check__nt__load
echo x - apan/files/patch-libexec_check__unix__load
sed 's/^X//' >apan/files/patch-libexec_check__unix__load << 'END-of-apan/files/patch-libexec_check__unix__load'
X
X$FreeBSD$
X
X--- libexec/check_unix_load.orig	Fri Mar 26 12:25:41 2004
X+++ libexec/check_unix_load	Fri Mar 26 12:28:41 2004
X@@ -6,7 +6,7 @@
X #
X #
X # Change this if you don't have a default installation
X-. /usr/local/nagios/apan/apan.defs
X+. %%APANCONFDIR%%/apan.defs
X 
X 
X HOST=$1
END-of-apan/files/patch-libexec_check__unix__load
echo x - apan/files/patch-libexec_disk__by__snmp
sed 's/^X//' >apan/files/patch-libexec_disk__by__snmp << 'END-of-apan/files/patch-libexec_disk__by__snmp'
X
X$FreeBSD$
X
X--- libexec/disk_by_snmp.orig	Fri Mar 26 12:29:05 2004
X+++ libexec/disk_by_snmp	Fri Mar 26 12:30:45 2004
X@@ -82,7 +82,7 @@
X #
X #
X # Change this if you have installed NAgios in a non-default place:
X-NAGIOSPLUGSDIR=/usr/local/nagios/libexec
X+NAGIOSPLUGSDIR=%%NAGIOSPLUGINSDIR%%
X 
X HOST=$1
X COMM=$2
END-of-apan/files/patch-libexec_disk__by__snmp
echo x - apan/files/patch-libexec_uptime__by__snmp
sed 's/^X//' >apan/files/patch-libexec_uptime__by__snmp << 'END-of-apan/files/patch-libexec_uptime__by__snmp'
X
X$FreeBSD$
X
X--- libexec/uptime_by_snmp.orig	Fri Mar 26 12:31:02 2004
X+++ libexec/uptime_by_snmp	Fri Mar 26 12:31:57 2004
X@@ -40,7 +40,7 @@
X #
X #
X # Change this if you have installed NAgios in a non-default place:
X-NAGIOSPLUGSDIR=/usr/local/nagios/libexec
X+NAGIOSPLUGSDIR=%%NAGIOSPLUGINSDIR%%
X 
X 
X 
END-of-apan/files/patch-libexec_uptime__by__snmp
echo x - apan/files/patch-plugs_utils.sh
sed 's/^X//' >apan/files/patch-plugs_utils.sh << 'END-of-apan/files/patch-plugs_utils.sh'
X
X$FreeBSD$
X
X--- plugs/utils.sh.orig	Fri Mar 26 13:44:47 2004
X+++ plugs/utils.sh	Mon Mar 29 16:58:13 2004
X@@ -20,7 +20,39 @@
X 			ERR=1
X 		fi
X 		#debug "Ping: $HOST, RTT: $RTT"
X-		RTT=`echo $RTT/1000|bc -l`
X+		#RTT=`echo $RTT/1000|bc -l`
X+		dsname=${NAMELIST[$N]}
X+		RETVAL=$STATUS
X+		TEMPL=`echo "${TEMPL}:$dsname"`
X+		DATA=`echo "${DATA}:$RTT"`
X+		N=`expr $N + 1`
X+	done
X+		RETSTR="$RES"
X+}
X+
X+	
X+fping() {
X+	RETSTR=""
X+	#debug "FPING1: $HOST, '$ARGS'"
X+	for if in `echo $ARGS|tr "|" " "`; do
X+		RES=`$PLUGINSDIR/check_fping $HOST -w $WARN -c $CRIT -n 5`
X+		STATUS=$?
X+		#debug "FPING2: $HOST, $STATUS, '$RES'"
X+		if [ $STATUS -gt 2 ]; then
X+			RETVAL=3
X+			RETSTR=$RES
X+			ERR=1
X+			break
X+		fi
X+		RTT=`echo $RES|cut -d "," -f 2|cut -d "=" -f 2|tr -d " [a-zA-Z)]"`
X+		#debug "FPing3: $HOST, RTT: $RTT"
X+
X+		MINUS=`echo $RTT|grep "-"`
X+		if [ "$MINUS" != "" ]; then
X+			ERR=1
X+		fi
X+		#debug "FPing4: $HOST, RTT: $RTT"
X+		#RTT=`echo $RTT*1000|bc -l`
X 		dsname=${NAMELIST[$N]}
X 		RETVAL=$STATUS
X 		TEMPL=`echo "${TEMPL}:$dsname"`
END-of-apan/files/patch-plugs_utils.sh
echo x - apan/Makefile
sed 's/^X//' >apan/Makefile << 'END-of-apan/Makefile'
X# New ports collection makefile for:   apan
X# Date created:        26 March 2004
X# Whom:                Janos.Mohacsi@bsd.hu
X#
X# $FreeBSD$
X#
X
XPORTNAME=	apan
XPORTVERSION=	0.2.1
XCATEGORIES=	net-mgmt
XMASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
XMASTER_SITE_SUBDIR=	${PORTNAME}
X
XMAINTAINER=	janos.mohacsi@bsd.hu
XCOMMENT=	Tool for integrating Nagios with RRDTOOL
X
XRUN_DEPENDS=	rrdtool:${PORTSDIR}/net/rrdtool \
X		nagios:${PORTSDIR}/net-mgmt/nagios \
X		bash:${PORTSDIR}/shells/bash2
X
XNO_BUILD=	yes
XUSE_REINPLACE=	yes
XNAGIOSDIR?=	/var/spool/nagios
XDOC_FILES=	README CHANGELOG
X
XWRKSRC=		${WRKDIR}/${PORTNAME}
X
Xdo-configure:
X	@${REINPLACE_CMD} \
X		-e 's|%%APANCONFDIR%%|${PREFIX}/etc/apan/|' \
X		-e 's|%%NAGIOSPLUGINSDIR%%|${PREFIX}/libexec/nagios/|' \
X		-e 's|%%APANPLUGSDIR%%|${PREFIX}/libexec/${PORTNAME}/|' \
X		-e 's|%%PREFIX%%|${PREFIX}|' \
X		-e 's|/bin/sh|${PREFIX}/bin/bash|' \
X		${WRKSRC}/*.* ${WRKSRC}/README
X	@${REINPLACE_CMD} \
X		-e 's|%%APANCONFDIR%%|${PREFIX}/etc/apan/|' \
X		-e 's|%%NAGIOSPLUGINSDIR%%|${PREFIX}/libexec/nagios/|' \
X		-e 's|%%APANPLUGSDIR%%|${PREFIX}/libexec/${PORTNAME}/|' \
X		-e 's|%%PREFIX%%|${PREFIX}|' \
X		-e 's|/bin/bash|${PREFIX}/bin/bash|' \
X		-e 's|/bin/sh|${PREFIX}/bin/bash|' \
X		${WRKSRC}/plugs/*
X	@${REINPLACE_CMD} \
X		-e 's|%%APANCONFDIR%%|${PREFIX}/etc/apan/|' \
X		-e 's|%%NAGIOSPLUGINSDIR%%|${PREFIX}/libexec/nagios/|' \
X		-e 's|%%APANPLUGSDIR%%|${PREFIX}/libexec/${PORTNAME}/|' \
X		-e 's|%%PREFIX%%|${PREFIX}|' \
X		-e 's|/bin/bash|${PREFIX}/bin/bash|' \
X		-e 's|/bin/sh|${PREFIX}/bin/bash|' \
X		${WRKSRC}/libexec/*
X
Xdo-install:
X	@${MKDIR} ${PREFIX}/libexec/${PORTNAME}
X	@${MKDIR} ${PREFIX}/etc/${PORTNAME}
X	@${MKDIR} ${NAGIOSDIR}/rrd
X	@${INSTALL_SCRIPT} ${WRKSRC}/apan.sh ${PREFIX}/libexec/nagios/
X	@${INSTALL_SCRIPT} ${WRKSRC}/apan.cgi ${PREFIX}/share/nagios/cgi-bin
X	@${INSTALL_SCRIPT} ${WRKSRC}/generate.cgi ${PREFIX}/share/nagios/cgi-bin
X	@${INSTALL_SCRIPT} ${WRKSRC}/libexec/check_megaide ${PREFIX}/libexec/nagios
X	@${INSTALL_SCRIPT} ${WRKSRC}/libexec/check_nt_load ${PREFIX}/libexec/nagios
X	@${INSTALL_SCRIPT} ${WRKSRC}/libexec/check_unix_load ${PREFIX}/libexec/nagios
X	@${INSTALL_SCRIPT} ${WRKSRC}/libexec/disk_by_snmp ${PREFIX}/libexec/nagios
X	@${INSTALL_SCRIPT} ${WRKSRC}/libexec/uptime_by_snmp ${PREFIX}/libexec/nagios
X	@${INSTALL_SCRIPT} ${WRKSRC}/plugs/debug.sh ${PREFIX}/libexec/${PORTNAME}
X	@${INSTALL_SCRIPT} ${WRKSRC}/plugs/disk.sh ${PREFIX}/libexec/${PORTNAME}
X	@${INSTALL_SCRIPT} ${WRKSRC}/plugs/load.sh ${PREFIX}/libexec/${PORTNAME}
X	@${INSTALL_SCRIPT} ${WRKSRC}/plugs/nt_utils.sh ${PREFIX}/libexec/${PORTNAME}
X	@${INSTALL_SCRIPT} ${WRKSRC}/plugs/printer.sh ${PREFIX}/libexec/${PORTNAME}
X	@${INSTALL_SCRIPT} ${WRKSRC}/plugs/snmp.sh ${PREFIX}/libexec/${PORTNAME}
X	@${INSTALL_SCRIPT} ${WRKSRC}/plugs/utils.sh ${PREFIX}/libexec/${PORTNAME}
X	@${INSTALL_DATA} ${WRKSRC}/apan.cfg ${PREFIX}/etc/${PORTNAME}/apan.cfg-sample
X	@${INSTALL_DATA} ${WRKSRC}/apan.defs ${PREFIX}/etc/${PORTNAME}/apan.defs-sample
X	@${INSTALL_DATA} ${WRKSRC}/graph.png ${PREFIX}/share/nagios/images/logos
X
Xpost-install:
X.if !defined(NOPORTDOCS)
X	@${MKDIR} ${DOCSDIR}
X.for file in ${DOC_FILES}
X	@${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR}
X.endfor
X.endif
X
X.include <bsd.port.mk>
END-of-apan/Makefile
echo x - apan/distinfo
sed 's/^X//' >apan/distinfo << 'END-of-apan/distinfo'
XMD5 (apan-0.2.1.tar.gz) = 2e0ffbddf6073cf5cc38efa501200dfa
XSIZE (apan-0.2.1.tar.gz) = 19083
END-of-apan/distinfo
echo x - apan/pkg-descr
sed 's/^X//' >apan/pkg-descr << 'END-of-apan/pkg-descr'
XApan is a addon to Nagios that is used to collect results from Nagios
Xplugins and store it in RRD-files. You can the use Apan to view graphs of
Xthe data in Nagios web-interface.
X
XWWW: http://apan.sourceforge.net
END-of-apan/pkg-descr
echo x - apan/pkg-plist
sed 's/^X//' >apan/pkg-plist << 'END-of-apan/pkg-plist'
X@exec mkdir -p /var/spool/nagios/rrd
X@exec chmod 775 /var/spool/nagios/rrd
X@exec chmod nagios:nagios /var/spool/nagios/rrd
X@unexec rmdir /var/spool/nagios/rrd 2>/dev/null || true
Xetc/apan/apan.cfg-sample
Xetc/apan/apan.defs-sample
Xshare/nagios/cgi-bin/apan.cgi
Xshare/nagios/cgi-bin/generate.cgi
Xlibexec/nagios/apan.sh
Xlibexec/nagios/check_megaide
Xlibexec/nagios/check_nt_load
Xlibexec/nagios/check_unix_load
Xlibexec/nagios/disk_by_snmp
Xlibexec/nagios/uptime_by_snmp
Xlibexec/apan/debug.sh
Xlibexec/apan/disk.sh
Xlibexec/apan/load.sh
Xlibexec/apan/nt_utils.sh
Xlibexec/apan/printer.sh
Xlibexec/apan/snmp.sh
Xlibexec/apan/utils.sh
Xshare/nagios/images/logos/graph.png
X%%PORTDOCS%%%%DOCSDIR%%/README
X%%PORTDOCS%%%%DOCSDIR%%/CHANGELOG
X@dirrm libexec/apan
X@dirrm etc/apan
X%%PORTDOCS%%@dirrm %%DOCSDIR%%
END-of-apan/pkg-plist
exit


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403301704.i2UH4QUj021882>