Is there a more efficient way to do this? See Also: Active Checks, Service Checks, Host Checks. I'd like to use the command line to run that particular check and get the output. Let us assume that the following custom application is also running in the network, listening on a particular port. (1 + 2 + + 2048), Also note that your debug file will grow quickly and then rotate itself. It can test normal (http) and secure (https) servers, follow redirects, search for strings and regular expressions, check connection times, and report on The Nagios server is running on Ubuntu. They are a web interface and command line tool set to work with Nagios config that have decent default templates and "example" files that you can leverage for common checks. sudo usermod -aG docker kifarunix. }. Submitting Passive Host Check Results External applications can submit passive host check results to Nagios by writing a PROCESS_HOST_CHECK_RESULT external command to the external command file. Nevertheless, in response to your comment, I don't think there's an error in that, as Bash variables are untyped. For example, you can use the 'check_http' plugin to verify that a web server is running, is returning the right text, or has an up-to-date SSL certificate. In order to make Nagios treat passive host check results in the same way as active check results, we need to enable the following option: By default, Nagios treats host results from passive checks as hard results. . Now we know that the custom plugin is working on the client and on the server, and that the NRPE is communicating correctly, we can go ahead and configure Nagios files for checking the remote device. The default FQDN used for testing is www.google.com, but it can be changed as needed. The performance of on-demand service checks can be significantly improved by implementing the use of cached checks, which allow Nagios to forgo executing a service check if it determines a relatively recent check result will do instead. Monitoring Website URL Status # These are some example service check commands. JOB, The following file can be modified to do the job. In most cases you'll use Nagios to monitor your hosts and services using regularly scheduled active checks. Check whether a document is older than x seconds. rev2023.3.3.43278. This means that if Nagios receives a result indicating that a host is DOWN, it assumes that all child hosts are in an UNREACHABLE state. When max_check_attempts is executed and status of the host or service is still not OK, then hard state is used. Learn more. The documentation uses the example of: for . I just used that simple script as an example, any language can be used to write your own custom plugin. We must install this software there to install the "check_nrpe" plugin that we use to perform active checks using the NRPE. Plugin then gets executed on the remote machine where is collects the required information and sends then back to Nagios daemon. So in this blog post is all about how I used Hiera to manage the Dev,Test, Prod Stratos environments. So if you wanted to run the check_http check from the CLI, you would run ./check_http -I, where the I flag stands for the IP Address (, I struggled to get this to work, not sure what i was doing wrong (noob) but the debug_level trick worked for me :). Nagios: Simple Oracle Check. You do this with nagios -v command as root: Ensure it returns 0 errors and 0 warnings and proceed to reload the service: After reloading the service, you will see the associated check in the localhost. In order to use them, the host needs to be configured to accept passive checks results. Is it possible to check a web page through an authenticated proxy server? To subscribe to this RSS feed, copy and paste this URL into your RSS reader. In this way, NSCA communication sent over the Internet is more secure. No paper. 5 check_http Command Examples 1. When you restart the Nagios, this host will start getting monitored by Nagios and the specified services will run. The following diagram shows how both active and passive checks are performed by Nagios. Far better then Nagios documentation. More information on the flap detection logic can be found here. This yields less output to dig through. Nagios will be configured to monitor SMTP and mail queue of the server. Based on whether the read was successful or not, the appropriate status code, along with plugin output, is sent out. In many cases, the time taken is not enough, as some checks need to be performed over a longer period of time to have satisfactory results. This usually calls for some effort. The Nagios plugin can be remotely executed on other Linux/Unix machines using NRPE. How can we prove that the supernatural or paranormal doesn't exist? We want Nagios to monitor this database, and as the application is already using it, we can add a module that reports this to Nagios. This is a plugin for Nagios wich you can use to check if a linux service is running. When a passive result check comes in to Nagios, Nagios expects that the result already has a network topology included. Submitting passive host check results to Nagios requires sending a command to the Nagios external command pipe. Expected response string. Consider that you have put your host definitions inside host1.cfg file in /usr/local/nagios/etc/objects directory. Hi, this is a fantastic article, i managed to learn how to make plugins myself. In other cases, passive checks are the way to go. Note that there are possible security implications of this change, so it's worth mentioning a few words: The following tuning should do the trick. Based on the condition checked, the plugin can make Nagios aware of a malfunctioning service. Up To: Contents /usr/lib/nagios/plugins/check_nrpe -H 3.6.123.156 -c check_root_home_du. This requires trying to read the entire disk directly from the block device (such as /dev/sda1) and checking if the attempt has failed. The daemon will listen for connections from remote clients, perform some basic validation on the results being submitted, and then write the check results directly into the external command file (as described above). Then we are removing spaces using sed and finally cut the appropriate field using cut, i this case field 5 is what we want. It looks like that with the default install, theres no configuration set up to tell Icinga where to look for the check_http executable. For Nagios to perform active checks when there is no up-to-date result from passive checks, you need to set the check_freshness directive to 1 and set freshness_threshold to the time period after which a check should be performed. System Monitoring Via Nagios and SNMP< SNMP snmp is an internet protocol that allows you to retrieve management information from a remote device or to set configuration settings on a remote device. It shows what is performed by Nagios in both cases and what needs to be done by the check command or an external application for passive checks. 2022 Company, Inc. All rights reserved. Just cd (or not) into the plugins directory (this directory location varies, depending on how you've installed it, but check /usr/local/nagios, or /usr/lib/nagios). Now send a trap and see how the service appears as in Nagios XI. When new information regarding a service gets passed to Nagios via the external commands pipe, Nagios treats it the same way as if it had been received by an active check. For example . To figure this out I set nagios into debug mode with the configuration like this. Nagios can monitor DNS service by asking the DNS server to either resolve a specific fully qualified domain name (FQDN), or by asking the server to use the dig tool. For any support related questions please visit the Nagios Support Forums at: Article Number: 775 | Rating: Unrated | Last Updated by. Passive service checks are often used to report the results of long lasting tests asynchronously. Complete a blank sample electronically to Method 3. Passive checks are also used when configuring distributed or redundant monitoring installations. No software installation. Otherwise we must rely on parsing the # output from the service management tool. These are executed on regular intervals, as defined by check_interval and retry_interval. Use Hiera. Affordable solution to train a team and make them project ready. Check WMI Plus includes a service module that can check if a service is stopped. As the Nagios toolsets, including NSCA (Nagios Service Check Acceptor for submitting passive check results to the Nagios core server) and NRPE (Nagios Remote Plugin Executor for accepting active check requests from the Nagios core server and send back the results), were initially only developed for Unix-based and Linux Operating Systems, check_http plugin is used to verify the status of HTTP server (or HTTPS) that is running on a remote host. Nagios will ignore all check results for hosts that had not been configured before it was last (re)started. This can cause problems if you are submitting passive checks from a remote host or you have a distributed monitoring setup where the parent/child host relationships are different. A user nagios is created for both localhost and for any host. Why is there a voltage on my HDMI and coaxial cables? This is how your host definitions look currently . What you are doing down is sending a Passive check result for the service SNMP Traps - Users for the host CentOS. Note: A host must be defined in Nagios before you can submit passive check results for it! Note: Passive host checks are normally treated as HARD states, unless the passive_host_checks_are_soft option is enabled. NPCA allows you to check multiple services, here is an example that checks for some services that are running and some that are stopped. http://www.waggy.at/nagios/capture_plugin.htm, Go to your plugin directory - in my example it is, Type you plugin name - in my example it is, now run the full command - (plugin name) -H (hostname) -p (port number), However in this example port number is optional, in your config file which is look something like below (myserver.cfg) and you want to run check_cpu from command line, to check instantly (without GUI green or red), Try this - (plugin full path) - H (servername) -c (checkname). Far better then Nagios documentation. notifications_enabled 0 It can be used to send results from one Nagios instance to another. Repeat this procedure for each Ceph plug-in applicable to the node. These checks help ensure that the dependency logic is as accurate as possible. Nagios can be used to monitor Apache web server as well. Use Puppet environments. Nagios Core and Nagios XI has a features to monitoring website URL status. Thus, the difference between active and passive check is that active checks are run by Nagios and passive checks are run by external applications. When defining and testing new services in nagios I have been restarting nagios, then clicking the service, and rescheduling a check for as soon as possible, then waiting until the check happens. The module can only check if the service is started, you could however use the negate plugin to invert the returned result from the plugin (hence making CRITICAL an OK state). I've # provided some comments here, but things may not be so clear without further # explanation, so make sure to read the HTML documentation! In this example we are going to define a service and assign it to localhost, because this check is on Nagios itself. These state changes result in different state types (HARD or SOFT), which can trigger event handlers to be run and notifications to be sent out. Add the command to the NRPE configuration file on the client (/etc/nagios/nrpe_local.cfg): Now we can access the server and test it like any standard plugin. Kaydolmak ve ilere teklif vermek cretsizdir. The -S option is not working with 2.0 plugins. For those unfamiliar with Nagios, it is a monitoring system which can execute checks. It allows the implementation of plugins, developed by the community, or even allows us to configure our own monitoring scripts. Like every Nagios plugin, you will want to check from the command line before adding it to the configuration files. The object needs to have the passive_checks_enabled option set to 1 for Nagios to accept passive check results over the command pipe. Check HTTPS Check whether Apache HTTPS is running on a remote server using check_http. Nagios check service frequency based on service status, how can execute nagios commands from command line in linux. debug_level=2048 With nagios in debug mode I simply tail the debug_log file debug_file=/var/log/nagios3/nagios.debug. An external application checks the status on hosts/services and writes the result to External Command File. Nagios can monitor different mail server components like SMTP, POP, IMAP and mailq.