From Indie IT Wiki
Jump to: navigation, search

NOTE: For Nagios3 configuration see here.

Latest Version Downloads

How To Upgrade Nagios Core

Change Date Format

sudo nano /usr/local/nagios/etc/nagios.cfg
sudo service nagios restart

Thanks -

HOWTO: Only Send 1 Notification Alert

notification_interval 0

HOWTO: SETUP: Windows Monitoring

Download the software for Windows.

HOWTO: FIX: Apache mod_security denied


define host {
       use                     linux-server
       address                 123.456.789.0      
       check_command           check-host-alive
       passive_checks_enabled  1
       active_checks_enabled   1
       flap_detection_enabled  1
       contact_groups          linux-admins


# 'check_http' command definition
define command{
       command_name    check_http
       # command_line    $USER1$/check_http -I $HOSTADDRESS$ $ARG1$ -t 20
       command_line    $USER1$/check_http -H $HOSTALIAS$ -I $HOSTADDRESS$ -k "Accept: text/html" -t 20

Check Host without Ping

check_command           check_ssh

send_nsca Test

echo "test;test;0;test-output" | /usr/lib/nagios/plugins/send_nsca -H -p 5667 -c /etc/nagios/send_nsca.cfg -d ";"
1 data packet(s) sent to host successfully.

Examples: Passive Checks

Troubleshooting / Help

Error: Could not open command file ‘/var/nagios/rw/nagios.cmd’ for update

Permissions on the command file are correct, but the web server cannot use them. The solution is to add apache to the nagios group.

gpasswd -a apache nagios

Hosts Stay At Status PENDING

Your hosts stay at a pending status because they have no check definition. If you want the hosts to be checked, you should define a check command for them, as in:-

define host {
       check_command  check-host-alive-ping

Then, Nagios will be able to check your hosts.

FIX: Socket timeout after 10 seconds

Open one of nagios' configs where check commands are defined (usually it’s /etc/nagios/commands.cfg file) and find there a block named check_nrpe or check_http, add “-t 20″ to the end of its command_line so it will look like below...

define command {
    command_name    check_nrpe
    command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -t 20
define command {
    command_name    check_http
    command_line    $USER1$/check_http -H $HOSTADDRESS$ -c $ARG1$ -t 20

...and restart Nagios.

Web Sites