As /usr/local/nagios/etc/nsca.cfg is replaced by the default config if opsview has been restarted the reference to this file that resides in /etc/init.d/opsview was changed to /usr/local/nagios/etc/nsca_puppet.cfg and the latter is deployed using a Puppet ERB template.
The aim is to send passive checks using nsca to Opsview.
The hypothesis was that executing:
echo -e "HOST\tService\t0\tRemote File does not exist" | \ sudo /usr/local/nagios/bin/send_nsca -H host -c \ /usr/local/nagios/etc/send_nsca.cfg
would update the (passive) check that reside in Opsview.
Tailing the /var/log/messages indicates the following:
Jan 24 14:27:37 host nsca[X]: Handling the connection for <ip>... Jan 24 14:27:37 host nsca[X]: Command file '/usr/local/nagios/var/rw/nagios.cmd#015' does not exist, attempting to use alternate dump file '/dev/null' for output Jan 24 14:27:37 host nsca[X]: SERVICE CHECK -> Host Name: 'HOST', Service Description: 'Service', Return Code: '0', Output: 'Remote File does not exist' client <ip> Jan 24 14:27:37 host nsca[X]: End of connection for <ip>...
Attempts to solve the issue
1) Perhaps the nsca command should be issued as the nagios user
sudo -u nagios /usr/local/nagios/bin/send_nsca
Does not solve the issue
2) does ncsa run?
user@host:~$ ps -ef | grep nsca nagios PID 1 0 13:38 ? 00:00:00 /usr/local/nagios/bin/nsca -c /usr/local/nagios/etc/nsca.cfg --single
3) does it work to send ncsa commands from localhost
No, does not work either
4) Incorrect permissions nagios.cmd?
Seems to be ok
user@host:~$ ls -ltr /usr/local/nagios/var/rw/ total 4 -rw-rw-r--. 1 nagios nagios 1321 Jan 23 22:13 config_output.last_okay srw-rw----. 1 nagios nagcmd 0 Jan 24 13:38 nagios.qh prw-rw----. 1 nagios nagcmd 0 Jan 24 13:38 nagios.cmd srw-rw----. 1 nagios nagcmd 0 Jan 24 13:38 opsviewd.cmd
5) Does it work to send other checks then the passive ones to Opsview using nsca
The issue occurs for all kind of checks
nagios.cmd#015 does not exist...? nagios.cmd was configured? Or not?
Yes this is correct
7) related bugs to this version of NSCA?
user@host:~$ sudo /usr/local/nagios/bin/nsca --version NSCA - Nagios Service Check Acceptor Copyright (c) 2000-2007 Ethan Galstad (www.nagios.org) Version: 2.7.2 Last Modified: 07-03-2007 License: GPL v2 Encryption Routines: AVAILABLE
Seems to be ok as no issues were found on the internet.
8) Who is allowed to write to nagios.cmd?
User is not allowed to write:
user@host:~$ echo hello >> /usr/local/nagios/var/rw/nagios.cmd -bash: /usr/local/nagios/var/rw/nagios.cmd: Permission denied
while nagios is:
user@host:~$ sudo su - nagios nagios@host:~$ echo hello >> /usr/local/nagios/var/rw/nagios.cmd nagios@host:~$
Several questions could be asked but the assumption at the moment is that the checks could not be processed as these are not written to nagios.cmd.
- Where does the