aboutsummaryrefslogtreecommitdiff
path: root/sysutils/monitorix
diff options
context:
space:
mode:
authorOlli Hauer <ohauer@FreeBSD.org>2010-08-18 17:43:31 +0000
committerOlli Hauer <ohauer@FreeBSD.org>2010-08-18 17:43:31 +0000
commitf66d15ef053282a1df675c1d52d61b6b83d3d156 (patch)
tree4298b3a5f494fafe8d2a3ac6666069b5d94d2855 /sysutils/monitorix
parentccdce2424e0455426b7fa8c32358d14b9fed3ebe (diff)
downloadports-f66d15ef053282a1df675c1d52d61b6b83d3d156.tar.gz
ports-f66d15ef053282a1df675c1d52d61b6b83d3d156.zip
Notes
Diffstat (limited to 'sysutils/monitorix')
-rw-r--r--sysutils/monitorix/Makefile123
-rw-r--r--sysutils/monitorix/distinfo3
-rw-r--r--sysutils/monitorix/files/monitorix.in37
-rw-r--r--sysutils/monitorix/files/patch-monitorix.pl65
-rw-r--r--sysutils/monitorix/files/pkg-message.in16
-rw-r--r--sysutils/monitorix/pkg-descr8
-rw-r--r--sysutils/monitorix/pkg-plist58
7 files changed, 310 insertions, 0 deletions
diff --git a/sysutils/monitorix/Makefile b/sysutils/monitorix/Makefile
new file mode 100644
index 000000000000..dae8a7763f13
--- /dev/null
+++ b/sysutils/monitorix/Makefile
@@ -0,0 +1,123 @@
+# New ports collection makefile for: monitorix
+# Date created: 15 Aug 2010
+# Whom: Olli Hauer <ohauer@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= monitorix
+PORTVERSION= 1.5.1
+CATEGORIES= sysutils
+MASTER_SITES= http://monitorix.org/
+
+MAINTAINER= admin@mjbrune.org
+COMMENT= A web based monitoring system
+
+LIB_DEPENDS= rrd:${PORTSDIR}/databases/rrdtool
+BUILD_DEPENDS= ${SITE_PERL}/LWP/Parallel.pm:${PORTSDIR}/www/p5-ParallelUA
+
+LICENSE= GPLv2
+
+OPTIONS= REPORTS "Mail HTML reports to a given address" off
+
+.include <bsd.port.options.mk>
+
+MAN5= monitorix.conf.5
+MANCOMPRESSED= no
+NO_BUILD= yes
+
+CGIDIR?= ${PREFIX}/www/cgi-bin
+#REPORTS?= true
+# owner of $WWWROOT/imgs
+WWW_OWNER?= ${WWWOWN}
+WWW_GROUP?= ${WWWGRP}
+DATADIR= ${INSTDIR}
+REPORT_LANG= ca de en it
+INSTDIR= ${PREFIX}/${PORTNAME}
+# WWWROOT: (WWWDIR - portname), we need the resulting path for a variable in monitorix.conf
+WWWROOT= ${WWWDIR:S,${PORTNAME},,}
+
+SUB_FILES= pkg-message
+SUB_LIST= PERL=${PERL} INSTDIR=${INSTDIR}
+PLIST_SUB+= CGIDIR=${CGIDIR:S,${PREFIX}/,,} WWW_OWNER=${WWW_OWNER} WWW_GROUP=${WWW_GROUP}
+
+WWW_FILES= logo_top.png logo_bot.png monitorixico.png
+DOCS= COPYING Changes README README.FreeBSD README.nginx TODO \
+ monitorix-alert.sh monitorix-apache.conf
+REPORT_FILES= imgs_email/blank.png imgs_email/logo.jpg imgs_email/signature.png \
+ imgs_email/title.jpg traffic_report.html traffic_report.sh
+
+.if defined(WITH_REPORTS)
+RUN_DEPENDS+= metamail>=2.7:${PORTSDIR}/mail/metamail
+PLIST_SUB+= REPORTS=""
+.else
+PLIST_SUB+= REPORTS="@comment "
+.endif
+
+pre-everything::
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "You may set following options:"
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "DATADIR=${DATADIR} Where do you put RRD databases?"
+ @${ECHO_MSG} "CGIDIR=${CGIDIR} Where do you put cgi?"
+ @${ECHO_MSG} "WWWDIR=${WWWDIR} Where do you put httpd's document root?"
+ @${ECHO_MSG} ""
+
+post-patch:
+.for f in cgi conf pl
+ @${REINPLACE_CMD} -e "s|/usr/bin/perl|${PERL}|" ${WRKSRC}/monitorix.${f}
+.endfor
+# Notes about the adjustments for default configuration:
+# - set FreeBSD as OSTYPE
+# - set a generic WWWROOT, since we can include it in the webserver config
+# - milter-greylist use a new database path on FreeBSD
+# - FreeBSD's interface name came from the NIC, the lo0 interface is almost everytime present
+# - file/directory handling outside ${PREFIX} with ports is silly. We don't want to rewrite
+# monitorix.pl therefore we use ${PREFIX} instead /var/db/!
+ @${REINPLACE_CMD} -e 's|our \$$OSTYPE = \"Linux-RHFC\"|our \$$OSTYPE = \"FreeBSD\"|' \
+ -e "s|/usr/local/www/apache22/data|${WWWROOT}|" \
+ -e "s|/var/lib/milter-greylist/db/greylist.db|/var/milter-greylist/greylist.db|" \
+ -e "s|eth0|lo0|g" -e "s|/var/db/monitorix/|${INSTDIR}/|" \
+ -e "s|%%INSTDIR%%|${INSTDIR}|g" ${WRKSRC}/monitorix.conf
+.for d in ${REPORT_LANG}
+ @${REINPLACE_CMD} -e "s|^rm|${RM}|g" -e "s|/bin/sed|${SED}|g" \
+ -e "s|/usr/bin/metasend|${PREFIX}/bin/metasend|g" \
+ -e "s|\"tmp|\"/tmp/${PORTNAME}_report|g" ${WRKSRC}/reports/${d}/traffic_report.sh
+.endfor
+
+do-install:
+ @${INSTALL_SCRIPT} ${WRKSRC}/monitorix.pl ${PREFIX}/sbin/
+ @${MKDIR} ${WWWDIR}/imgs
+ @${CHOWN} ${WWW_OWNER}:${WWW_GROUP} ${WWWDIR}/imgs
+ @for f in ${WWW_FILES}; do \
+ ${INSTALL_DATA} ${WRKSRC}/$${f} ${WWWDIR}/; \
+ done
+ @${MKDIR} ${CGIDIR}
+ @${INSTALL_SCRIPT} ${WRKSRC}/monitorix.cgi ${CGIDIR}/
+.for m in ${MAN5}
+ @${INSTALL_MAN} ${WRKSRC}/man/man5/$m ${PREFIX}/man/man5/
+.endfor
+.if defined(WITH_REPORTS)
+. for l in ${REPORT_LANG}
+ @${MKDIR} ${PREFIX}/${PORTNAME}/reports/${l}/imgs_email
+. for f in ${REPORT_FILES}
+ @${INSTALL_DATA} ${WRKSRC}/reports/${l}/${f} ${PREFIX}/${PORTNAME}/reports/${l}/${f}
+. endfor
+. endfor
+.endif
+.if !defined(NOPORTDOCS)
+ @${MKDIR} ${DOCSDIR}
+ @for doc in ${DOCS}; do \
+ ${INSTALL_DATA} ${WRKSRC}/$${doc} ${DOCSDIR}; \
+ done
+.endif
+
+post-install:
+ @${INSTALL_DATA} ${WRKSRC}/monitorix.conf ${PREFIX}/etc/monitorix.conf.sample
+ @if [ ! -f ${PREFIX}/etc/monitorix.conf ]; then \
+ ${CP} -p ${PREFIX}/etc/monitorix.conf.sample ${PREFIX}/etc/monitorix.conf ; \
+ fi
+ @${MKDIR} ${DATADIR}/usage
+ @${CAT} ${PKGMESSAGE}
+
+.include <bsd.port.mk>
diff --git a/sysutils/monitorix/distinfo b/sysutils/monitorix/distinfo
new file mode 100644
index 000000000000..9fe8f44b64f0
--- /dev/null
+++ b/sysutils/monitorix/distinfo
@@ -0,0 +1,3 @@
+MD5 (monitorix-1.5.1.tar.gz) = 982f20acfac8d2b175d61a4e3defb641
+SHA256 (monitorix-1.5.1.tar.gz) = e3bb853209e6fc56a883b34ab3a0395d3db0a8c512d87b40b6420620b102252b
+SIZE (monitorix-1.5.1.tar.gz) = 141695
diff --git a/sysutils/monitorix/files/monitorix.in b/sysutils/monitorix/files/monitorix.in
new file mode 100644
index 000000000000..7548ad93fe26
--- /dev/null
+++ b/sysutils/monitorix/files/monitorix.in
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# @(#) Fibranet NSP, SL
+# Copyright (C) 2005-2010 by Jordi Sanfeliu <jordi@fibranet.cat>
+#
+# /usr/local/etc/rc.d/monitorix
+#
+# Starts Monitorix on FreeBSD systems
+#
+# PROVIDE: monitorix
+# REQUIRE: DAEMON
+# BEFORE: LOGIN
+# KEYWORD: FreeBSD shutdown
+
+monitorix_enable=${monitorix_enable:-"NO"}
+
+. /etc/rc.subr
+
+name="monitorix"
+rcvar=`set_rcvar`
+command_interpreter=%%PERL%%
+start_cmd=monitorix_start
+stop_cmd=monitorix_stop
+
+monitorix_start()
+{ # Creates RRDs files (if needed)
+ %%PREFIX%%/sbin/monitorix.pl create
+ %%PREFIX%%/sbin/monitorix.pl init
+}
+
+monitorix_stop()
+{
+ %%PREFIX%%/sbin/monitorix.pl stop
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/sysutils/monitorix/files/patch-monitorix.pl b/sysutils/monitorix/files/patch-monitorix.pl
new file mode 100644
index 000000000000..043203c7e468
--- /dev/null
+++ b/sysutils/monitorix/files/patch-monitorix.pl
@@ -0,0 +1,65 @@
+--- ./monitorix.pl.orig 2010-06-21 10:54:38.000000000 +0200
++++ ./monitorix.pl 2010-08-15 20:20:34.000000000 +0200
+@@ -733,20 +733,25 @@
+ if($ENABLE_CROND_MAIL ne "Y") {
+ $mailto = "MAILTO=\"\"";
+ }
+- open(OCRON, "> $O_CRON");
+- print OCRON <<EOF;
+-# @(#) Fibranet NSP, SL
+-# Copyright (C) 2005-2010 by Jordi Sanfeliu <jordi\@fibranet.cat>
+-#
+-PATH=/sbin:/bin:/usr/sbin:/usr/bin
+-$mailto
++# FreeBSD:
++# The crontab replacment was removed for the port,
++# we can not risc the damage of existing crontabs!
++ print <<EOF;
++ ===========================================================================
++ To prevent replacement of the root crontab this
++ function is disabled in the FreeBSD port!
+
+-* * * * * $crontabuser $PATH_BIN{$OSTYPE} update
+-00 00 * * * $crontabuser $PATH_BIN{$OSTYPE} collect
+-01 00 1 * * $crontabuser $PATH_BIN{$OSTYPE} report
++ Please place the following entries in the root crontab
++ or /etc/crontab manually!
++
++ $mailto
++ * * * * * $PATH_BIN{$OSTYPE} update
++ 00 00 * * * $PATH_BIN{$OSTYPE} collect
++ 01 00 1 * * $PATH_BIN{$OSTYPE} report
++
++ ===========================================================================
+
+ EOF
+- close(OCRON);
+
+ if($THEME_COLOR eq "black") {
+ $bgcolor = "#000000";
+@@ -1053,7 +1058,24 @@
+ unlink($PATH_CRON{$OSTYPE});
+ unlink($PATH_CRON{$OSTYPE} . ".sh"); # old name
+ } elsif($OSTYPE eq "FreeBSD") {
+- system("echo 'y' | crontab -u root -r");
++# FreeBSD:
++# The crontab replacment was removed for the port,
++# we can not risc the damage of existing crontabs!
++ print <<EOF;
++
++ ========================================================================
++ To prevent deletion of the root crontab this function has been disabled!
++
++ Please remove the following entries from the root crontab or from
++ /etc/crontab manually!
++
++ * * * * * $PATH_BIN{$OSTYPE} update
++ 00 00 * * * $PATH_BIN{$OSTYPE} collect
++ 01 00 1 * * $PATH_BIN{$OSTYPE} report
++
++ ========================================================================
++
++EOF
+ }
+ }
+
diff --git a/sysutils/monitorix/files/pkg-message.in b/sysutils/monitorix/files/pkg-message.in
new file mode 100644
index 000000000000..48423cc29068
--- /dev/null
+++ b/sysutils/monitorix/files/pkg-message.in
@@ -0,0 +1,16 @@
+================================================================
+
+ The port has a generic default config, please adjust your
+ settings in file: %%PREFIX%%/etc/monitorix.conf
+
+ To initialize monitorix follow this steps
+ %%PREFIX%%/sbin/monitorix.pl create
+
+ Then place the following entries into root crontab:
+ ---------------------------------------------------
+ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
+ * * * * * %%PREFIX%%/sbin/monitorix.pl update
+ 00 00 * * * %%PREFIX%%/sbin/monitorix.pl collect
+ 01 00 1 * * %%PREFIX%%/sbin/monitorix.pl report
+
+================================================================
diff --git a/sysutils/monitorix/pkg-descr b/sysutils/monitorix/pkg-descr
new file mode 100644
index 000000000000..f3d3fee44f21
--- /dev/null
+++ b/sysutils/monitorix/pkg-descr
@@ -0,0 +1,8 @@
+Monitorix is a free, open source, lightweight system monitoring tool
+designed to monitorize as many services as possible. At this time it
+monitors from the CPU load and temperatures to the users using the system.
+Network devices activity, network services demand and even the devices'
+interrupt activity are also monitored, and more. The current status of any
+corporate server with Monitorix installed can be accessed via a web browser.
+
+WWW: http://www.monitorix.org/
diff --git a/sysutils/monitorix/pkg-plist b/sysutils/monitorix/pkg-plist
new file mode 100644
index 000000000000..01e44d8d6e61
--- /dev/null
+++ b/sysutils/monitorix/pkg-plist
@@ -0,0 +1,58 @@
+@exec mkdir -p /var/db/monitorix/usage
+@exec mkdir -p %D/%%WWWDIR%%/imgs
+@exec chown %%WWW_OWNER%%:%%WWW_GROUP%% %D/%%WWWDIR%%/imgs
+@unexec if cmp -s %D/etc/monitorix.conf %D/etc/monitorix.conf.sample; then rm -f %D/etc/monitorix.conf; fi
+etc/monitorix.conf.sample
+@exec if [ ! -f %D/etc/monitorix.conf ]; then cp %B/%f %D/etc/monitorix.conf; fi
+sbin/monitorix.pl
+%%CGIDIR%%/monitorix.cgi
+@dirrmtry %%CGIDIR%%
+%%PORTDOCS%%%%DOCSDIR%%/COPYING
+%%PORTDOCS%%%%DOCSDIR%%/Changes
+%%PORTDOCS%%%%DOCSDIR%%/README
+%%PORTDOCS%%%%DOCSDIR%%/README.FreeBSD
+%%PORTDOCS%%%%DOCSDIR%%/README.nginx
+%%PORTDOCS%%%%DOCSDIR%%/TODO
+%%PORTDOCS%%%%DOCSDIR%%/monitorix-alert.sh
+%%PORTDOCS%%%%DOCSDIR%%/monitorix-apache.conf
+%%PORTDOCS%%@dirrm %%DOCSDIR%%
+%%REPORTS%%monitorix/reports/ca/imgs_email/blank.png
+%%REPORTS%%monitorix/reports/ca/imgs_email/logo.jpg
+%%REPORTS%%monitorix/reports/ca/imgs_email/signature.png
+%%REPORTS%%monitorix/reports/ca/imgs_email/title.jpg
+%%REPORTS%%monitorix/reports/ca/traffic_report.html
+%%REPORTS%%monitorix/reports/ca/traffic_report.sh
+%%REPORTS%%monitorix/reports/de/imgs_email/blank.png
+%%REPORTS%%monitorix/reports/de/imgs_email/logo.jpg
+%%REPORTS%%monitorix/reports/de/imgs_email/signature.png
+%%REPORTS%%monitorix/reports/de/imgs_email/title.jpg
+%%REPORTS%%monitorix/reports/de/traffic_report.html
+%%REPORTS%%monitorix/reports/de/traffic_report.sh
+%%REPORTS%%monitorix/reports/en/imgs_email/blank.png
+%%REPORTS%%monitorix/reports/en/imgs_email/logo.jpg
+%%REPORTS%%monitorix/reports/en/imgs_email/signature.png
+%%REPORTS%%monitorix/reports/en/imgs_email/title.jpg
+%%REPORTS%%monitorix/reports/en/traffic_report.html
+%%REPORTS%%monitorix/reports/en/traffic_report.sh
+%%REPORTS%%monitorix/reports/it/imgs_email/blank.png
+%%REPORTS%%monitorix/reports/it/imgs_email/logo.jpg
+%%REPORTS%%monitorix/reports/it/imgs_email/signature.png
+%%REPORTS%%monitorix/reports/it/imgs_email/title.jpg
+%%REPORTS%%monitorix/reports/it/traffic_report.html
+%%REPORTS%%monitorix/reports/it/traffic_report.sh
+%%REPORTS%%@dirrm monitorix/reports/it/imgs_email
+%%REPORTS%%@dirrm monitorix/reports/it
+%%REPORTS%%@dirrm monitorix/reports/en/imgs_email
+%%REPORTS%%@dirrm monitorix/reports/en
+%%REPORTS%%@dirrm monitorix/reports/de/imgs_email
+%%REPORTS%%@dirrm monitorix/reports/de
+%%REPORTS%%@dirrm monitorix/reports/ca/imgs_email
+%%REPORTS%%@dirrm monitorix/reports/ca
+%%REPORTS%%@dirrm monitorix/reports
+@dirrmtry monitorix/usage
+@dirrmtry monitorix
+%%WWWDIR%%/logo_bot.png
+%%WWWDIR%%/logo_top.png
+%%WWWDIR%%/monitorixico.png
+@dirrmtry %%WWWDIR%%/imgs
+@dirrmtry %%WWWDIR%%