README 6.7 KB

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