4
0

nrpe.spec 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. %define name nrpe
  2. %define version 2.8.1
  3. %define release 1
  4. %define nsusr nagios
  5. %define nsgrp nagios
  6. %define nsport 5666
  7. # Reserve option to override port setting with:
  8. # rpm -ba|--rebuild --define 'nsport 5666'
  9. %{?port:%define nsport %{port}}
  10. # Macro that print mesages to syslog at package (un)install time
  11. %define nnmmsg logger -t %{name}/rpm
  12. Summary: Host/service/network monitoring agent for Nagios
  13. URL: http://www.nagios.org
  14. Name: %{name}
  15. Version: %{version}
  16. Release: %{release}
  17. License: GPL
  18. Group: Application/System
  19. Source0: %{name}-%{version}.tar.gz
  20. BuildRoot: %{_tmppath}/%{name}-buildroot
  21. Prefix: %{_prefix}
  22. Prefix: /etc/init.d
  23. Prefix: /etc/nagios
  24. Requires: bash, grep, nagios-plugins
  25. PreReq: /usr/bin/logger, chkconfig, sh-utils, shadow-utils, sed, initscripts, fileutils, mktemp
  26. %description
  27. Nrpe is a system daemon that will execute various Nagios plugins
  28. locally on behalf of a remote (monitoring) host that uses the
  29. check_nrpe plugin. Various plugins that can be executed by the
  30. daemon are available at:
  31. http://sourceforge.net/projects/nagiosplug
  32. This package provides the core agent.
  33. %package plugin
  34. Group: Application/System
  35. Summary: Provides nrpe plugin for Nagios.
  36. Requires: nagios-plugins
  37. %description plugin
  38. Nrpe is a system daemon that will execute various Nagios plugins
  39. locally on behalf of a remote (monitoring) host that uses the
  40. check_nrpe plugin. Various plugins that can be executed by the
  41. daemon are available at:
  42. http://sourceforge.net/projects/nagiosplug
  43. This package provides the nrpe plugin for Nagios-related applications.
  44. %prep
  45. %setup -q
  46. %pre
  47. # Create `nagios' group on the system if necessary
  48. if grep ^nagios: /etc/group; then
  49. : # group already exists
  50. else
  51. /usr/sbin/groupadd %{nsgrp} || %nnmmsg Unexpected error adding group "%{nsgrp}". Aborting install process.
  52. fi
  53. # Create `nagios' user on the system if necessary
  54. if id %{nsusr} ; then
  55. : # user already exists
  56. else
  57. /usr/sbin/useradd -r -d /var/log/nagios -s /bin/sh -c "%{nsusr}" -g %{nsgrp} %{nsusr} || \
  58. %nnmmsg Unexpected error adding user "%{nsusr}". Aborting install process.
  59. fi
  60. # if LSB standard /etc/init.d does not exist,
  61. # create it as a symlink to the first match we find
  62. if [ -d /etc/init.d -o -L /etc/init.d ]; then
  63. : # we're done
  64. elif [ -d /etc/rc.d/init.d ]; then
  65. ln -s /etc/rc.d/init.d /etc/init.d
  66. elif [ -d /usr/local/etc/rc.d ]; then
  67. ln -s /usr/local/etc/rc.d /etc/init.d
  68. elif [ -d /sbin/init.d ]; then
  69. ln -s /sbin/init.d /etc/init.d
  70. fi
  71. %preun
  72. if [ "$1" = 0 ]; then
  73. /sbin/service nrpe stop > /dev/null 2>&1
  74. /sbin/chkconfig --del nrpe
  75. fi
  76. %postun
  77. if [ "$1" -ge "1" ]; then
  78. /sbin/service nrpe condrestart >/dev/null 2>&1 || :
  79. fi
  80. %build
  81. export PATH=$PATH:/usr/sbin
  82. CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" \
  83. ./configure \
  84. --with-init-dir=/etc/init.d \
  85. --with-nrpe-port=%{nsport} \
  86. --with-nrpe-user=%{nsusr} \
  87. --with-nrpe-group=%{nsgrp} \
  88. --prefix=%{_prefix} \
  89. --exec-prefix=%{_prefix}/sbin \
  90. --bindir=%{_prefix}/sbin \
  91. --sbindir=%{_prefix}/lib/nagios/cgi \
  92. --libexecdir=%{_prefix}/lib/nagios/plugins \
  93. --datadir=%{_prefix}/share/nagios \
  94. --sysconfdir=/etc/nagios \
  95. --localstatedir=/var/log/nagios \
  96. --enable-command-args
  97. make all
  98. %install
  99. [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
  100. install -d -m 0755 ${RPM_BUILD_ROOT}/etc/init.d
  101. install -d -m 0755 ${RPM_BUILD_ROOT}/etc/nagios
  102. install -d -m 0755 ${RPM_BUILD_ROOT}/usr/sbin
  103. install -d -m 0755 ${RPM_BUILD_ROOT}/usr/lib/nagios/plugins
  104. # install templated configuration files
  105. cp sample-config/nrpe.cfg ${RPM_BUILD_ROOT}/etc/nagios/nrpe.cfg
  106. cp init-script ${RPM_BUILD_ROOT}/etc/init.d/nrpe
  107. cp src/nrpe ${RPM_BUILD_ROOT}/usr/sbin
  108. cp src/check_nrpe ${RPM_BUILD_ROOT}/usr/lib/nagios/plugins
  109. %clean
  110. rm -rf $RPM_BUILD_ROOT
  111. %files
  112. %defattr(755,root,root)
  113. /etc/init.d/nrpe
  114. %{_prefix}/sbin/nrpe
  115. %dir /etc/nagios
  116. %defattr(644,root,root)
  117. %config(noreplace) /etc/nagios/*.cfg
  118. %defattr(755,%{nsusr},%{nsgrp})
  119. %doc Changelog LEGAL README
  120. %files plugin
  121. %defattr(755,root,root)
  122. %{_prefix}/lib/nagios/plugins
  123. %defattr(755,%{nsusr},%{nsgrp})
  124. %doc Changelog LEGAL README
  125. %changelog
  126. * Mon Jan 23 2006 Andreas Kasenides ank<@>cs.ucy.ac.cy
  127. - fixed nrpe.cfg relocation to sample-config
  128. - replaced Copyright label with License
  129. - added --enable-command-args to enable remote arg passing (if desired can be disabled by commenting out)
  130. * Wed Nov 12 2003 Ingimar Robertsson <iar@skyrr.is>
  131. - Added adding of nagios group if it does not exist.
  132. * Tue Jan 07 2003 James 'Showkilr' Peterson <showkilr@showkilr.com>
  133. - Removed the lines which removed the nagios user and group from the system
  134. - changed the patch release version from 3 to 1
  135. * Mon Jan 06 2003 James 'Showkilr' Peterson <showkilr@showkilr.com>
  136. - Removed patch files required for nrpe 1.5
  137. - Update spec file for version 1.6 (1.6-1)
  138. * Sat Dec 28 2002 James 'Showkilr' Peterson <showkilr@showkilr.com>
  139. - First RPM build (1.5-1)