ports/69370: New port: net-mgmt/nagiostat version 1.0.0
Janos Mohacsi
mohacsi at niif.hu
Wed Jul 21 10:00:45 UTC 2004
>Number: 69370
>Category: ports
>Synopsis: New port: net-mgmt/nagiostat version 1.0.0
>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: Wed Jul 21 10:00:44 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator: Janos Mohacsi
>Release: FreeBSD 4.10-PRERELEASE i386
>Organization:
NIIF
>Environment:
System: FreeBSD skye.ki.iif.hu 4.10-PRERELEASE FreeBSD 4.10-PRERELEASE #7: Thu May 20 13:27:41 CEST 2004 root at skye.ki.iif.hu:/usr/obj/mirror/src/sys/SKYE i386
>Description:
New port: net-mgmt/nagiostat version 1.0.0
This port is processes performance data produced by nagios
stores them to RRD database and provide nice view of collected data
in a very configurable way.
>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:
#
# nagiostat/
# nagiostat/pkg-plist
# nagiostat/pkg-descr
# nagiostat/distinfo
# nagiostat/Makefile
# nagiostat/files
# nagiostat/files/patch-nagiostat
# nagiostat/files/patch-nagiostat.conf
# nagiostat/files/patch-README
#
echo c - nagiostat/
mkdir -p nagiostat/ > /dev/null 2>&1
echo x - nagiostat/pkg-plist
sed 's/^X//' >nagiostat/pkg-plist << 'END-of-nagiostat/pkg-plist'
X at exec mkdir -p /var/spool/nagios/nagiostatrrd
X at exec chmod 775 /var/spool/nagios/nagiostatrrd
X at exec chown nagios:nagios /var/spool/nagios/nagiostatrrd
X at unexec rmdir /var/spool/nagios/nagiostatrrd 2>/dev/null || true
Xetc/nagiostat.conf-sample
Xshare/nagios/cgi-bin/nagiostat.cgi
Xlibexec/nagiostat/nagiostat
Xlibexec/nagiostat/html-templates/default.html
Xlibexec/nagiostat/html-templates/graphindex.html
Xshare/nagios/images/logos/graph.gif
X%%PORTDOCS%%%%DOCSDIR%%/README
X%%PORTDOCS%%%%DOCSDIR%%/GPL.txt
X at dirrm libexec/nagiostat/html-templates
X at dirrm libexec/nagiostat
X%%PORTDOCS%%@dirrm %%DOCSDIR%%
END-of-nagiostat/pkg-plist
echo x - nagiostat/pkg-descr
sed 's/^X//' >nagiostat/pkg-descr << 'END-of-nagiostat/pkg-descr'
XNagiostat parses performance-data from Nagios and generates graphs of
Xtrends over time. Nagiostat makes use of RRD-tool. It then generates
Xgraphs on-the-fly through a CGI-script and HTML-templates. Nagiostat is
Xwritten in perl.
X
XWWW: http://nagiostat.sourceforge.net
END-of-nagiostat/pkg-descr
echo x - nagiostat/distinfo
sed 's/^X//' >nagiostat/distinfo << 'END-of-nagiostat/distinfo'
XMD5 (nagiostat-1.0.0.tgz) = 10ecfebe9430b2daf6a0e87b71dc739c
XSIZE (nagiostat-1.0.0.tgz) = 18883
END-of-nagiostat/distinfo
echo x - nagiostat/Makefile
sed 's/^X//' >nagiostat/Makefile << 'END-of-nagiostat/Makefile'
X# New ports collection makefile for: nagiostat
X# Date created: 20 July 2004
X# Whom: Janos.Mohacsi at bsd.hu
X#
X# $FreeBSD$
X#
X
XPORTNAME= nagiostat
XPORTVERSION= 1.0.0
XCATEGORIES= net-mgmt
XMASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
XMASTER_SITE_SUBDIR= ${PORTNAME}
XEXTRACT_SUFX= .tgz
X
XMAINTAINER= janos.mohacsi at bsd.hu
XCOMMENT= Nagiostat parses performance-data from Nagios and generates graphs
X
XRUN_DEPENDS= rrdtool:${PORTSDIR}/net/rrdtool \
X nagios:${PORTSDIR}/net-mgmt/nagios \
X ${SITE_PERL}/CGI.pm:${PORTSDIR}/www/p5-CGI.pm
X
XUSE_PERL5= yes
XNO_BUILD= yes
XUSE_REINPLACE= yes
XNO_WRKSUBDIR= yes
XNAGIOSDIR?= /var/spool/nagios
XDOC_FILES= README GPL.txt
X
Xdo-configure:
X @${REINPLACE_CMD} \
X -e 's|%%NAGIOSTATCONFDIR%%|${PREFIX}/etc/|' \
X -e 's|%%NAGIOSTATDIR%%|${PREFIX}/libexec/${PORTNAME}/|' \
X -e 's|%%NAGIOSTATRRD%%|${NAGIOSDIR}/${PORTNAME}rrd/|' \
X -e 's|%%PREFIX%%|${PREFIX}|' \
X ${WRKSRC}/nagiostat ${WRKSRC}/nagiostat.conf ${WRKSRC}/README
Xdo-install:
X @${MKDIR} ${PREFIX}/libexec/${PORTNAME}
X @${MKDIR} ${NAGIOSDIR}/${PORTNAME}rrd
X @${INSTALL_SCRIPT} ${WRKSRC}/nagiostat ${PREFIX}/libexec/${PORTNAME}/
X @${LN} -s ${PREFIX}/libexec/${PORTNAME}/nagiostat ${PREFIX}/share/nagios/cgi-bin/nagiostat.cgi
X @${INSTALL_DATA} ${WRKSRC}/nagiostat.conf ${PREFIX}/etc/nagiostat.conf-sample
X @${INSTALL_DATA} ${WRKSRC}/graph.gif ${PREFIX}/share/nagios/images/logos
X @${MKDIR} ${PREFIX}/libexec/${PORTNAME}/html-templates/
X @${INSTALL_DATA} ${WRKSRC}/html-templates/default.html ${PREFIX}/libexec/${PORTNAME}/html-templates/
X @${INSTALL_DATA} ${WRKSRC}/html-templates/graphindex.html ${PREFIX}/libexec/${PORTNAME}/html-templates/
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-nagiostat/Makefile
echo c - nagiostat/files
mkdir -p nagiostat/files > /dev/null 2>&1
echo x - nagiostat/files/patch-nagiostat
sed 's/^X//' >nagiostat/files/patch-nagiostat << 'END-of-nagiostat/files/patch-nagiostat'
X
X$FreeBSD$
X
X--- nagiostat.orig Tue Jul 20 17:30:18 2004
X+++ nagiostat Tue Jul 20 18:01:53 2004
X@@ -21,8 +21,8 @@
X use strict;
X
X ## Basic configuration options
X-my $BASE_DIR = "/usr/local/nagios/nagiostat";
X-my $CONFIG_FILE = $BASE_DIR."/nagiostat.conf"; ## Config-file location
X+my $BASE_DIR = "%%NAGIOSTATDIR%%";
X+my $CONFIG_FILE = "%%NAGIOSTATCONFDIR%%/nagiostat.conf"; ## Config-file location
X my $DEBUG_LOG_FILE = $BASE_DIR."/debug.log"; ## Specify where to create log-file and what filename (must be writable by nagios-user!)
X my $DEBUGLEVEL = 3; ## 0=Nothing, 1=Errors, 2=Warnings, 3=Debug
X my $DEBUGOUTPUT = 0; ## 0=file, 1=STDERR, 2=STDOUT (for cgi)
END-of-nagiostat/files/patch-nagiostat
echo x - nagiostat/files/patch-nagiostat.conf
sed 's/^X//' >nagiostat/files/patch-nagiostat.conf << 'END-of-nagiostat/files/patch-nagiostat.conf'
X
X$FreeBSD$
X
X--- nagiostat.conf.orig Tue Jul 20 18:02:15 2004
X+++ nagiostat.conf Tue Jul 20 18:09:40 2004
X@@ -13,10 +13,10 @@
X ## quote-marks are written in pairs EVEN IN COMMENTS. This is a known bug.
X
X # Pointer to where the rrd-tool binary is located
X-RRDToolPath /usr/local/bin/rrdtool
X+RRDToolPath %%PREFIX%%/bin/rrdtool
X
X # Pointer to where HTML-templates are stored
X-HTMLTemplatePath /usr/local/nagios/nagiostat/html-templates
X+HTMLTemplatePath %%NAGIOSTATDIR%%/html-templates
X
X # Pointer to HTML-template for the index-page (relative to HTMLTemplatePath)
X GraphIndexTemplate graphindex.html
X@@ -25,7 +25,7 @@
X # nagiostat automatically creates RRD-archives if they dont exist.
X # IMPORTANT: the whole directory RRDArchivePath must be writable by the nagios user (that calls the
X # nagiostat-script)
X-RRDArchivePath /usr/local/nagios/nagiostat/archives
X+RRDArchivePath %%NAGIOSTATRRD%%/
X
X ## How many graphs per HTML-page and which time-periods they should represent
X ## TemplateName Definitions (format=<starttime>:<endtime>:<description>)
END-of-nagiostat/files/patch-nagiostat.conf
echo x - nagiostat/files/patch-README
sed 's/^X//' >nagiostat/files/patch-README << 'END-of-nagiostat/files/patch-README'
X
X$FreeBSD$
X
X--- README.orig Wed Jul 21 10:07:51 2004
X+++ README Wed Jul 21 10:12:10 2004
X@@ -27,24 +27,28 @@
X
X
X **INSTALLING
X-1. Unpack the tar-file to a directory, for example '/usr/local/nagios/nagiostat'.
X-The nagiostat-base-dir does not have to be within the nagios-installation directory.
X
X-2. Start by editing the $BASE_DIR parameter in the file called "nagiostat", which is
X-the main script. Set the value to the directory where you unpacked the files.
X-Create a file called "debug.log" ('$ touch debug.log') in this dir and change permissions so that the
X-nagios-user may write to it. This is the logfile for nagiostat which can be
X-very helpful when debugging the regular-expression thing.
X+1. Unpack the tar-file to a directory, for example '%%NAGIOSTATDIR%%'.
X+The nagiostat-base-dir does not have to be within the nagios-installation
X+directory.
X
X-If things are installed in the directory specified in step 1, you can also run "make install" to
X-create debug.log, archives-directory and set permissions on them. "make install" is under development.
X-It also assumes that the nagios-user is called 'nagios'.
X+2. Start by editing the $BASE_DIR parameter in the file called
X+"nagiostat", which is the main script. Set the value to the directory
X+where you unpacked the files. Create a file called "debug.log" ('$ touch
X+debug.log') in this dir and change permissions so that the nagios-user may
X+write to it. This is the logfile for nagiostat which can be very helpful
X+when debugging the regular-expression thing.
X
X-3. Then read the nagios.conf-file where also most of the documentation is located and change the
X-parameters to your liking.
X+If things are installed in the directory specified in step 1, you can also
X+run "make install" to create debug.log, archives-directory and set
X+permissions on them. "make install" is under development. It also assumes
X+that the nagios-user is called 'nagios'.
X
X-4. Then set up your webserver so that you can access the nagiostat.cgi (symbolic-link
X-to 'nagiostat') from some URL. Example for apache:
X+3. Then read the nagios.conf-file where also most of the documentation is
X+located and change the parameters to your liking.
X+
X+4. Then set up your webserver so that you can access the nagiostat.cgi
X+(symbolic-link to 'nagiostat') from some URL. Example for apache:
X ---
X Alias /nagiostat/ /usr/local/nagios/nagiostat/
X <Directory /usr/local/nagios/nagiostat>
X@@ -53,41 +57,47 @@
X Allow from all
X </Directory>
X ---
X-You also have to make sure that the apache-user has read-rights to the RRDArchivePath
X-and the config-file nagios.conf. You also would probably add additional security to
X-this, password protecting for instance.
X
X-5. Set up nagios to enable performance-data handling and that it should send the perfdata
X-to nagiostat.
X-In nagios.cfg, set the parameter 'process_performance_data=1'. This enables processing of
X-performance data.
X-Then add the parameter 'service_perfdata_command=service-perf-data-handler' also to nagios.cfg. This
X-tells nagios to run the "service-perf-data-handler" command to process the performance data after
X-each plugin has been executed.
X-Then add the following to the checkcommands.cfg-file (or whatever nagios-config-file you find suitable):
X+You also have to make sure that the apache-user has read-rights to the
X+RRDArchivePath and the config-file nagios.conf. You also would probably
X+add additional security to this, password protecting for instance.
X+
X+5. Set up nagios to enable performance-data handling and that it should
X+send the perfdata to nagiostat. In nagios.cfg, set the parameter
X+'process_performance_data=1'. This enables processing of performance data.
X+Then add the parameter
X+'service_perfdata_command=service-perf-data-handler' also to nagios.cfg.
X+This tells nagios to run the "service-perf-data-handler" command to
X+process the performance data after each plugin has been executed. Then add
X+the following to the checkcommands.cfg-file (or whatever
X+nagios-config-file you find suitable):
X+
X ---
X ##
X ## PERF-DATA-HANDLER
X ##
X define command {
X command_name service-perf-data-handler
X- command_line /usr/local/nagios/nagiostat/nagiostat -p "$LASTCHECK$|!!|$HOSTNAME$|!!|$SERVICEDESC$|!!|$SERVICESTATE$|!!|$OUTPUT$|!!|$PERFDATA$"
X+ command_line /%%NAGIOSTATDIR%%/nagiostat -p "$LASTCHECK$|!!|$HOSTNAME$|!!|$SERVICEDESC$|!!|$SERVICESTATE$|!!|$OUTPUT$|!!|$PERFDATA$"
X }
X ---
X Alter the path to nagiostat to reflect where you installed the files in step 1.
X
X-6. To add a nifty icon to click on in the "service detail"-page in the nagios web interface, you
X-can add something like the following to the serviceextinfo.cfg-file:
X+6. To add a nifty icon to click on in the "service detail"-page in the
X+nagios web interface, you can add something like the following to the
X+serviceextinfo.cfg-file:
X+
X ---
X define serviceextinfo {
X host_name purjo.dacom.se
X service_description PING
X- notes_url /nagiostat/nagiostat.cgi?graph_name=purjo-ping
X+ notes_url /nagiostat.cgi?graph_name=purjo-ping
X icon_image graph.gif
X icon_image_alt View graphs
X }
X ---
X-Copy graph.gif to /usr/local/nagios/share/images/logos (or whichever directory your nagios-installation is in)
X+Copy graph.gif to /%%PREFIX%%/nagios/share/images/logos (or whichever
X+directory your nagios-installation is in)
X to get the little ugly graph-icon in the right place.
X
X
END-of-nagiostat/files/patch-README
exit
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list