1 Summary: Obsessive Compulsive Host/Service Processor Daemon for Nagios
6 Group: Networking/Daemons
10 URL: http://wiki.nagios.org/index.php/OCP_Daemon
11 BuildRequires: perl-Event-Lib
12 BuildRequires: perl-base
13 BuildRequires: rpm-perlprov >= 4.1-13
14 BuildRequires: rpmbuild(macros) >= 1.228
15 Requires(post,preun): /sbin/chkconfig
16 Requires: nagios >= 3.1.2-6
17 Requires: nagios-nsca-client
18 Requires: perl-Event-Lib >= 1.03-1
21 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
23 %define _libdir %{_prefix}/lib/nagios
24 %define _spooldir %{_var}/spool/nagios
27 Given the way Nagios operates, running a command every time a
28 host/service check result comes in can greatly reduce the speed at
29 which Nagios can do its work. On huge Nagios setups the checks can end
30 up lagging behind without fully using the server resources.
32 There is a way to make Nagios write OCHP/OCSP data into a named pipe
33 instead of running a command every time, and on the other end of the
34 pipe a daemon takes care of sending the data to the master Nagios
39 install -p %{SOURCE0} .
46 rm -rf $RPM_BUILD_ROOT
47 install -d $RPM_BUILD_ROOT{%{_libdir},%{_spooldir},/etc/rc.d/init.d}
48 install -p ocpd.pl $RPM_BUILD_ROOT%{_libdir}/ocpd
49 %{__sed} -i -e 's,/usr/local/nagios/bin/send_nsca,/usr/sbin/send_nsca,' $RPM_BUILD_ROOT%{_libdir}/ocpd
50 touch $RPM_BUILD_ROOT%{_spooldir}/host-perfdata.fifo
51 touch $RPM_BUILD_ROOT%{_spooldir}/service-perfdata.fifo
52 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
55 rm -rf $RPM_BUILD_ROOT
58 for f in service-perfdata.fifo host-perfdata.fifo; do
59 if [ ! -e %{_spooldir}/$f ]; then
60 mkfifo -m 600 %{_spooldir}/$f
61 chown nagios:nagios %{_spooldir}/$f
65 /sbin/chkconfig --add %{name}
66 %service %{name} restart
69 if [ "$1" = "0" ]; then
70 %service -q %{name} stop
71 /sbin/chkconfig --del %{name}
75 %defattr(644,root,root,755)
77 %attr(754,root,root) /etc/rc.d/init.d/nagios-ocpd
78 %attr(755,root,root) %{_libdir}/ocpd
79 %attr(600,nagios,nagios) %ghost %{_spooldir}/host-perfdata.fifo
80 %attr(600,nagios,nagios) %ghost %{_spooldir}/service-perfdata.fifo