4

I've just done a bunch of Nagios installs. Now comes the time to test them. What I'd like to do first is just a quick sanity check to verify the install went correctly.

Is there a quick way to trigger a Nagios alert, with the default install, short of filling up the hard disk using dd or suchlike?

4 Answers 4

5

If it's just to test your alerts/escalations change the Critical threshold on (one of) your check(s) to something that will trigger a CRITICAL check result.

Alternatively use the check_dummy plugin (from the Nagios Plugins pack) and set it up to return a CRITICAL status, for example:

check_dummy!2

Other status codes you can return are:

0 - OK
1 - Warning
2 - Critical
3 - Unknown
1
  • That's exactly what I was looking for, thanks Kev man.
    – Bryan Hunt
    Jul 24, 2012 at 21:52
1

Nagios (as shipped with the EPEL repository) comes with a sample configuration which monitors localhost out of the box, as soon as you service nagios start. If you've installed Nagios from EPEL on a RHEL (or clone) box, then it should already be giving you host and service status reports for localhost.

1

You can send a test notification/alert from the web UI, but that really only tests that the notification command is able to send email.

  1. By default Nagios uses the mail command. Open a console and check if mail is installed. On some minimal Linux installs you will need to install it.
  2. Check if your mail server is correctly configured. You might have to configure Postfix or SendMail, and send a test email from the command line first.
  3. In Nagios 4 web UI, click on a host, open the detail panel and select the "Send custom host notification" from the "Host Commands" menu on the right. This should open a form where you can fill out the fields, select "Forced" and press "Commit" to force a notification.
0

Just use iptables to block communication from your Nagios host to your target machine. Say you are looking at your web servers. Log on to one, and block port 80/443 traffic from you nagios box simulating an outage.

If localhost only, maybe remove the plugin or one of the plugin dependencies. Iptables may still help simulate a failure.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.