SHA256
1
0
forked from pool/munin

Accepting request 176740 from home:vjt:ifad

Hello,

I've added two systemd units to start munin's CGI graph and HTML generators as daemons using spawn-fcgi.

OBS-URL: https://build.opensuse.org/request/show/176740
OBS-URL: https://build.opensuse.org/package/show/server:monitoring/munin?expand=0&rev=8
This commit is contained in:
Wolfgang Rosenauer 2013-05-30 07:41:33 +00:00 committed by Git OBS Bridge
parent 47c8eac0bc
commit c9ec5de7a8
5 changed files with 73 additions and 7 deletions

11
munin-cgi-graph.service Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=Munin CGI Graph generator
Requires=network.target
[Service]
Type=forking
ExecStart=/usr/bin/spawn-fcgi -s /var/run/munin/munin-cgi-graph.sock -P /var/run/munin/munin-cgi-graph.pid -u munin -g munin -M 0770 -U munin -G www /srv/www/cgi-bin/munin-cgi-graph
PIDFile=/var/run/munin/munin-cgi-graph.pid
[Install]
WantedBy=multi-user.target

11
munin-cgi-html.service Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=Munin CGI HTML generator
Requires=network.target
[Service]
Type=forking
ExecStart=/usr/bin/spawn-fcgi -s /var/run/munin/munin-cgi-html.sock -P /var/run/munin/munin-cgi-html.pid -u munin -g munin -M 0770 -U munin -G www /srv/www/cgi-bin/munin-cgi-html
PIDFile=/var/run/munin/munin-cgi-html.pid
[Install]
WantedBy=multi-user.target

View File

@ -5,4 +5,7 @@ Requires=network.target
[Service]
Type=forking
ExecStart=/usr/sbin/munin-node
PIDFile=/var/run/munin/munin-node.pid
[Install]
WantedBy=multi-user.target

View File

@ -8,6 +8,16 @@ Mon May 27 02:00:38 CEST 2013 - draht@suse.de
* TMPDIR reuse fixes
- do NOT autostart from %post
-------------------------------------------------------------------
Tue May 21 17:09:14 UTC 2013 - vjt@openssl.it
- Add missing perl-URI and perl-FastCGI dependencies
- Add systemd service units to start the HTML and Graph CGI servers
with the aid of spawn-fcgi
NOTE: the FastCGI server listens on an UNIX socket in /var/run/munin
and members of the "www" group can write to it.
- Add the missing [Install] section of the munin-node service unit
-------------------------------------------------------------------
Mon Mar 25 16:23:53 UTC 2013 - vjt@openssl.it

View File

@ -26,11 +26,13 @@ Source7: plugins.conf
%if 0%{?suse_version} >= 1220
Source8: munin-node.tmpfiles
Source9: munin-node.service
Source10: munin-cgi-graph.service
Source11: munin-cgi-html.service
%endif
# https://github.com/ifad/nginx-munin/archive/master.zip
Source10: nginx-munin.zip
Source12: nginx-munin.zip
# https://github.com/ifad/gsa-munin/archive/master.zip
Source11: gsa-munin.zip
Source13: gsa-munin.zip
# https://svn.koumbit.net/koumbit/trunk/munin-plugins/quota-usage
Patch: munin-plugin-quota_usage_warnings.patch
BuildRequires: perl-HTML-Template perl-Log-Log4perl perl-Net-Server perl-Net-SNMP
@ -48,7 +50,7 @@ BuildRequires: sysvinit
Requires: perl-base = %{perl_version}
Requires: perl-HTML-Template perl-Log-Log4perl perl-Net-Server perl-Net-SNMP
Requires: perl-Net-SSLeay perl-File-Copy-Recursive perl-Date-Manip
Requires: perl-IO-Socket-INET6 pwdutils rrdtool
Requires: perl-IO-Socket-INET6 perl-URI perl-FastCGI spawn-fcgi pwdutils rrdtool
Recommends: logrotate cron
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
@ -104,8 +106,8 @@ RRDtool. To see a real example of Munin in action, take a peek at
%prep
%setup -q
cp %{SOURCE1} .
unzip %{SOURCE10}
unzip %{SOURCE11}
unzip %{SOURCE12}
unzip %{SOURCE13}
%patch
@ -138,9 +140,12 @@ unzip %{SOURCE11}
%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}
@ -160,6 +165,10 @@ ln munin-gsa-master/README.md README.gsa
%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}
@ -168,6 +177,23 @@ 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
@ -183,7 +209,7 @@ then
%if 0%{?suse_version} < 1220
/sbin/chkconfig --add munin-node
%endif
/usr/sbin/munin-node-configure --shell | sh
/usr/sbin/munin-node-configure --shell | sh
fi
chown -R munin:munin %{dbdir}
chmod 755 %{dbdir}
@ -206,7 +232,7 @@ if [ $1 = 1 ] ; then
/sbin/service munin-node stop >/dev/null 2>&1
/sbin/chkconfig --del munin-node
%endif
rmdir %{logdir} 2>/dev/null || true
rmdir %{logdir} 2>/dev/null || true
fi
%if 0%{?suse_version} >= 1220
%service_del_preun munin-node.service
@ -240,6 +266,11 @@ fi
%{_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