diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index e69de29..0000000 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4497076 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +all-alerts.tar.bz2 +mon-1.2.0.tar.bz2 +mon.cgi-1.52.tar.bz2 diff --git a/Makefile b/Makefile deleted file mode 100644 index ee5e152..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: mon -# $Id$ -NAME := mon -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attept a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/mon-1.2.0-perl.patch b/mon-1.2.0-perl.patch new file mode 100644 index 0000000..c84473c --- /dev/null +++ b/mon-1.2.0-perl.patch @@ -0,0 +1,20 @@ +Originally, a perl scriptlet in Dag's SPEC did this. + +diff -rup mon-1.2.0.orig/alerts/hpov/hpov.alert mon-1.2.0/alerts/hpov/hpov.alert +--- mon-1.2.0.orig/alerts/hpov/hpov.alert 2001-05-23 03:27:54.000000000 +0200 ++++ mon-1.2.0/alerts/hpov/hpov.alert 2008-07-13 12:48:53.000000000 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/perl ++#!/usr/bin/perl + # + # hpov.alert - generate event in HP OpenView + # +diff -rup mon-1.2.0.orig/mon.cgi-1.52/util/moncgi-appsecret.pl mon-1.2.0/mon.cgi-1.52/util/moncgi-appsecret.pl +--- mon-1.2.0.orig/mon.cgi-1.52/util/moncgi-appsecret.pl 2001-04-19 01:13:56.000000000 +0200 ++++ mon-1.2.0/mon.cgi-1.52/util/moncgi-appsecret.pl 2008-07-13 12:48:53.000000000 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/perl -w ++#!/usr/bin/perl -w + # + # NAME + # moncgi-appsecret.pl diff --git a/mon-1.2.0-uucp.patch b/mon-1.2.0-uucp.patch new file mode 100644 index 0000000..7dcbebb --- /dev/null +++ b/mon-1.2.0-uucp.patch @@ -0,0 +1,11 @@ +Originally, a perl scriptlet in Dag's SPEC did this. + +diff -rup mon-1.2.0.orig/mon.d/Makefile mon-1.2.0/mon.d/Makefile +--- mon-1.2.0.orig/mon.d/Makefile 2004-06-09 07:18:05.000000000 +0200 ++++ mon-1.2.0/mon.d/Makefile 2008-07-13 12:44:50.000000000 +0200 +@@ -31,4 +31,4 @@ + install: + install -d $(MONPATH)/mon.d + install rpc.monitor $(MONPATH)/mon.d/ +- install -g uucp -m 02555 dialin.monitor.wrap $(MONPATH)/mon.d/ ++ install -m 02555 dialin.monitor.wrap $(MONPATH)/mon.d/ diff --git a/mon.cf b/mon.cf new file mode 100644 index 0000000..58d8b66 --- /dev/null +++ b/mon.cf @@ -0,0 +1,51 @@ +### Extremely basic mon.cf file + +### global options +cfbasedir = /etc/mon +pidfile = /var/run/mon.pid +statedir = /var/lib/mon/state.d +logdir = /var/lib/mon/log.d +dtlogfile = /var/lib/mon/log.d/downtime.log +alertdir = /usr/lib/mon/alert.d +mondir = /usr/lib/mon/mon.d +maxprocs = 20 +histlength = 100 +randstart = 60s +authtype = pam +userfile = /etc/mon/userfile + +### group definitions (hostnames or IP addresses) +hostgroup servers localhost + +watch servers + service ping + interval 5m + monitor ping.monitor + period wd {Mon-Fri} hr {7am-10pm} + alert mail.alert root@localhost + alertevery 1h + period wd {Sat-Sun} + alert mail.alert root@localhost + service telnet + interval 10m + monitor telnet.monitor + period wd {Mon-Fri} hr {7am-10pm} + alertevery 1h + alertafter 2 30m + alert mail.alert root@localhost + service http + interval 4m + monitor http.monitor + allow_empty_group + period wd {Sun-Sat} + upalert mail.alert -S "web server is back up" mis + alertevery 45m + service smtp + interval 10m + monitor smtp.monitor + period wd {Mon-Fri} hr {7am-10pm} + alertevery 1h + alertafter 2 30m + alert qpage.alert mis-pagers@domain.com + +### See /usr/share/doc for the original example... diff --git a/mon.init b/mon.init new file mode 100644 index 0000000..ec53765 --- /dev/null +++ b/mon.init @@ -0,0 +1,82 @@ +#!/bin/bash +# +# Init file for Mon System Monitoring daemon +# +# Written by Dag Wieers . +# +# chkconfig: - 99 10 +# description: Mon System Monitoring daemon +# +# processname: mon +# config: /etc/mon/mon.conf +# config: /etc/mon/auth.conf +# pidfile: /var/run/mon.pid + +source /etc/rc.d/init.d/functions + +[ -x /usr/bin/mon ] || exit 1 +[ -r /etc/mon/mon.cf ] || exit 1 +[ -r /etc/mon/auth.cf ] || exit 1 + +RETVAL=0 +prog="mon" +desc="System Monitoring daemon" + +start() { + echo -n $"Starting $desc ($prog): " + daemon $prog -f -c /etc/mon/mon.cf + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog + return $RETVAL +} + +stop() { + echo -n $"Shutting down $desc ($prog): " + killproc $prog + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog + return $RETVAL +} + +restart() { + stop + start +} + +reload() { + echo -n $"Reloading $desc ($prog): " + killproc $prog -HUP + RETVAL=$? + echo + return $RETVAL +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + restart + ;; + reload) + reload + ;; + condrestart) + [ -e /var/lock/subsys/$prog ] && restart + RETVAL=$? + ;; + status) + status $prog + RETVAL=$? + ;; + *) + echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}" + RETVAL=1 +esac + +exit $RETVAL diff --git a/mon.spec b/mon.spec new file mode 100644 index 0000000..e83f4d1 --- /dev/null +++ b/mon.spec @@ -0,0 +1,204 @@ +# TODO: Split monitors and alerts into subpackages +# they drag in way too much dependencies + +%global moncgi_version 1.52 +%global fixlib sed 's,/usr/lib,%{_libdir},g' + +Name: mon +Summary: General-purpose resource monitoring system +Version: 1.2.0 +Release: 6%{?dist} +License: GPLv2+ +Group: Applications/Internet +URL: http://www.kernel.org/software/mon/ + +Source0: ftp://ftp.kernel.org/pub/software/admin/mon/mon-%{version}.tar.bz2 +Source1: ftp://ftp.kernel.org/pub/software/admin/mon/contrib/cgi-bin/mon.cgi/mon.cgi-%{moncgi_version}.tar.bz2 +Source2: ftp://ftp.kernel.org/pub/software/admin/mon/contrib/all-alerts.tar.bz2 + +Source3: mon.cf +Source4: mon.init +Source5: userfile + +Patch0: mon-1.2.0-perl.patch +Patch1: mon-1.2.0-uucp.patch + +Requires: perl(Authen::PAM) +Requires: iputils +Requires: fping +Requires: traceroute + +BuildRequires: dos2unix +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + + +%description +Mon is a general-purpose resource monitoring system. It can be used +to monitor network service availability, server problems, +environmental conditions (i.e., the temperature in a room) or other +things. Mon can be used to test the condition and/or to trigger an +action upon failure of the condition. Mon keeps the testing and +action-taking tasks as separate, stand-alone programs. + +Mon is very extensible. Monitors and alerts are not a part of mon, but +the distribution comes with a handful of them to get you started. This +means that if a new service needs monitoring, or if a new alert is +required, the mon server will not need to be changed. + + +%prep +%setup -q -a 1 -a 2 +%patch0 -p1 +%patch1 -p1 + +# Filter out unwanted requires +cat << \EOF > %{name}-req +#!/bin/sh +%{__perl_requires} $* |\ +sed -e ' + /perl(Math::TrulyRandom)/d + /perl(Net::hostent)/d +' +EOF + +%define __perl_requires %{_builddir}/%{name}-%{version}/%{name}-req +chmod +x %{__perl_requires} + + +%build +for F in CHANGES doc/README.syslog.monitor +do + iconv -f ISO-8859-1 -t UTF-8 $F >tmp + touch --reference $F tmp + mv tmp $F +done + +dos2unix -q -k alerts/sms/sms.alert + +make %{?_smp_mflags} -C mon.d \ + CFLAGS="%{optflags} -DUSE_VENDOR_CF_PATH=1" + + +%install +rm -rf $RPM_BUILD_ROOT +install -d -m0755 $RPM_BUILD_ROOT%{_bindir} \ + $RPM_BUILD_ROOT%{_mandir}/man{1,8}/ \ + $RPM_BUILD_ROOT%{_libdir}/mon/{alert.d,mon.d}/ \ + $RPM_BUILD_ROOT%{_sysconfdir}/mon/ \ + $RPM_BUILD_ROOT%{_initrddir} \ + $RPM_BUILD_ROOT%{_localstatedir}/www/cgi-bin/ \ + $RPM_BUILD_ROOT%{_localstatedir}/lib/mon/{log.d,state.d}/ + +install -p -m0755 mon clients/moncmd clients/monshow clients/skymon/skymon $RPM_BUILD_ROOT%{_bindir} +install -p -m0644 doc/*.1 $RPM_BUILD_ROOT%{_mandir}/man1/ +install -p -m0644 doc/*.8 $RPM_BUILD_ROOT%{_mandir}/man8/ + +install -p -m0755 mon.d/*.wrap mon.d/*.monitor $RPM_BUILD_ROOT%{_libdir}/mon/mon.d/ +install -p -m0755 alert.d/* $RPM_BUILD_ROOT%{_libdir}/mon/alert.d/ +install -p -m0755 alerts/*/*.alert $RPM_BUILD_ROOT%{_libdir}/mon/alert.d/ + +install -d $RPM_BUILD_ROOT%{_sysconfdir}/mon +%{fixlib} etc/auth.cf >$RPM_BUILD_ROOT%{_sysconfdir}/mon/auth.cf +%{fixlib} %{SOURCE3} >$RPM_BUILD_ROOT%{_sysconfdir}/mon/mon.cf +install -Dp -m0755 %{SOURCE4} $RPM_BUILD_ROOT%{_initrddir}/mon +install -Dp -m0600 %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/mon/userfile + +install -Dp -m0755 mon.cgi-%{moncgi_version}/mon.cgi $RPM_BUILD_ROOT%{_localstatedir}/www/cgi-bin/mon.cgi + +# Fix permissions in examples documentation files +chmod -x mon.cgi-1.52/mon.cgi \ + clients/skymon/skymon \ + mon.cgi-1.52/util/moncgi-appsecret.pl \ + doc/README.snmpdiskspace.monitor \ + utils/cf-to-hosts \ + clients/batch-example \ + utils/syslog.monitor + +# Fix library path in examples +%{fixlib} -i etc/*.cf + + + +%clean +rm -rf $RPM_BUILD_ROOT + + +%post +/sbin/chkconfig --add mon + + +%preun +if [ $1 -eq 0 ]; then + /sbin/service mon stop &>/dev/null || : + /sbin/chkconfig --del mon +fi + + +%postun +/sbin/service mon condrestart &>/dev/null || : + + +%files +%defattr(-, root, root, -) +%doc CHANGES COPYING COPYRIGHT CREDITS README TODO doc/README.* +%doc KNOWN-PROBLEMS utils/ VERSION +%doc alerts/*/*.README mon.cgi-1.52/ +%doc clients/{skymon,batch-example} etc/*.cf etc/example.m4 etc/example.monshowrc +%config(noreplace) %{_sysconfdir}/mon/ +%{_initrddir}/* +%{_mandir}/man?/* +%{_localstatedir}/www/cgi-bin/mon.cgi +%{_bindir}/* +%{_localstatedir}/lib/mon/ +%dir %{_libdir}/mon +%{_libdir}/mon/alert.d +%dir %{_libdir}/mon/mon.d +%{_libdir}/mon/mon.d/*.monitor +%attr(2755, root, uucp) %{_libdir}/mon/mon.d/dialin.monitor.wrap + +# These packages are not in EPEL +%if 0%{?rhel} <= 5 +# perl(Expect) +%exclude %{_libdir}/mon/mon.d/dialin.monitor +# perl(Authen::Radius) +%exclude %{_libdir}/mon/mon.d/radius.monitor +%endif + +# These are not in Fedora either +# perl(AOL::TOC) +%exclude %{_libdir}/mon/alert.d/aim.alert +# perl(Filesys::DiskSpace) +%exclude %{_libdir}/mon/mon.d/freespace.monitor + + +%changelog +* Wed Apr 21 2010 Lubomir Rintel (GoodData) - 1.2.0-6 +- Add missing dependencies (#584281) +- Fix path to libdir for 64-bits + +* Sat Jul 25 2009 Fedora Release Engineering - 1.2.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed Feb 25 2009 Fedora Release Engineering - 1.2.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Fri Feb 20 2009 Lubomir Rintel (Good Data) - 1.2.0-3 +- Remove AOL::TOC +- Add most of shipped monitors (GDC #581) + +* Sun Jul 13 2008 Lubomir Rintel (Good Data) - 1.2.0-2 +- Refactor a bit, to fit Fedora customs and guidelines +- Fix use of optflags +- Fix file encodings +- Do not start service by default +- Remove unneeded requires +- Fix file modes + +* Wed Jun 27 2007 Dag Wieers - 1.2.0-1 - 4303+/dries +- Updated to release 1.2.0. + +* Tue Mar 06 2004 Dag Wieers - 0.99.2-1 +- Fixed problems with perl-modules. + +* Fri Jan 09 2004 Dag Wieers - 0.99.2-0 +- Initial package. (using DAR) diff --git a/sources b/sources index e69de29..10de733 100644 --- a/sources +++ b/sources @@ -0,0 +1,3 @@ +73631aa8d71beaf2dc5d655785cc5063 all-alerts.tar.bz2 +ed52e4d4c6bbe8bca72f2a7843c0bcea mon-1.2.0.tar.bz2 +0bfe8402b83679307ce50d0dfc56bd45 mon.cgi-1.52.tar.bz2 diff --git a/userfile b/userfile new file mode 100644 index 0000000..698b3d8 --- /dev/null +++ b/userfile @@ -0,0 +1 @@ +# user: passwd