nrpe.spec.in 5.7 KB

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