]> git.pld-linux.org Git - packages/nagios-nrpe.git/blob - nagios-nrpe.spec
cleanup unused macro
[packages/nagios-nrpe.git] / nagios-nrpe.spec
1 Summary:        Nagios remote plugin execution service/plugin
2 Summary(pl.UTF-8):      Demon i wtyczka zdalnego wywoływania wtyczek Nagios
3 Name:           nagios-nrpe
4 Version:        2.15
5 Release:        7
6 License:        GPL v2
7 Group:          Networking
8 Source0:        http://downloads.sourceforge.net/nagios/nrpe-%{version}.tar.gz
9 # Source0-md5:  3921ddc598312983f604541784b35a50
10 Source1:        nrpe.init
11 Source2:        nrpe-command.cfg
12 Source3:        %{name}.tmpfiles
13 Source4:        commands.cfg
14 Patch0:         %{name}-config.patch
15 Patch1:         nrpe_check_control.patch
16 Patch2:         CVE-2014-2913-nasty-metacharacters.patch
17 URL:            http://www.nagios.org/
18 BuildRequires:  openssl-devel
19 BuildRequires:  openssl-tools
20 BuildRequires:  rpmbuild(macros) >= 1.647
21 Requires(post,preun):   /sbin/chkconfig
22 Requires:       nagios-common
23 Requires:       rc-scripts >= 0.4.1.26
24 Provides:       nagios-core
25 Obsoletes:      netsaint-nrpe
26 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
27
28 %define         _sysconfdir     /etc/nagios
29 %define         _datadir        %{_prefix}/share/%{name}
30 %define         _plugindir      %{_libdir}/nagios/plugins
31 %define         _localstatedir  %{_var}/log/nagios
32 %define         nsport          5666
33
34 %description
35 NPRE (Nagios Remote Plugin Executor) is a system daemon that will
36 execute various Nagios plugins locally on behalf of a remote
37 (monitoring) host that uses the check_nrpe plugin.
38
39 %description -l pl.UTF-8
40 NRPE to dodatek do Nagiosa pozwalający na wywoływanie "lokalnych"
41 wtyczek (takich jak check_disk, check_procs itp.) na zdalnych
42 maszynach. Wtyczka check_nrpe jest wywoływana z poziomu Nagiosa i
43 wysyła żądania uruchomienia wtyczek do demona NRPE działającego na
44 zdalnej maszynie (jako samodzielny demon lub usługa inetd). Obsługuje
45 przekazywanie argumentów poleceń do serwera, a także natywne
46 szyfrowanie SSL/TLS (w trybie anonimowego DH).
47
48 %package -n nagios-plugin-check_nrpe
49 Summary:        check_nrpe plugin for Nagios
50 Summary(pl.UTF-8):      Wtyczka check_nrpe dla Nagiosa
51 Group:          Networking
52 Requires:       nagios-common
53 Provides:       %{name}-plugin = %{version}-%{release}
54 Obsoletes:      nagios-nrpe-plugin < 2.12-6
55
56 %description -n nagios-plugin-check_nrpe
57 The check_nrpe plugin is called from Nagios and makes plugin execution
58 requests to the NRPE daemon running on the remote host. Supports
59 passing command arguments to server, as well as native SSL/TLS
60 encryption (anonymous DH mode).
61
62 %description -n nagios-plugin-check_nrpe -l pl.UTF-8
63 Wtyczka check_nrpe dla Nagiosa. Pozwala na zdalne uruchamianie wtyczek
64 na innych komputerach za pomocą demona nrpe.
65
66 %prep
67 %setup -q -n nrpe-%{version}
68 %undos contrib/nrpe_check_control.c
69 %patch0 -p1
70 %patch1 -p1
71 %patch2 -p1
72
73 %build
74 %configure \
75         --with-nrpe-port=%{nsport} \
76         --with-nrpe-user=nagios \
77         --with-nrpe-group=nagios \
78         --enable-ssl \
79         --with-ssl-lib=%{_libdir} \
80         --enable-command-args
81
82 %{__make} all
83
84 %{__cc} %{rpmcppflags} %{rpmcflags} %{rpmldflags} contrib/nrpe_check_control.c -o contrib/nrpe_check_control
85
86 %install
87 rm -rf $RPM_BUILD_ROOT
88 install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_sysconfdir}/{plugins,nrpe.d},%{_libdir}/nagios/plugins,%{_sbindir}} \
89         $RPM_BUILD_ROOT{%{_localstatedir},/var/run/nrpe} \
90         $RPM_BUILD_ROOT%{systemdtmpfilesdir}
91
92 cp -p sample-config/nrpe.cfg $RPM_BUILD_ROOT%{_sysconfdir}/nrpe.cfg
93 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/nrpe.d
94 sed -e 's,@plugindir@,%{_plugindir},' %{SOURCE2} > $RPM_BUILD_ROOT%{_sysconfdir}/plugins/check_nrpe.cfg
95 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/nrpe
96 install -p src/nrpe $RPM_BUILD_ROOT%{_sbindir}
97 install -p src/check_nrpe $RPM_BUILD_ROOT%{_plugindir}
98 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
99
100 %clean
101 rm -rf $RPM_BUILD_ROOT
102
103 %post
104 /sbin/chkconfig --add nrpe
105 %service nrpe restart
106
107 %preun
108 if [ "$1" = "0" ] ; then
109         %service nrpe stop
110         /sbin/chkconfig --del nrpe
111 fi
112
113 %triggerpostun -- %{name} < 2.15-5
114 # skip *this* trigger on downgrade
115 [ $1 -le 1 ] && exit 0
116
117 # ensure there's include_dir directive
118 if ! grep -q '^include_dir=%{_sysconfdir}/nrpe.d' %{_sysconfdir}/nrpe.cfg; then
119         echo 'include_dir=%{_sysconfdir}/nrpe.d' >> %{_sysconfdir}/nrpe.cfg
120 fi
121
122 # check if need to migrate
123 grep -q '^command\[' %{_sysconfdir}/nrpe.cfg || exit 0
124
125 # move command definitions to separate file
126 mv -f  %{_sysconfdir}/nrpe.d/commands.cfg{,.rpmnew}
127 grep '^command\['  %{_sysconfdir}/nrpe.cfg > %{_sysconfdir}/nrpe.d/commands.cfg
128 cp -f %{_sysconfdir}/nrpe.cfg{,.rpmsave}
129 sed -i -e '/^command\[/d' %{_sysconfdir}/nrpe.cfg
130
131 %service nrpe restart
132
133 %triggerpostun -- %{name} < 2.6-1.1
134 %{__sed} -i -e 's,/var/run/nrpe.pid,/var/run/nrpe/nrpe.pid,' %{_sysconfdir}/nrpe.cfg
135
136 %triggerpostun -n nagios-plugin-check_nrpe -- nagios-plugin-check_nrpe < 2.12-7.1
137 if [ -f %{_sysconfdir}/plugins/nrpe.cfg.rpmsave ]; then
138         cp -f %{_sysconfdir}/plugins/check_nrpe.cfg{,.rpmnew}
139         mv -f %{_sysconfdir}/plugins/{nrpe.cfg.rpmsave,check_nrpe.cfg}
140         sed -i -e 's,-c \$ARG1\$,$ARG1$,' %{_sysconfdir}/plugins/check_nrpe.cfg
141 fi
142
143 %files
144 %defattr(644,root,root,755)
145 %doc Changelog LEGAL README* SECURITY
146 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/nrpe.cfg
147 %attr(750,root,nagios) %dir %{_sysconfdir}/nrpe.d
148 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/nrpe.d/commands.cfg
149 %attr(755,root,root) %{_sbindir}/nrpe
150 %attr(754,root,root) /etc/rc.d/init.d/nrpe
151 %dir %attr(775,root,nagios) /var/run/nrpe
152 %{systemdtmpfilesdir}/%{name}.conf
153
154 %files -n nagios-plugin-check_nrpe
155 %defattr(644,root,root,755)
156 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/plugins/check_nrpe.cfg
157 %attr(755,root,root) %{_plugindir}/check_nrpe
This page took 0.036115 seconds and 4 git commands to generate.