README 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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. Running Under INETD or XINETD
  52. -----------------------------
  53. If you plan on running nrpe under inetd or xinetd and making use
  54. of TCP wrappers, you need to do the following things:
  55. 1) Add a line to your /etc/services file as follows (modify the port
  56. number as you see fit)
  57. nrpe 5666/tcp # NRPE
  58. 2) Add entries for the NRPE daemon to either your inetd or xinetd
  59. configuration files. Which one your use will depend on which
  60. superserver is installed on your system. Both methods are described
  61. below. NOTE: If you run nrpe under inetd or xinetd, the server_port
  62. and allowed_hosts variables in the nrpe configuration file are
  63. ignored.
  64. ***** INETD *****
  65. If your system uses the inetd superserver WITH tcpwrappers, add an
  66. entry to /etc/inetd.conf as follows:
  67. nrpe stream tcp nowait <user> /usr/sbin/tcpd <nrpebin> -c <nrpecfg> --inetd
  68. If your system uses the inetd superserver WITHOUT tcpwrappers, add an
  69. entry to /etc/inetd.conf as follows:
  70. nrpe stream tcp nowait <user> <nrpebin> -c <nrpecfg> --inetd
  71. - Replace <user> with the name of the user that the nrpe server should run as.
  72. Example: nagios
  73. - Replace <nrpebin> with the path to the nrpe binary on your system.
  74. Example: /usr/local/nagios/nrpe
  75. - Replace <nrpecfg> with the path to the nrpe config file on your system.
  76. Example: /usr/local/nagios/nrpe.cfg
  77. ***** XINETD *****
  78. If your system uses xinetd instead of inetd, you'll probably
  79. want to create a file called 'nrpe' in your /etc/xinetd.d
  80. directory that contains the following entries:
  81. # default: on
  82. # description: NRPE
  83. service nrpe
  84. {
  85. flags = REUSE
  86. socket_type = stream
  87. wait = no
  88. user = <user>
  89. server = <nrpebin>
  90. server_args = -c <nrpecfg> --inetd
  91. log_on_failure += USERID
  92. disable = no
  93. only_from = <ipaddress1> <ipaddress2> ...
  94. }
  95. - Replace <user> with the name of the user that the nrpe server should run as.
  96. - Replace <nrpebin> with the path to the nrpe binary on your system.
  97. - Replace <nrpecfg> with the path to the nrpe config file on your system.
  98. - Replace the <ipaddress> fields with the IP addresses of hosts which
  99. are allowed to connect to the NRPE daemon. This only works if xinetd was
  100. compiled with support for tcpwrappers.
  101. 3) Restart inetd or xinetd will the following command (pick the
  102. on that is appropriate for your system:
  103. /etc/rc.d/init.d/inet restart
  104. /etc/rc.d/init.d/xinetd restart
  105. 4) Add entries to your /etc/hosts.allow and /etc/hosts.deny
  106. file to enable TCP wrapper protection for the nrpe service.
  107. This is optional, although highly recommended.
  108. Configuring Things On The Nagios Host
  109. ---------------------------------------
  110. Examples for configuring the nrpe daemon are found in the sample
  111. nrpe.cfg file included in this distribution. That config file
  112. resides on the remote host(s) along with the nrpe daemon. The
  113. check_nrpe plugin gets installed on the Nagios host. In order
  114. to use the check_nrpe plugin from within Nagios, you'll have
  115. to define a few things in the host config file. An example
  116. command definition for the check_nrpe plugin would look like this:
  117. define command{
  118. command_name check_nrpe
  119. command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
  120. }
  121. In any service definitions that use the nrpe plugin/daemon to
  122. get their results, you would set the service check command portion
  123. of the definition to something like this (sample service definition
  124. is simplified for this example):
  125. define service{
  126. host_name someremotehost
  127. service_description someremoteservice
  128. check_command check_nrpe!yourcommand
  129. ... etc ...
  130. }
  131. where "yourcommand" is a name of a command that you define in
  132. your nrpe.cfg file on the remote host (see the docs in the
  133. sample nrpe.cfg file for more information).
  134. Questions?
  135. ----------
  136. If you have questions about this addon, or problems getting things
  137. working, first try searching the nagios-users mailing list archives.
  138. Details on searching the list archives can be found at
  139. http://www.nagios.org
  140. If all else fails, you can email me and I'll try and respond as
  141. soon as I get a chance.
  142. -- Ethan Galstad (nagios@nagios.org)