Chapter 6. Enabling Remote Execution

In this chapter, we will cover the following recipes:

  • Monitoring local services on a remote machine with NRPE
  • Setting the listening address for NRPE
  • Setting allowed client hosts for NRPE
  • Creating new NRPE command definitions securely
  • Giving limited sudo(8) privileges to NRPE
  • Using check_by_ssh with key authentication instead of NRPE
  • Using check_mk instead of NRPE

Introduction

For a dedicated Nagios Core server with access to all the relevant parts of the network, making checks is relatively simple using commands and plugins that make ICMP, TCP, and UDP connections to network hosts and services for determining their operating state. These can be used to check any sort of network service, without requiring anything to be installed on the target machine. As an example, when the check_http plugin is used to check a web server, it works the same way as a browser making the request.

However, monitoring a network thoroughly usually has more to it than simply checking network connectivity and availability. It's also a good idea to check properties of the network that don't directly correspond to a network service and hence can't be directly checked over a network connection.

These are often properties of hardware or the underlying system, such as disk space or system load average, or processes that are configured only to listen locally, commonly done for database servers.

We could install Nagios Core on all the systems, perhaps, but this would make maintenance difficult. It would be much better to have some means of remotely executing diagnostic programs so that they are run directly on the target host to retrieve the information they need and the results are returned to a single Nagios Core server via a dedicated network service.

There are four general approaches to managing this problem:

  • Use check_nrpe to run a standard Nagios Core plugin on the target machine and return its results transparently to the monitoring server
  • Use check_by_ssh to run an arbitrary command on the target machine from the monitoring server by first connecting to it with SSH
  • Use check_mk to automatically specify and run a set of commands appropriate to the target machine and return the results transparently to the monitoring server
  • Use check_snmp to check an SNMP OID that's configured to provide the return value and output of some command on the target host

This chapter covers the first three solutions, focusing on the more commonly used Nagios Remote Plugin Executor (NRPE), and explaining how it differs from the check_by_ssh solution. For some information on configuring SNMP, see the recipes Monitoring the output of an SNMP query and Creating an SNMP OID to monitor, both in Chapter 5, Monitoring Methods.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.1.158