This tutorial focuses mainly on using SSH and NRPE for performing the remote checks. This is because Nagios is widely used to perform checks on the remote machines. There are also various alternate approaches that people take to invoke checks remotely.
One alternative approach is to use an agent that is running on each remote machine and use it to perform tests. A common solution for performing Nagios monitoring remotely this is Nagios Cross-Platform Agent (NCPA), which is available from https://exchange.nagios.org/directory/Addons/Monitoring-Agents/NCPA/details. It is an open source agent written in Python that can be installed on Windows, Mac OS X and Linux machines. NCPA also provides a command for performing checks from the Nagios server.
In many cases remote monitoring involves checking the status of web-based applications. In this case it’s common to use
check_http and send requests for monitoring status to the application. This way, you can invoke a specific URL that will perform a status check of your application components or perform additional tests on the machine and provide the results over the HTTP protocol.
In such a case, an application can have a URL that is accessible only from specific IP addresses and returns diagnostic information about the website. This can mean performing a test SQL query to the database and checking the file permissions and available disk space. The application can also perform a sanity check of critical data either in the files or in a database.
The web page can return a predefined string if all of the tests are passed correctly and will return an error message otherwise. In this case, it is possible to perform the check with the
A typical scenario is when a check is done for both the string preset in the answer and a page size range. For example, a check for the
OK string combined with a page size ranging from two to eight will check whether the result contains information about the correct test and will also detect any additional messages preset in the output.
Another option is to use a generic framework for running commands remotely and simply adapt it to run Nagios checks. One such framework is the Software Testing Automation Framework (STAF) available at http://staf.sourceforge.net/.
This is a peer-to-peer-based framework that allows you to write code that performs specific jobs on remote machines. As the system is not centralized, there is no critical resource that can make your entire system malfunction if it is down.
One of the benefits of STAF is that is stable, actively maintained and has support for a large variety of languages—such as Java, Perl, Python, Tcl and Ant. This means that logic for performing checks can be done in languages that best fit a specific scenario.