Nagios Training: Install xinetd for NSCA

by Mike on September 15, 2009 · 1 comment

in Nagios

Install xinetd and edit ncsa
xinetd is the superdaemon which will listen in behalf of NCSA to protect it from abuse. You will find the configuration file in /etc/xinetd.d, here is the file.
Lesson 2 | Lesson 4

# description: NSCA (Nagios Service Check Acceptor)
service nsca
{
flags           = REUSE
type            = UNLISTED
port            = 5667
socket_type     = stream
wait            = no
user            = nagios
group           = nagios
server          = /usr/sbin/nsca
server_args     = -c /etc/nagios/nsca.cfg –inetd
log_on_failure  += USERID
disable         = no
only_from       = 127.0.0.1 192.168.5.91
}

Two important changes have been made to this file.  The disable=yes have been changed to disable=no and the only_from now includes the IP Address of the clients which will connect to the server using the NSCA.  Be sure to include the local host as well and separate IP Addresses with spaces.

Edit /etc/services
Be sure that Nagios can interpret the ports that are being used.  If you are using NRPE list that port as well as NSCA.  Edit the file with the two necessary sections the daemon and then the port followed by the protocol.

nrpe            5666/tcp                        # NRPE
nsca            5667/tcp                        #  NSCA

Restart xinetd
In order to get everything working on the Nagios server you will need to restart xinetd.
service xinetd restart

Verify it is Working
By using this command you can verify that your daemon is listening on the correct port 5667 for nsca.
netstat -aunt
tcp        0      0 0.0.0.0:5667        0.0.0.0:*          LISTEN

Set Up Host
You will need to edit the /etc/nagios/objects/hosts.cfg so that it will accept passive connections from the client.  In this example, active checks are disabled and passive checks are enabled.  Be careful with the host_name as this will be used both in the configuration on the Nagios server and on the client configuration, they need to match.

define host
{
use                           generic-host
host_name                     passnag
address                       192.168.5.91
active_checks_enabled         0
passive_checks_enabled        1
}

You will also need to set up a service which will provide passive checks. This will be discussed in the client section under the passive service test.

This completes the server configuration.

Previous post:

Next post: