diff --git a/munin-cgi-graph.service b/munin-cgi-graph.service new file mode 100644 index 0000000..962f17c --- /dev/null +++ b/munin-cgi-graph.service @@ -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 diff --git a/munin-cgi-html.service b/munin-cgi-html.service new file mode 100644 index 0000000..359455f --- /dev/null +++ b/munin-cgi-html.service @@ -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 diff --git a/munin-node.service b/munin-node.service index 1d02d18..3318bca 100644 --- a/munin-node.service +++ b/munin-node.service @@ -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 diff --git a/munin.changes b/munin.changes index 6f9c042..38c3be1 100644 --- a/munin.changes +++ b/munin.changes @@ -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 diff --git a/munin.spec b/munin.spec index 4957bbc..7fd0972 100644 --- a/munin.spec +++ b/munin.spec @@ -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