nrpe.spec 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. %define name nrpe
  2. %define version 2.2
  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. Copyright: 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. make all
  97. %install
  98. [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
  99. install -d -m 0755 ${RPM_BUILD_ROOT}/etc/init.d
  100. install -d -m 0755 ${RPM_BUILD_ROOT}/etc/nagios
  101. install -d -m 0755 ${RPM_BUILD_ROOT}/usr/sbin
  102. install -d -m 0755 ${RPM_BUILD_ROOT}/usr/lib/nagios/plugins
  103. # install templated configuration files
  104. cp nrpe.cfg ${RPM_BUILD_ROOT}/etc/nagios/nrpe.cfg
  105. cp init-script ${RPM_BUILD_ROOT}/etc/init.d/nrpe
  106. cp src/nrpe ${RPM_BUILD_ROOT}/usr/sbin
  107. cp src/check_nrpe ${RPM_BUILD_ROOT}/usr/lib/nagios/plugins
  108. %clean
  109. rm -rf $RPM_BUILD_ROOT
  110. %files
  111. %defattr(755,root,root)
  112. /etc/init.d/nrpe
  113. %{_prefix}/sbin/nrpe
  114. %dir /etc/nagios
  115. %defattr(644,root,root)
  116. %config(noreplace) /etc/nagios/*.cfg
  117. %defattr(755,%{nsusr},%{nsgrp})
  118. %doc Changelog LEGAL README
  119. %files plugin
  120. %defattr(755,root,root)
  121. %{_prefix}/lib/nagios/plugins
  122. %defattr(755,%{nsusr},%{nsgrp})
  123. %doc Changelog LEGAL README
  124. %changelog
  125. * Wed Nov 12 2003 Ingimar Robertsson <iar@skyrr.is>
  126. - Added adding of nagios group if it does not exist.
  127. * Tue Jan 07 2003 James 'Showkilr' Peterson <showkilr@showkilr.com>
  128. - Removed the lines which removed the nagios user and group from the system
  129. - changed the patch release version from 3 to 1
  130. * Mon Jan 06 2003 James 'Showkilr' Peterson <showkilr@showkilr.com>
  131. - Removed patch files required for nrpe 1.5
  132. - Update spec file for version 1.6 (1.6-1)
  133. * Sat Dec 28 2002 James 'Showkilr' Peterson <showkilr@showkilr.com>
  134. - First RPM build (1.5-1)