1 %define plugin check_iptables
2 Summary: Nagios plugin to check count of iptables rules
3 Name: nagios-plugin-%{plugin}
10 BuildRequires: rpmbuild(macros) >= 1.685
13 Requires: nagios-common
14 Requires: nagios-plugins-libs
18 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
20 %define _sysconfdir /etc/nagios/plugins
21 %define nrpeddir /etc/nagios/nrpe.d
22 %define plugindir %{_prefix}/lib/nagios/plugins
25 Nagios plugin to check count of iptables rules.
29 cp -p %{SOURCE0} %{plugin}
32 rm -rf $RPM_BUILD_ROOT
33 install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{nrpeddir},%{plugindir}}
34 install -p %{plugin} $RPM_BUILD_ROOT%{plugindir}/%{plugin}
35 sed -e 's,@plugindir@,%{plugindir},' %{SOURCE1} > $RPM_BUILD_ROOT%{_sysconfdir}/%{plugin}.cfg
36 touch $RPM_BUILD_ROOT%{nrpeddir}/%{plugin}.cfg
39 rm -rf $RPM_BUILD_ROOT
43 # setup sudo rules on first install
44 %{plugindir}/%{plugin} -S || :
49 # remove all sudo rules related to us
50 %{__sed} -i -e '/CHECK_IPTABLES/d' /etc/sudoers
53 %triggerin -- nagios-nrpe
54 %nagios_nrpe -a %{plugin} -f %{_sysconfdir}/%{plugin}.cfg
56 %triggerun -- nagios-nrpe
57 %nagios_nrpe -d %{plugin} -f %{_sysconfdir}/%{plugin}.cfg
60 %defattr(644,root,root,755)
61 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{plugin}.cfg
62 %ghost %{nrpeddir}/%{plugin}.cfg
63 %attr(755,root,root) %{plugindir}/%{plugin}