NSCA Client-Server

NSCA is used for sending results from certain (passive) checks to the Nagios Server.

 


apt-get install libmcrypt*

tar zxvf nsca-2.#.#.tar.gz
./configure
make all

cp -p src/nsca /usr/local/nagios/bin/
chown nagios:nagios /usr/local/nagios/bin/nsca

cp -p src/send_nsca /usr/local/nagios/libexec/
chown nagios:nagios /usr/local/nagios/libexec/send_nsca

cp -p sample-config/nsca.cfg /usr/local/nagios/etc/
chown nagios:nagios /usr/local/nagios/etc/nsca.cfg
chmod 600 /usr/local/nagios/etc/nsca.cfg

vi /usr/local/nagios/etc/nsca.cfg
log_facility=daemon
pid_file=/usr/local/nagios/var/nsca.pid
server_port=5667
nsca_user=nagios
nsca_group=nagios
debug=0
command_file=/usr/local/nagios/var/rw/nagios.cmd
alternate_dump_file=/usr/local/nagios/var/rw/nsca.dump
aggregate_writes=0
append_to_file=0
max_packet_age=30
password=<Your Password for Client-Server>
decryption_method=16

cp -p sample-config/send_nsca.cfg /usr/local/nagios/libexec/
chown nagios:nagios /usr/local/nagios/libexec/send_nsca.cfg
chmod 600 /usr/local/nagios/libexec/send_nsca.cfg

vi /usr/local/nagios/libexec/send_nsca.cfg
password=<Same:Your Password for Client-Server>
encryption_method=16


/usr/local/nagios/bin/nsca -c /usr/local/nagios/etc/nsca.cfg --daemon


vi /lib/systemd/system/nsca.service
[Unit]
Description=Nagios NSCA
Documentation=http://www.nagios.org/documentation
After=var-run.mount nss-lookup.target network.target local-fs.target time-sync.target
[Install]
WantedBy=multi-user.target
[Service]
Type=forking
Restart=on-abort
PIDFile=/usr/local/nagios/var/nsca.pid
ExecStartPre=/bin/sleep 10
ExecStart=/usr/local/nagios/bin/nsca -c /usr/local/nagios/etc/nsca.cfg --daemon
ExecReload=/bin/kill -HUP $MAINPID
ExecStopPost=/bin/rm -f /usr/local/nagios/var/nsca.pid
User=nagios
Group=nagios

 


systemctl daemon-reload
systemctl enable nsca
systemctl start nsca