mon/mon.spec
2010-04-21 11:30:10 +00:00

204 lines
6.2 KiB
RPMSpec

# 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) <lubo.rintel@gooddata.com> - 1.2.0-6
- Add missing dependencies (#584281)
- Fix path to libdir for 64-bits
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Fri Feb 20 2009 Lubomir Rintel (Good Data) <lubo.rintel@gooddata.com> - 1.2.0-3
- Remove AOL::TOC
- Add most of shipped monitors (GDC #581)
* Sun Jul 13 2008 Lubomir Rintel (Good Data) <lubo.rintel@gooddata.com> - 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 <dag@wieers.com> - 1.2.0-1 - 4303+/dries
- Updated to release 1.2.0.
* Tue Mar 06 2004 Dag Wieers <dag@wieers.com> - 0.99.2-1
- Fixed problems with perl-modules.
* Fri Jan 09 2004 Dag Wieers <dag@wieers.com> - 0.99.2-0
- Initial package. (using DAR)