# # spec file for package mon # # Original Copyright (c) 2004 SUSE LINUX AG, Nuernberg, Germany. # Modified to fit Mageia (c) 2018 # This file and all modifications and additions to the pristine # package are under the same license as the package itself. # %define perlvendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib) Name: mon Version: 1.2.0 Release: %mkrel 2 Summary: The mon network monitoring system License: GPL Group: System/Servers URL: https://sourceforge.net/projects/%{name} Source: https://sourceforge.net/projects/%{name}/files/%{name}/%{version}/%{name}-%{version}.tar.gz/download #Source1: https://sourceforge.net/projects/%{name}/files/%{name}-client/-%{version}/%{name}-client-%{version}.tar.gz/download Source1: %{name}-client-%{version}.tar.gz Source2: mon.service Source3: %{name}-contrib-1.0.tar.gz Patch1: Makefile.patch Requires: perl Requires: perl(Time::Period) Requires: perl(Time::HiRes) Requires: perl(Getopt::Long) Requires: perl(Sys::Syslog) Requires: perl(Sys::Hostname) Requires: perl(Text::ParseWords) Requires: perl(Data::Dumper) Requires: perl(Socket) Requires: perl(POSIX) Requires: perl-Convert-BER Requires: fping Requires: perl-libwww-perl BuildArch: noarch BuildRequires: make #BuildRequires: autoconf #BuildRequires: automake #BuildRequires: gcc #BuildRequires: libtool BuildRequires: perl %description "mon" is a tool for monitoring the availability of services. Services may be network-related, environmental conditions, or nearly anything that can be tested with software. It is extremely useful for system administrators, but not limited to use by them. It was designed to be a general-purpose problem alerting system, separating the tasks of testing services for availability and sending alerts when things fail. To achieve this, "mon" is implemented as a scheduler which runs the programs which do the testing, and triggering alert programs when these scripts detect failure. None of the actual service testing or reporting is actually handled by "mon". These functions are handled by auxillary programs. %prep ################################################################### %setup -q %setup -T -D -a 1 %autopatch -p1 tar xvfz %{SOURCE3} ################################################################### %build #cd mon.d #%make_build cd %{name}-client-%{version} %{__perl} Makefile.PL %{__make} ################################################################### %install rm -rf %{buildroot} mkdir -p %{buildroot}/%{_libdir}/%{name}/alert.d mkdir -p %{buildroot}/%{_libdir}/%{name}/mon.d mkdir -p %{buildroot}/%{_libdir}/%{name}/utils mkdir -p %{buildroot}/%{_sbindir} mkdir -p %{buildroot}/%{_mandir}/man1 mkdir -p %{buildroot}/%{_localstatedir}/lib/%{name} mkdir -p %{buildroot}/%{_sysconfdir}/%{name} #mkdir -p %{buildroot}/%{_sysconfdir}/init.d mkdir -p ./examples cp mon %{buildroot}/%{_sbindir}/ cp -a ./alert.d/ %{buildroot}/%{_libdir}/%{name}/ cp ./clients/moncmd %{buildroot}/%{_sbindir}/moncmd cp ./clients/monshow %{buildroot}/%{_sbindir}/monshow cp -a ./doc/*.1 %{buildroot}/%{_mandir}/man1/ mv ./etc/very-simple.cf %{buildroot}/%{_sysconfdir}/%{name}/mon.cf mv ./etc/auth.cf %{buildroot}/%{_sysconfdir}/%{name} #mv ./etc/S99mon %{buildroot}/%{_sysconfdir}/init.d/%{name} cp -a ./etc/* ./examples cp -a ./mon.d/*.monitor %{buildroot}/%{_libdir}/%{name}/mon.d/ cp -a ./utils/ %{buildroot}/%{_libdir}/%{name}/ #ln -sf ../etc/init.d/mon %{buildroot}/%{_sbindir}/rcmon install -m 0644 %{SOURCE2} -D %{buildroot}/%{_unitdir}/%{name}.service (cd mon-client-%{version} && DESTDIR=%{buildroot} %{make_install}) # Install most contribs as well mv %{name}-contrib-1.0/alerts/sms/sms.alert %{name}-contrib-1.0/alerts/sms/sms-gnokii.alert mv %{name}-contrib-1.0/monitors/diskspace/netsnmp-freespace/netsnmp-freespace.monitor %{name}-contrib-1.0/monitors/diskspace/netsnmp-freespace/netsnmp-diskspace.monitor mv %{name}-contrib-1.0/monitors/diskspace/netsnmp-freespace/netsnmp-freespace.monitor.README %{name}-contrib-1.0/monitors/diskspace/netsnmp-freespace/netsnmp-diskspace.monitor.README cp -a `find %{name}-contrib-1.0/alerts -name '*.alert'` %{buildroot}/%{_libdir}/%{name}/alert.d cp -a `find %{name}-contrib-1.0/alerts -name '*.README'` %{buildroot}/%{_libdir}/%{name}/alert.d cp -a `find %{name}-contrib-1.0/monitors -name '*.monitor'` %{buildroot}/%{_libdir}/%{name}/mon.d cp -a `find %{name}-contrib-1.0/monitors -name '*.README'` %{buildroot}/%{_libdir}/%{name}/mon.d cd .. # clean up after perl module install - remove special files find %{buildroot} -name "perllocal.pod" -o -name ".packlist" -o -name "*.bs" |xargs -i rm -f {} ################################################################### %files %doc %{_mandir}/man1/mon*.1* %doc %{_mandir}/man3/Mon::* %doc CHANGES COPYING COPYRIGHT CREDITS INSTALL KNOWN-PROBLEMS README %doc TODO VERSION %doc doc/README.* %doc doc/globals %doc examples %config(noreplace) %{_sysconfdir}/%{name}/* %{_libdir}/%{name} %{_sbindir}/* %{_localstatedir}/lib/%{name} %{perlvendorlib}/* %{_unitdir}/%{name}.service ################################################################### %post if [ -d %{_localstatedir}/log -a ! -f %{_localstatedir}/log/mon_history.log ]; then touch %{_localstatedir}/log/mon_history.log fi systemctl --quiet enable %{name} %postun if [ _"$1" = _"0" ]; then if [ -f %{_localstatedir}/log/mon_history.log ]; then rm -f %{_localstatedir}/log/mon_history.log fi fi %_preun_service %{name} %_post_service %{name} %changelog * Sun Nov 18 2018 bcornec <bcornec> 1.2.0-2.mga7 + Revision: 1331230 - adds mon-contrib alerts and monitors tomon package + tv <tv> - description != AUTHORS * Mon Oct 08 2018 bcornec <bcornec> 1.2.0-1.mga7 + Revision: 1318598 - fix Group and copyright - Transform mon to use systemd - Import mon - Created package structure for mon.