README 6.3 KB

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