SHA256
1
0
forked from pool/munin
munin/munin.spec

450 lines
16 KiB
RPMSpec

#
# spec file for package munin
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define htmldir /srv/www/htdocs/munin
%define cgidir /srv/www/cgi-bin
%define dbdir /var/lib/munin
%define logdir /var/log/munin
%define plugindir /usr/lib/munin/plugins
%define active_by_default 0
Name: munin
Version: 2.0.25
Release: 0
Summary: Network-wide graphing framework (grapher/gatherer)
License: GPL-2.0
Group: System/Monitoring
Url: http://munin-monitoring.org/
Source0: http://heanet.dl.sourceforge.net/sourceforge/%{name}/%{name}-%{version}.tar.gz
Source1: Makefile.config
Source2: munin-node.rc
Source3: munin.cron.d
Source4: munin.logrotate
Source5: munin-node.logrotate
Source7: plugins.conf
Source8: munin-node.tmpfiles
Source9: munin-node.service
Source10: munin-cgi-graph.service
Source11: munin-cgi-html.service
# https://github.com/ifad/nginx-munin/archive/master.zip
Source12: nginx-munin.zip
# https://github.com/ifad/gsa-munin/archive/master.zip
Source13: gsa-munin.zip
# https://svn.koumbit.net/koumbit/trunk/munin-plugins/quota-usage
Patch: munin-plugin-quota_usage_warnings.patch
Patch2: mysql55.patch
BuildRequires: html2text
BuildRequires: perl-HTML-Template
BuildRequires: perl-Log-Log4perl
BuildRequires: perl-Net-SNMP
BuildRequires: perl-Net-SSLeay
BuildRequires: perl-Net-Server
BuildRequires: pwdutils
BuildRequires: unzip
BuildRequires: perl(Module::Build)
%if 0%{?suse_version} >= 1220
%{?systemd_requires}
BuildRequires: htmldoc
BuildRequires: systemd
%else
BuildRequires: sysvinit
Requires(pre): %insserv_prereq
%endif
Requires: perl-Date-Manip
Requires: perl-FastCGI
Requires: perl-File-Copy-Recursive
Requires: perl-HTML-Template
Requires: perl-IO-Socket-INET6
Requires: perl-Log-Log4perl
Requires: perl-Net-SNMP
Requires: perl-Net-SSLeay
Requires: perl-Net-Server
Requires: perl-URI
Requires: perl-base = %{perl_version}
Requires: pwdutils
Requires: rrdtool
Requires: spawn-fcgi
Requires: perl(Munin::Common::Defaults)
Recommends: logrotate cron
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%description
Munin is a highly flexible and powerful solution used to create graphs of
virtually everything imaginable throughout your network, while still
maintaining a rattling ease of installation and configuration.
This package contains the grapher/gatherer. You will only need one instance of
it in your network. It will periodically poll all the nodes in your network
it's aware of for data, which it in turn will use to create graphs and HTML
pages, suitable for viewing with your graphical web browser of choice.
Munin is written in Perl, and relies heavily on Tobi Oetiker's excellent
RRDtool.
%package node
Summary: Network-wide graphing framework (node)
Group: System/Monitoring
# some scripts need logtail which is part of package logdigest in openSUSE
# problem with logdigest is that it installs a cronjob for itself which
# might be unwanted
Recommends: logdigest
Requires: perl-HTML-Template
Requires: perl-Log-Log4perl
Requires: perl-Net-SNMP
Requires: perl-Net-SSLeay
Requires: perl-Net-Server
Requires: perl-base = %{perl_version}
Requires: perl-libwww-perl
Requires: ps
Requires: pwdutils
Requires: sysstat
%if 0%{?suse_version} >= 1220
%{?systemd_requires}
%else
Requires(pre): %insserv_prereq
%endif
Recommends: logrotate
BuildArch: noarch
%description node
Munin is a highly flexible and powerful solution used to create graphs of
virtually everything imaginable throughout your network, while still
maintaining a rattling ease of installation and configuration.
This package contains node software. You should install it on all the nodes
in your network. It will know how to extract all sorts of data from the
node it runs on, and will wait for the gatherer to request this data for
further processing.
It includes a range of plugins capable of extracting common values such as
cpu usage, network usage, load average, and so on. Creating your own plugins
which are capable of extracting other system-specific values is very easy,
and is often done in a matter of minutes. You can also create plugins which
relay information from other devices in your network that can't run Munin,
such as a switch or a server running another operating system, by using
SNMP or similar technology.
Munin is written in Perl, and relies heavily on Tobi Oetiker's excellent
RRDtool. To see a real example of Munin in action, take a peek at
<http://www.linpro.no/projects/munin/example/>.
%prep
%setup -q
cp %{SOURCE1} .
unzip %{SOURCE12}
unzip %{SOURCE13}
%patch
%patch2 -p1
%build
%__make HOSTNAME=yourhostname
%install
%makeinstall
%__mkdir_p %{buildroot}/%{_sysconfdir}/munin/plugins
%__mkdir_p %{buildroot}/%{_sysconfdir}/munin/munin-conf.d
%__mkdir_p %{buildroot}/%{_sysconfdir}/cron.d
%__install -m0644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/cron.d/munin
%__mkdir_p %{buildroot}/etc/logrotate.d
%__install -m0644 %{SOURCE4} %{buildroot}/%{_sysconfdir}/logrotate.d/munin
%__install -m0644 %{SOURCE5} %{buildroot}/%{_sysconfdir}/logrotate.d/munin-node
%__install -m0644 %{SOURCE7} %{buildroot}/%{_sysconfdir}/munin/plugin-conf.d/munin-node
%__mkdir_p %{buildroot}/sbin
%if 0%{?suse_version} < 1220
%__mkdir_p %{buildroot}/%{_sysconfdir}/init.d
%__install -m0755 %{SOURCE2} %{buildroot}/%{_sysconfdir}/init.d/munin-node
%__ln_s %{_sysconfdir}/init.d/munin-node $RPM_BUILD_ROOT/sbin/rcmunin-node
%else
%__ln_s /sbin/service $RPM_BUILD_ROOT/sbin/rcmunin-node
%endif
%if 0%{?suse_version} >= 1220
%__mkdir_p %{buildroot}/%{_prefix}/lib/tmpfiles.d
%__install -m0644 %{SOURCE8} %{buildroot}/%{_prefix}/lib/tmpfiles.d/munin.conf
%__install -m0644 %{SOURCE8} %{buildroot}/%{_prefix}/lib/tmpfiles.d/munin-node.conf
%__mkdir_p %{buildroot}/%{_unitdir}
%__install -m0644 %{SOURCE9} %{buildroot}/%{_unitdir}/munin-node.service
%__install -m0644 %{SOURCE10} %{buildroot}/%{_unitdir}/munin-cgi-graph.service
%__install -m0644 %{SOURCE11} %{buildroot}/%{_unitdir}/munin-cgi-html.service
%endif
%__mkdir_p %{buildroot}/%{logdir}
%__mkdir_p %{buildroot}/%{htmldir}
%__mkdir_p %{buildroot}/%{dbdir}
%__mkdir_p %{buildroot}/%{dbdir}/plugin-state
%__install -m0755 nginx-munin-master/nginx_* %{buildroot}/%{plugindir}
ln nginx-munin-master/README.org README.nginx
%__install -m0755 munin-gsa-master/snmp_* %{buildroot}/%{plugindir}
ln munin-gsa-master/README.md README.gsa
%clean
%{__rm} -rf %{buildroot}
%pre
getent group munin >/dev/null || /usr/sbin/groupadd -r munin
getent passwd munin > /dev/null || /usr/sbin/useradd -r -c "munin monitoring" -d %{dbdir} -g munin munin
%if 0%{?suse_version} >= 1220
%service_add_pre munin-cgi-graph.service
%service_add_pre munin-cgi-html.service
%endif
%post
chown -R munin:munin %{htmldir}
chown -R munin:munin %{dbdir}
chmod 755 %{dbdir}
touch %{logdir}/munin-graph.log %{logdir}/munin-html.log %{logdir}/munin-nagios.log %{logdir}/munin-limits.log %{logdir}/munin-update.log
chown munin:munin %{logdir}/*
chown root:root %{logdir}/munin-node.log* >/dev/null 2>&1 || true
%if 0%{?suse_version} >= 1220
systemd-tmpfiles --create /usr/lib/tmpfiles.d/munin.conf
%service_add_post munin-cgi-graph.service
%service_add_post munin-cgi-html.service
%endif
%preun
%if 0%{?suse_version} >= 1220
%service_del_preun munin-cgi-graph.service
%service_del_preun munin-cgi-html.service
%endif
%postun
%if 0%{?suse_version} >= 1220
%service_del_postun munin-cgi-graph.service
%service_del_postun munin-cgi-html.service
%endif
## Node
%pre node
getent group munin >/dev/null || /usr/sbin/groupadd -r munin
getent passwd munin > /dev/null || /usr/sbin/useradd -r -c "munin monitoring" -d %{dbdir} -g munin munin
%if 0%{?suse_version} >= 1220
%service_add_pre munin-node.service
%endif
%post node
if [ $1 = 1 ]; then
/usr/sbin/munin-node-configure --shell | sh
fi
%if 0%{?suse_version} < 1220
%fillup_and_insserv -f -y munin-node
%endif
chown -R munin:munin %{dbdir}
chmod 755 %{dbdir}
touch %{logdir}/munin-node.log
chown munin:munin %{logdir}/*
chown root:root %{logdir}/munin-node.log*
chown -R nobody:nobody %{dbdir}/plugin-state/* >/dev/null 2>&1
%if 0%{?active_by_default} > 0
%if 0%{?suse_version} >= 1220
systemd-tmpfiles --create /usr/lib/tmpfiles.d/munin-node.conf
%service_add_post munin-node.service
%else
/etc/init.d/munin-node status >/dev/null 2>&1 || /etc/init.d/munin-node start
%endif
%endif
%preun node
%if 0%{?suse_version} >= 1220
%service_del_preun munin-node.service
%else
%stop_on_removal munin-node
%endif
%postun node
%if 0%{?suse_version} >= 1220
%service_del_postun munin-node.service
%else
%restart_on_update munin-node
%{insserv_cleanup}
%endif
%files
%defattr(-, root, root)
%doc ChangeLog COPYING README UPGRADING
%{_bindir}/munin-check
%{_bindir}/munin-cron
%{_bindir}/munindoc
%dir %{_prefix}/lib/munin
%{_prefix}/lib/munin/munin-graph
%{_prefix}/lib/munin/munin-html
%{_prefix}/lib/munin/munin-datafile2storable
%{_prefix}/lib/munin/munin-storable2datafile
%{_prefix}/lib/munin/munin-limits
%{_prefix}/lib/munin/munin-update
%{_prefix}/lib/munin/DejaVuSans.ttf
%{_prefix}/lib/munin/DejaVuSansMono.ttf
%{cgidir}/munin-cgi-graph
%{cgidir}/munin-cgi-html
%if 0%{?suse_version} >= 1220
%{_prefix}/lib/tmpfiles.d/munin.conf
%{_unitdir}/munin-cgi-graph.service
%{_unitdir}/munin-cgi-html.service
%endif
%attr(0755, munin, munin) %dir %{htmldir}
%attr(0444, munin, munin) %{htmldir}/.htaccess
%dir %{_sysconfdir}/munin
%dir %{_sysconfdir}/munin/munin-conf.d
%dir %{_sysconfdir}/munin/templates
%dir %{_sysconfdir}/munin/static
%config %{_sysconfdir}/munin/templates/*
%config %{_sysconfdir}/munin/static/*
%config %{_sysconfdir}/cron.d/munin
%config(noreplace) %{_sysconfdir}/munin/munin.conf
%config %{_sysconfdir}/logrotate.d/munin
%dir %{perl_vendorlib}/Munin
%dir %{perl_vendorlib}/Munin/Master
%{perl_vendorlib}/Munin/Master/Config.pm
%{perl_vendorlib}/Munin/Master/GraphOld.pm
%{perl_vendorlib}/Munin/Master/Group.pm
%{perl_vendorlib}/Munin/Master/GroupRepository.pm
%{perl_vendorlib}/Munin/Master/HTMLConfig.pm
%{perl_vendorlib}/Munin/Master/HTMLOld.pm
%{perl_vendorlib}/Munin/Master/Host.pm
%{perl_vendorlib}/Munin/Master/LimitsOld.pm
%{perl_vendorlib}/Munin/Master/Logger.pm
%{perl_vendorlib}/Munin/Master/Node.pm
%{perl_vendorlib}/Munin/Master/ProcessManager.pm
%{perl_vendorlib}/Munin/Master/Update.pm
%{perl_vendorlib}/Munin/Master/UpdateWorker.pm
%{perl_vendorlib}/Munin/Master/Utils.pm
%{perl_vendorlib}/Munin/Master/Worker.pm
%{_mandir}/man3/Munin::Master::Config.3pm.gz
%{_mandir}/man3/Munin::Master::Group.3pm.gz
%{_mandir}/man3/Munin::Master::GroupRepository.3pm.gz
%{_mandir}/man3/Munin::Master::HTMLOld.3pm.gz
%{_mandir}/man3/Munin::Master::Host.3pm.gz
%{_mandir}/man3/Munin::Master::LimitsOld.3pm.gz
%{_mandir}/man3/Munin::Master::Logger.3pm.gz
%{_mandir}/man3/Munin::Master::Node.3pm.gz
%{_mandir}/man3/Munin::Master::ProcessManager.3pm.gz
%{_mandir}/man3/Munin::Master::Update.3pm.gz
%{_mandir}/man3/Munin::Master::UpdateWorker.3pm.gz
%{_mandir}/man3/Munin::Master::Utils.3pm.gz
%{_mandir}/man3/Munin::Master::Worker.3pm.gz
%{_mandir}/man5/munin-node.conf.5.gz
%{_mandir}/man5/munin.conf.5.gz
%{_mandir}/man8/munin-check.8.gz
%{_mandir}/man8/munin-cron.8.gz
%{_mandir}/man8/munin-graph.8.gz
%{_mandir}/man8/munin-html.8.gz
%{_mandir}/man8/munin-limits.8.gz
%{_mandir}/man8/munin-update.8.gz
%{_mandir}/man8/munin.8.gz
%attr(0750, munin, munin) %dir %{logdir}
%attr(0755, munin, munin) %dir %{dbdir}
%files node
%defattr(-, root, root)
%doc README.nginx README.gsa
%{_sbindir}/munin-run
%{_sbindir}/munin-sched
%{_sbindir}/munin-node
%{_sbindir}/munin-node-configure
%if 0%{?suse_version} >= 1220
%{_prefix}/lib/tmpfiles.d/munin-node.conf
%{_unitdir}/munin-node.service
%endif
%dir %{_prefix}/lib/munin
%{_prefix}/lib/munin/munin-async
%{_prefix}/lib/munin/munin-asyncd
%{_prefix}/lib/munin/plugins/
/sbin/rcmunin-node
%if 0%{?suse_version} < 1220
%config %{_sysconfdir}/init.d/munin-node
%endif
%dir %{_sysconfdir}/munin/plugin-conf.d
%dir %{_sysconfdir}/munin/plugins
%config(noreplace) %{_sysconfdir}/munin/plugin-conf.d/munin-node
%config(noreplace) %{_sysconfdir}/munin/munin-node.conf
%config %{_sysconfdir}/logrotate.d/munin-node
%dir %{perl_vendorlib}/Munin/Common
%{perl_vendorlib}/Munin/Common/Config.pm
%{perl_vendorlib}/Munin/Common/Defaults.pm
%{perl_vendorlib}/Munin/Common/TLS.pm
%{perl_vendorlib}/Munin/Common/TLSClient.pm
%{perl_vendorlib}/Munin/Common/TLSServer.pm
%{perl_vendorlib}/Munin/Common/Timeout.pm
%{perl_vendorlib}/Munin/Common/DictFile.pm
%{perl_vendorlib}/Munin/Common/SyncDictFile.pm
%dir %{perl_vendorlib}/Munin/Node
%{perl_vendorlib}/Munin/Node/Config.pm
%dir %{perl_vendorlib}/Munin/Node/Configure
%{perl_vendorlib}/Munin/Node/Configure/Debug.pm
%{perl_vendorlib}/Munin/Node/Configure/History.pm
%{perl_vendorlib}/Munin/Node/Configure/HostEnumeration.pm
%{perl_vendorlib}/Munin/Node/Configure/Plugin.pm
%{perl_vendorlib}/Munin/Node/Configure/PluginList.pm
%{perl_vendorlib}/Munin/Node/Logger.pm
%{perl_vendorlib}/Munin/Node/OS.pm
%{perl_vendorlib}/Munin/Node/SNMPConfig.pm
%{perl_vendorlib}/Munin/Node/Server.pm
%{perl_vendorlib}/Munin/Node/Service.pm
%{perl_vendorlib}/Munin/Node/Session.pm
%{perl_vendorlib}/Munin/Node/Utils.pm
%{perl_vendorlib}/Munin/Node/ProxySpooler.pm
%{perl_vendorlib}/Munin/Node/SpoolReader.pm
%{perl_vendorlib}/Munin/Node/SpoolWriter.pm
%{perl_vendorlib}/Munin/Plugin.pm
%dir %{perl_vendorlib}/Munin/Plugin
%{perl_vendorlib}/Munin/Plugin/Pgsql.pm
%{perl_vendorlib}/Munin/Plugin/SNMP.pm
%{_mandir}/man1/munin-node-configure.1.gz
%{_mandir}/man1/munin-node.1.gz
%{_mandir}/man1/munin-run.1.gz
%{_mandir}/man1/munin-sched.1.gz
%{_mandir}/man1/munindoc.1.gz
%{_mandir}/man3/Munin::Common::Config.3pm.gz
%{_mandir}/man3/Munin::Common::Defaults.3pm.gz
%{_mandir}/man3/Munin::Common::TLS.3pm.gz
%{_mandir}/man3/Munin::Common::TLSClient.3pm.gz
%{_mandir}/man3/Munin::Common::TLSServer.3pm.gz
%{_mandir}/man3/Munin::Common::Timeout.3pm.gz
%{_mandir}/man3/Munin::Node::Config.3pm.gz
%{_mandir}/man3/Munin::Node::Configure::Debug.3pm.gz
%{_mandir}/man3/Munin::Node::Configure::History.3pm.gz
%{_mandir}/man3/Munin::Node::Configure::HostEnumeration.3pm.gz
%{_mandir}/man3/Munin::Node::Configure::Plugin.3pm.gz
%{_mandir}/man3/Munin::Node::Configure::PluginList.3pm.gz
%{_mandir}/man3/Munin::Node::Logger.3pm.gz
%{_mandir}/man3/Munin::Node::ProxySpooler.3pm.gz
%{_mandir}/man3/Munin::Node::OS.3pm.gz
%{_mandir}/man3/Munin::Node::SpoolReader.3pm.gz
%{_mandir}/man3/Munin::Node::SpoolWriter.3pm.gz
%{_mandir}/man3/Munin::Node::SNMPConfig.3pm.gz
%{_mandir}/man3/Munin::Node::Server.3pm.gz
%{_mandir}/man3/Munin::Node::Service.3pm.gz
%{_mandir}/man3/Munin::Node::Session.3pm.gz
%{_mandir}/man3/Munin::Node::Utils.3pm.gz
%{_mandir}/man3/Munin::Plugin.3pm.gz
%{_mandir}/man3/Munin::Plugin::Pgsql.3pm.gz
%{_mandir}/man3/Munin::Plugin::SNMP.3pm.gz
%attr(0750, munin, munin) %dir %{logdir}
%attr(0755, munin, munin) %dir %{dbdir}
%attr(0775, nobody, nobody) %dir %{dbdir}/plugin-state
%changelog