README 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. -----------
  2. NRPE README
  3. -----------
  4. ** UPDATED DOCUMENTATION!
  5. For installation instructions and information on the design overview
  6. of the NRPE addon, please read the PDF documentation that is found in
  7. this directory: NRPE.pdf
  8. Purpose
  9. -------
  10. The purpose of this addon is to allow you to execute Nagios
  11. plugins on a remote host in as transparent a manner as possible.
  12. Contents
  13. --------
  14. There are two pieces to this addon:
  15. 1) NRPE - This program runs as a background process on the
  16. remote host and processes command execution requests
  17. from the check_nrpe plugin on the Nagios host.
  18. Upon receiving a plugin request from an authorized
  19. host, it will execute the command line associated
  20. with the command name it received and send the
  21. program output and return code back to the
  22. check_nrpe plugin
  23. 2) check_nrpe - This is a plugin that is run on the Nagios host
  24. and is used to contact the NRPE process on remote
  25. hosts. The plugin requests that a plugin be
  26. executed on the remote host and wait for the NRPE
  27. process to execute the plugin and return the result.
  28. The plugin then uses the output and return code
  29. from the plugin execution on the remote host for
  30. its own output and return code.
  31. Compiling
  32. ---------
  33. The code is very basic and may not work on your particular
  34. system without some tweaking. I just haven't put a lot of effort
  35. into this addond. Most Linux users should be able to compile
  36. NRPE and the check_nrpe plugin with the following commands...
  37. ./configure
  38. make all
  39. The binaries will be located in the src/ directory after you
  40. run 'make all' and will have to be installed manually somewhere
  41. on your system.
  42. NOTE: Since the check_nrpe plugin and nrpe daemon run on different
  43. machines (the plugin runs on the Nagios host and the daemon
  44. runs on the remote host), you will have to compile the nrpe
  45. daemon on the target machine.
  46. Installing
  47. ----------
  48. The check_nrpe plugin should be placed on the Nagios host along
  49. with your other plugins. In most cases, this will be in the
  50. /usr/local/nagios/libexec directory.
  51. The nrpe program and the configuration file (nrpe.cfg) should
  52. be placed somewhere on the remote host. Note that you will also
  53. have to install some plugins on the remote host if you want to
  54. make much use of this addon.
  55. Configuring
  56. -----------
  57. Sample config files for the NRPE daemon are located in the
  58. sample-config/ subdirectory.
  59. Running Under INETD or XINETD
  60. -----------------------------
  61. If you plan on running nrpe under inetd or xinetd and making use
  62. of TCP wrappers, you need to do the following things:
  63. 1) Add a line to your /etc/services file as follows (modify the port
  64. number as you see fit)
  65. nrpe 5666/tcp # NRPE
  66. 2) Add entries for the NRPE daemon to either your inetd or xinetd
  67. configuration files. Which one your use will depend on which
  68. superserver is installed on your system. Both methods are described
  69. below. NOTE: If you run nrpe under inetd or xinetd, the server_port
  70. and allowed_hosts variables in the nrpe configuration file are
  71. ignored.
  72. ***** INETD *****
  73. If your system uses the inetd superserver WITH tcpwrappers, add an
  74. entry to /etc/inetd.conf as follows:
  75. nrpe stream tcp nowait <user> /usr/sbin/tcpd <nrpebin> -c <nrpecfg> --inetd
  76. If your system uses the inetd superserver WITHOUT tcpwrappers, add an
  77. entry to /etc/inetd.conf as follows:
  78. nrpe stream tcp nowait <user> <nrpebin> -c <nrpecfg> --inetd
  79. - Replace <user> with the name of the user that the nrpe server should run as.
  80. Example: nagios
  81. - Replace <nrpebin> with the path to the nrpe binary on your system.
  82. Example: /usr/local/nagios/nrpe
  83. - Replace <nrpecfg> with the path to the nrpe config file on your system.
  84. Example: /usr/local/nagios/nrpe.cfg
  85. ***** XINETD *****
  86. If your system uses xinetd instead of inetd, you'll probably
  87. want to create a file called 'nrpe' in your /etc/xinetd.d
  88. directory that contains the following entries:
  89. # default: on
  90. # description: NRPE
  91. service nrpe
  92. {
  93. flags = REUSE
  94. socket_type = stream
  95. wait = no
  96. user = <user>
  97. server = <nrpebin>
  98. server_args = -c <nrpecfg> --inetd
  99. log_on_failure += USERID
  100. disable = no
  101. only_from = <ipaddress1> <ipaddress2> ...
  102. }
  103. - Replace <user> with the name of the user that the nrpe server should run as.
  104. - Replace <nrpebin> with the path to the nrpe binary on your system.
  105. - Replace <nrpecfg> with the path to the nrpe config file on your system.
  106. - Replace the <ipaddress> fields with the IP addresses of hosts which
  107. are allowed to connect to the NRPE daemon. This only works if xinetd was
  108. compiled with support for tcpwrappers.
  109. 3) Restart inetd or xinetd will the following command (pick the
  110. on that is appropriate for your system:
  111. /etc/rc.d/init.d/inet restart
  112. /etc/rc.d/init.d/xinetd restart
  113. OpenBSD users can use the following command to restart inetd:
  114. kill -HUP `cat /var/run/inet.pid`
  115. 4) Add entries to your /etc/hosts.allow and /etc/hosts.deny
  116. file to enable TCP wrapper protection for the nrpe service.
  117. This is optional, although highly recommended.
  118. Configuring Things On The Nagios Host
  119. ---------------------------------------
  120. Examples for configuring the nrpe daemon are found in the sample
  121. nrpe.cfg file included in this distribution. That config file
  122. resides on the remote host(s) along with the nrpe daemon. The
  123. check_nrpe plugin gets installed on the Nagios host. In order
  124. to use the check_nrpe plugin from within Nagios, you'll have
  125. to define a few things in the host config file. An example
  126. command definition for the check_nrpe plugin would look like this:
  127. define command{
  128. command_name check_nrpe
  129. command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
  130. }
  131. In any service definitions that use the nrpe plugin/daemon to
  132. get their results, you would set the service check command portion
  133. of the definition to something like this (sample service definition
  134. is simplified for this example):
  135. define service{
  136. host_name someremotehost
  137. service_description someremoteservice
  138. check_command check_nrpe!yourcommand
  139. ... etc ...
  140. }
  141. where "yourcommand" is a name of a command that you define in
  142. your nrpe.cfg file on the remote host (see the docs in the
  143. sample nrpe.cfg file for more information).
  144. Questions?
  145. ----------
  146. If you have questions about this addon, or problems getting things
  147. working, first try searching the nagios-users mailing list archives.
  148. Details on searching the list archives can be found at
  149. http://www.nagios.org
  150. If all else fails, you can email me and I'll try and respond as
  151. soon as I get a chance.
  152. -- Ethan Galstad (nagios@nagios.org)