nrpe.spec 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. %define name nrpe
  2. %define version 2.0b4
  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' user on the system if necessary
  48. if id %{nsusr} ; then
  49. : # user already exists
  50. else
  51. /usr/sbin/useradd -r -d /var/log/nagios -s /bin/sh -c "%{nsusr}" -g %{nsgrp} %{nsusr} || \
  52. %nnmmsg Unexpected error adding user "%{nsusr}". Aborting install process.
  53. fi
  54. # if LSB standard /etc/init.d does not exist,
  55. # create it as a symlink to the first match we find
  56. if [ -d /etc/init.d -o -L /etc/init.d ]; then
  57. : # we're done
  58. elif [ -d /etc/rc.d/init.d ]; then
  59. ln -s /etc/rc.d/init.d /etc/init.d
  60. elif [ -d /usr/local/etc/rc.d ]; then
  61. ln -s /usr/local/etc/rc.d /etc/init.d
  62. elif [ -d /sbin/init.d ]; then
  63. ln -s /sbin/init.d /etc/init.d
  64. fi
  65. %preun
  66. if [ "$1" = 0 ]; then
  67. /sbin/service nrpe stop > /dev/null 2>&1
  68. /sbin/chkconfig --del nrpe
  69. fi
  70. %postun
  71. if [ "$1" -ge "1" ]; then
  72. /sbin/service nrpe condrestart >/dev/null 2>&1 || :
  73. fi
  74. %build
  75. export PATH=$PATH:/usr/sbin
  76. CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" \
  77. ./configure \
  78. --with-init-dir=/etc/init.d \
  79. --with-nrpe-port=%{nsport} \
  80. --with-nrpe-user=%{nsusr} \
  81. --with-nrpe-grp=%{nsgrp} \
  82. --prefix=%{_prefix} \
  83. --exec-prefix=%{_prefix}/sbin \
  84. --bindir=%{_prefix}/sbin \
  85. --sbindir=%{_prefix}/lib/nagios/cgi \
  86. --libexecdir=%{_prefix}/lib/nagios/plugins \
  87. --datadir=%{_prefix}/share/nagios \
  88. --sysconfdir=/etc/nagios \
  89. --localstatedir=/var/log/nagios
  90. make all
  91. %install
  92. [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
  93. install -d -m 0755 ${RPM_BUILD_ROOT}/etc/init.d
  94. install -d -m 0755 ${RPM_BUILD_ROOT}/etc/nagios
  95. install -d -m 0755 ${RPM_BUILD_ROOT}/usr/sbin
  96. install -d -m 0755 ${RPM_BUILD_ROOT}/usr/lib/nagios/plugins
  97. # install templated configuration files
  98. cp nrpe.cfg ${RPM_BUILD_ROOT}/etc/nagios/nrpe.cfg
  99. cp init-script ${RPM_BUILD_ROOT}/etc/init.d/nrpe
  100. cp src/nrpe ${RPM_BUILD_ROOT}/usr/sbin
  101. cp src/check_nrpe ${RPM_BUILD_ROOT}/usr/lib/nagios/plugins
  102. %clean
  103. rm -rf $RPM_BUILD_ROOT
  104. %files
  105. %defattr(755,root,root)
  106. /etc/init.d/nrpe
  107. %{_prefix}/sbin/nrpe
  108. %dir /etc/nagios
  109. %defattr(644,root,root)
  110. %config(noreplace) /etc/nagios/*.cfg
  111. %defattr(755,%{nsusr},%{nsgrp})
  112. %doc Changelog LEGAL README
  113. %files plugin
  114. %defattr(755,root,root)
  115. %{_prefix}/lib/nagios/plugins
  116. %defattr(755,%{nsusr},%{nsgrp})
  117. %doc Changelog LEGAL README
  118. %changelog
  119. * Tue Jan 07 2003 James 'Showkilr' Peterson <showkilr@showkilr.com>
  120. - Removed the lines which removed the nagios user and group from the system
  121. - changed the patch release version from 3 to 1
  122. * Mon Jan 06 2003 James 'Showkilr' Peterson <showkilr@showkilr.com>
  123. - Removed patch files required for nrpe 1.5
  124. - Update spec file for version 1.6 (1.6-1)
  125. * Sat Dec 28 2002 James 'Showkilr' Peterson <showkilr@showkilr.com>
  126. - First RPM build (1.5-1)