2 # - ndo2db is unable to start, if there's stale socket:
3 # srwxr-xr-x 1 nagios nagios 0 Jan 15 2012 /var/lib/nagios/ndo.sock=
4 # - enabling with ssl fails to build due conflicting headers for pqueue_*
7 %bcond_with pgsql # build without pgsql support (does not seem to work)
8 %bcond_without mysql # build without mysql support
9 %bcond_with ssl # build without ssl support
11 %define addon ndoutils
12 Summary: NDOUTILS (Nagios Data Output Utils) addon
13 Summary(pl.UTF-8): Dodatek NDOUTILS (Nagios Data Output Utils)
19 Source0: http://downloads.sourceforge.net/nagios/%{addon}-%{version}.tar.gz
20 # Source0-md5: 93561584f0fa7582a795e795306a3b35
23 Patch1: format-security.patch
24 URL: http://sourceforge.net/projects/nagios/
25 %{?with_mysql:BuildRequires: mysql-devel}
26 %{?with_ssl:BuildRequires: openssl-devel}
27 %{?with_pgsql:BuildRequires: postgresql-devel}
28 BuildRequires: rpmbuild(macros) >= 1.268
29 Requires: nagios >= 4.0
30 Requires(post,preun): /sbin/chkconfig
32 Suggests: perl-DBD-mysql
33 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
35 %define _sysconfdir /etc/nagios
36 %define _libdir %{_prefix}/%{_lib}/nagios
39 The NDOUTILS (Nagios Data Output Utils) addon allows you to move
40 status and event information from Nagios to a database for later
41 retrieval and processing.
43 %description -l pl.UTF-8
44 Dodatek NDOUTILS (Nagios Data Output Utils) pozwala przenosić
45 informacje o stanie i zdarzeniach z Nagiosa do bazy danych w celu
46 późniejszego odczytu i przetwarzania.
49 %setup -q -n %{addon}-%{version}
54 grep -r 20052-2009 -l . | xargs sed -i -e 's,20052-2009,2005-2009,'
58 --bindir=%{_sbindir} \
59 --localstatedir=/var/lib/nagios \
60 --with-init-dir=/etc/rc.d/init.d \
61 %{?with_mysql:--enable-mysql} \
62 %{?with_pgsql:--enable-pgsql} \
63 %{?with_ssl:--enable-ssl} \
69 rm -rf $RPM_BUILD_ROOT
70 install -d $RPM_BUILD_ROOT{%{_libdir},%{_sysconfdir},%{_sbindir},%{_datadir}/%{addon}}
72 %{__make} fullinstall \
75 DESTDIR=$RPM_BUILD_ROOT
77 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/ndo2db
79 mv $RPM_BUILD_ROOT{%{_sbindir},%{_libdir}}/ndomod.o
81 for sample in $RPM_BUILD_ROOT%{_sysconfdir}/*-sample; do
82 cfg=${sample%%-sample}
86 # sample line that should be added to nagios.cfg for this module to work
87 echo 'broker_module=%{_libdir}/ndomod.o config_file=%{_sysconfdir}/ndomod.cfg' \
88 > $RPM_BUILD_ROOT%{_sysconfdir}/ndomod-load.cfg
90 install -d $RPM_BUILD_ROOT%{_datadir}/%{addon}
91 cp -a db/* $RPM_BUILD_ROOT%{_datadir}/%{addon}
94 rm -rf $RPM_BUILD_ROOT
97 /sbin/chkconfig --add ndo2db
98 %service ndo2db restart
99 %service -q nagios restart
102 if [ "$1" = "0" ]; then
103 %service -q ndo2db stop
104 /sbin/chkconfig --del ndo2db
108 %defattr(644,root,root,755)
109 %doc README REQUIREMENTS TODO UPGRADING
110 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ndo2db.cfg
111 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ndomod-load.cfg
112 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ndomod.cfg
113 %attr(754,root,root) /etc/rc.d/init.d/ndo2db
114 %attr(755,root,root) %{_sbindir}/file2sock
115 %attr(755,root,root) %{_sbindir}/log2ndo
116 %attr(755,root,root) %{_sbindir}/ndo2db
117 %attr(755,root,root) %{_sbindir}/sockdebug
118 %attr(755,root,root) %{_libdir}/ndomod.o
119 %dir %{_datadir}/%{addon}
120 %{_datadir}/%{addon}/README
121 %{_datadir}/%{addon}/*.sql
122 %{_datadir}/%{addon}/queries
123 %attr(755,root,root) %{_datadir}/%{addon}/upgradedb
124 %attr(755,root,root) %{_datadir}/%{addon}/installdb
125 %attr(755,root,root) %{_datadir}/%{addon}/prepsql