Nagios Server Set Up for Using NSCA
You need to have a working Nagios server to be able to use NSCA. NSCA is not in the CentOS repository so you will need to use the rpmforge repositories. See the Nagios server install in this manual for how to install those repositories.
Nagios Course $295.95 (4 weeks)
Install NSCA (Nagios Service Check Adaptor)
This example is for a CentOS Server.
yum install nsca
Installing : libmcrypt [1/4]
Installing : xinetd [2/4]
Installing : nagios-nsca-client [3/4]
Installing : nagios-nsca [4/4]
Installed: nagios-nsca.i386 0:2.7.2-2.el5.rf
Dependency Installed: libmcrypt.i386 0:2.5.8-4.el5.centos nagios-nsca-client.i386 0:2.7.2-2.el5.rf xinetd.i386 2:2.3.14-10.el5
Set Up Interface for External Commands
The interface on the server that accepts external commands is the External Command Files which is a named pipe in /var/nagios/rw. When you install NSCA it will create this pipe once it is started.
ls -lF /var/nagios/rw
total 0
prw-rw—- 1 nagios apache 0 Sep 8 15:31 nagios.cmd|
When you send commands to the interface it will have to have the form like so:
[epoch timestamp] command;arguments
An example of the external commands can be found at http://nagios.org/developerinfo/externalcommands which lists the commands and shows examples. At this point if you are just learning the external command interface work through the examples of passive host and passive services so you better understand how they work.
Verify external commands are set up in /etc/nagios/nagios.cfg. These are the lines you need to check, typically they should be ready to go. These lines make it possible to send external commands to the Nagios server.
check_external_commands=1
command_check_interval=-1
command_file=/var/nagios/rw/nagios.cmd
log_passive_checks=1
accept_passive_service_checks=1
accept_passive_host_checks=1
Note the command_check_interval is set up so that it will accept passive communication on any time frame, it is not scheduled.
Edit /etc/nagios/nsca.cfg
Most of these settings will be there by default but you need to verify they exist.
server_port=5667
command_file=/var/nagios/rw/nagios.cmd
alternate_dump_file=/var/nagios/rw/nsca.dump
aggregate_writes=0
append_to_file=0
max_packet_age=30
These two file changes are important security issues so that the file is only accessible from the nagios user.
chown nagios:nagios nsca.cfg
chmod 400 nsca.cfg
Failure to make these security changes on a Nagios server with Internet access is asking for trouble.