Nagios

From Indie IT Wiki
Jump to: navigation, search

NOTE: For Nagios3 configuration see here.

Latest Version Downloads

https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.3.4.tar.gz

https://www.nagios.org/downloads/nagios-core/thanks/?t=1472236127

How To Upgrade Nagios Core

sudo -i
cd /tmp/
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-x.y.z.tar.gz
tar xzf nagios-x.y.z.tar.gz
cd nagios-x.y.z
./configure --with-command-group=nagcmd
make all
make install
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios restart
exit

https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/upgrading.html

Change Date Format

sudo nano /usr/local/nagios/etc/nagios.cfg
date_format=iso8601
sudo service nagios restart

Thanks - https://theezitguy.wordpress.com/2015/07/09/nagios-change-date-format/

HOWTO: Only Send 1 Notification Alert

notification_interval 0

HOWTO: SETUP: Windows Monitoring

Download the software for Windows.

https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/monitoring-windows.html

HOWTO: FIX: Apache mod_security denied

/etc/nagios/objects/servers.cfg

define host {
       use                     linux-server
       name                    www.domain.com
       host_name               www.domain.com
       alias                   www.domain.com
       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
}

/etc/nagios/objects/commands.cfg

# '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
}

http://www.mhaller.de/archives/145-Nagios,-mod_security-and-check_http.html

Check Host without Ping

http://www.htmlgraphic.com/nagios-check-host-without-ping/

check_command           check_ssh

send_nsca Test

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

Passive Checks

https://sachinsharm.wordpress.com/2013/08/11/setup-and-configure-nagios-client-nsca-on-centosrhel-6-3/

Troubleshooting / Help

Error: Could not open command file '/usr/local/nagios/var/rw/nagios.cmd' for update!

sudo chgrp nagcmd /usr/local/nagios/var/rw/nagios.cmd

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 {
       host_name      server.domain.com
       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.

http://www.linuxscrew.com/2012/03/16/nagios-timeout/

Web Sites

http://www.packtpub.com/article/troubleshooting-nagios-3.0