nrpe.spec.in 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. %define isaix %(test "`uname -s`" = "AIX" && echo "1" || echo "0")
  2. %define islinux %(test "`uname -s`" = "Linux" && echo "1" || echo "0")
  3. %if %{isaix}
  4. %define _prefix /opt/nagios
  5. %define _docdir %{_prefix}/doc/@PACKAGE_NAME@-@PACKAGE_VERSION@
  6. %define nshome /opt/nagios
  7. %define _make gmake
  8. %endif
  9. %if %{islinux}
  10. %define _init_dir @initdir@
  11. %define _init_type @init_type@
  12. %define _exec_prefix %{_prefix}/sbin
  13. %define _bindir %{_prefix}/sbin
  14. %define _sbindir %{_prefix}/lib/nagios/cgi
  15. %define _libexecdir %{_prefix}/lib/nagios/plugins
  16. %define _datadir %{_prefix}/share/nagios
  17. %define _localstatedir /var/log/nagios
  18. %define nshome /var/log/nagios
  19. %define _make make
  20. %endif
  21. %define _sysconfdir /etc/nagios
  22. %define name @PACKAGE_NAME@
  23. %define version 4.1.0
  24. %define release @RPM_RELEASE@
  25. %define nsusr @nrpe_user@
  26. %define nsgrp @nrpe_group@
  27. %define nsport @nrpe_port@
  28. %define ns_src_tmpfile "@src_tmpfile@"
  29. # Reserve option to override port setting with:
  30. # rpm -ba|--rebuild --define 'nsport 5666'
  31. %{?port:%define nsport %{port}}
  32. # Macro that print messages to syslog at package (un)install time
  33. %define nnmmsg logger -t %{name}/rpm
  34. Summary: Host/service/network monitoring agent for Nagios
  35. URL: http://www.nagios.org
  36. Name: %{name}
  37. Version: %{version}
  38. Release: %{release}
  39. License: GPL
  40. Group: Application/System
  41. Source0: %{name}-%{version}.tar.gz
  42. BuildRoot: %{_tmppath}/%{name}-buildroot
  43. Prefix: %{_prefix}
  44. Prefix: @initdir@
  45. Prefix: /etc/nagios
  46. %if %{isaix}
  47. Requires: nagios-plugins
  48. %endif
  49. %if %{islinux}
  50. Requires: bash, grep, nagios-plugins, util-linux, chkconfig, shadow-utils, sed, initscripts, mktemp
  51. %endif
  52. %description
  53. NPRE (Nagios Remote Plugin Executor) is a system daemon that
  54. will execute various Nagios plugins locally on behalf of a
  55. remote (monitoring) host that uses the check_nrpe plugin.
  56. Various plugins that can be executed by the daemon are available
  57. at: http://sourceforge.net/projects/nagiosplug
  58. This package provides the client-side NRPE agent (daemon).
  59. %package plugin
  60. Group: Application/System
  61. Summary: Provides nrpe plugin for Nagios.
  62. Requires: nagios-plugins
  63. %description plugin
  64. NPRE (Nagios Remote Plugin Executor) is a system daemon that
  65. will execute various Nagios plugins locally on behalf of a
  66. remote (monitoring) host that uses the check_nrpe plugin.
  67. Various plugins that can be executed by the daemon are available
  68. at: http://sourceforge.net/projects/nagiosplug
  69. This package provides the server-side NRPE plugin for
  70. Nagios-related applications.
  71. %prep
  72. %setup -q
  73. %if %{isaix}
  74. # Check to see if the nrpe service is running and, if so, stop it.
  75. /usr/bin/lssrc -s nrpe > /dev/null 2> /dev/null
  76. if [ $? -eq 0 ] ; then
  77. status=`/usr/bin/lssrc -s nrpe | /usr/bin/gawk '$1=="nrpe" {print $NF}'`
  78. if [ "$status" = "active" ] ; then
  79. /usr/bin/stopsrc -s nrpe
  80. fi
  81. fi
  82. %endif
  83. %if %{isaix}
  84. %post
  85. /usr/bin/lssrc -s nrpe > /dev/null 2> /dev/null
  86. if [ $? -eq 1 ] ; then
  87. /usr/bin/mkssys -p %{_bindir}/nrpe -s nrpe -u 0 -a "-c %{_sysconfdir}/nrpe.cfg -d -s" -Q -R -S -n 15 -f 9
  88. fi
  89. /usr/bin/startsrc -s nrpe
  90. %endif
  91. %preun
  92. %if %{isaix}
  93. status=`/usr/bin/lssrc -s nrpe | /usr/bin/gawk '$1=="nrpe" {print $NF}'`
  94. if [ "$status" = "active" ] ; then
  95. /usr/bin/stopsrc -s nrpe
  96. fi
  97. /usr/bin/rmssys -s nrpe
  98. %endif
  99. %if %{islinux}
  100. if [ "$1" = 0 ]; then
  101. /sbin/service nrpe stop > /dev/null 2>&1
  102. /sbin/chkconfig --del nrpe
  103. fi
  104. %endif
  105. %if %{islinux}
  106. %postun
  107. if [ "$1" -ge "1" ]; then
  108. /sbin/service nrpe condrestart >/dev/null 2>&1 || :
  109. fi
  110. %endif
  111. %build
  112. export PATH=$PATH:/usr/sbin
  113. CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" \
  114. MAKE=%{_make} ./configure \
  115. --with-init-type=%{_init_type} \
  116. --with-nrpe-port=%{nsport} \
  117. --with-nrpe-user=%{nsusr} \
  118. --with-nrpe-group=%{nsgrp} \
  119. --prefix=%{_prefix} \
  120. --exec-prefix=%{_exec_prefix} \
  121. --bindir=%{_bindir} \
  122. --sbindir=%{_sbindir} \
  123. --libexecdir=%{_libexecdir} \
  124. --datadir=%{_datadir} \
  125. --sysconfdir=%{_sysconfdir} \
  126. --localstatedir=%{_localstatedir} \
  127. --enable-command-args
  128. %{_make} all
  129. %install
  130. [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
  131. %if %{islinux}
  132. install -d -m 0755 ${RPM_BUILD_ROOT}%{_init_dir}
  133. %endif
  134. DESTDIR=${RPM_BUILD_ROOT} %{_make} install-groups-users install install-config install-init
  135. %clean
  136. rm -rf $RPM_BUILD_ROOT
  137. %files
  138. %if %{islinux}
  139. %defattr(755,root,root)
  140. @initdir@/@initname@
  141. %endif
  142. %{_bindir}/nrpe
  143. %dir %{_sysconfdir}
  144. %defattr(600,%{nsusr},%{nsgrp})
  145. %config(noreplace) %{_sysconfdir}/*.cfg
  146. %defattr(755,%{nsusr},%{nsgrp})
  147. %if %{ns_src_tmpfile} != ""
  148. @tmpfilesd@
  149. %endif
  150. %{_bindir}/nrpe-uninstall
  151. %doc CHANGELOG.md LEGAL README.md README.SSL.md SECURITY.md
  152. %files plugin
  153. %defattr(755,%{nsusr},%{nsgrp})
  154. %{_libexecdir}
  155. %defattr(644,%{nsusr},%{nsgrp})
  156. %doc CHANGELOG.md LEGAL README.md
  157. %changelog
  158. * Thu Aug 18 2016 John Frickson jfrickson<@>nagios.com
  159. - Changed 'make install-daemon-config' to 'make install-config'
  160. - Added make targets 'install-groups-users' and 'install-init'
  161. - Misc. changes
  162. * Mon Mar 12 2012 Eric Stanley estanley<@>nagios.com
  163. - Created autoconf input file
  164. - Updated to support building on AIX
  165. - Updated install to use make install*
  166. * Mon Jan 23 2006 Andreas Kasenides ank<@>cs.ucy.ac.cy
  167. - fixed nrpe.cfg relocation to sample-config
  168. - replaced Copyright label with License
  169. - added --enable-command-args to enable remote arg passing (if desired can be disabled by commenting out)
  170. * Wed Nov 12 2003 Ingimar Robertsson <iar@skyrr.is>
  171. - Added adding of nagios group if it does not exist.
  172. * Tue Jan 07 2003 James 'Showkilr' Peterson <showkilr@showkilr.com>
  173. - Removed the lines which removed the nagios user and group from the system
  174. - changed the patch release version from 3 to 1
  175. * Mon Jan 06 2003 James 'Showkilr' Peterson <showkilr@showkilr.com>
  176. - Removed patch files required for nrpe 1.5
  177. - Update spec file for version 1.6 (1.6-1)
  178. * Sat Dec 28 2002 James 'Showkilr' Peterson <showkilr@showkilr.com>
  179. - First RPM build (1.5-1)