Page 2 of 5

Re: Nagios and NSCA (for Munin)

Posted: Thu Aug 23, 2012 3:37 am
by gshergill
Hi scottwilkerson,

Thanks for the response.

The following is the output from netstat on Nagios XI machine;

Code: Select all

[root@nagiosxi etc]# netstat -l -n|grep 5667
tcp        0      0 :::5667                     :::*                        LISTEN      
The following is the output from telnet on Munin machine;

Code: Select all

root@muninnagios:~# telnet 192.168.3.121 5667
Trying 192.168.3.121...
telnet: Unable to connect to remote host: No route to host
The only place where I know 5667 is on the Munin machine is in the file;

/etc/xinetd.d/nsca

Where I have the following;

Code: Select all

# description: NSCA (Nagios Service Check Acceptor)
service nsca
{
 flags           = REUSE
 type            = UNLISTED
 port            = 5667
 socket_type     = stream
 wait            = no

 server          = /usr/sbin/nsca
 server_args     = -c /usr/local/nagios/etc/nsca.cfg --inetd
 user            = nagios
 group           = nagios

 log_on_failure  += USERID

 only_from       = 192.168.3.121

}
Not really sure if that's right (mentions Nagios file that doesn't exist as it doesn't have Nagios installed on the Munin machine...).

Using the command below you can install a nsca.cfg file (/etc/nsac.cfg), but once again it uses Nagios references in that file and changed them to the same as the Nagios XI machine still leads to the above telnet error.

Code: Select all

aptitude install nsca


Thank you.

Kind Regards,

gshergill

Re: Nagios and NSCA (for Munin)

Posted: Thu Aug 23, 2012 4:59 am
by gshergill
Hi guys,

Quick update.

Checking the versions installed on NSCA,

On Nagios XI the version is 2.9.1 on the client (send_nsca) and on the standard nsca.

On Munin the version is 2.7.2 on the client (send_nsca).

Could this be an issue?

Thank you.

Kind Regards,

gshergill

Re: Nagios and NSCA (for Munin)

Posted: Thu Aug 23, 2012 9:22 am
by scottwilkerson
Yep, it could, we have seen some backwards compatibility issues. You can run the following on the XI server to roll back to 2.7.2

Code: Select all

wget http://assets.nagios.com/downloads/nagiosxi/agents/nsca-downgrade.tar.gz
tar xvf nsca-downgrade.tar.gz
cd nsca
./upgrade

Re: Nagios and NSCA (for Munin)

Posted: Thu Aug 23, 2012 10:10 am
by gshergill
Hi scottwilkerson,

I've downgraded to 2.7.2 as suggested and can confirm it has worked.

The following are the outputs (unchanged):

From NagiosXI;

Code: Select all

[root@nagiosxi ~]# netstat -l -n|grep 5667
tcp        0      0 :::5667                     :::*                        LISTEN     


From Munin;

Code: Select all

root@muninnagios:~# telnet 192.168.3.121 5667
Trying 192.168.3.121...
telnet: Unable to connect to remote host: No route to host
At least can rule out incompatibility as an issue.

The ip tables are also as follows;

Code: Select all

[root@nagiosxi ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
ACCEPT     icmp --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh 
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http 
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:https 
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited 

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited 

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination     
Thanks again.

Kind Regards,

gshergill

Re: Nagios and NSCA (for Munin)

Posted: Thu Aug 23, 2012 10:20 am
by scottwilkerson
The fact you are getting " No route to host" seems to point to the fact that the munin machine doesn't know how to get there...

Can you ping 192.168.3.121 form the munin server?

Re: Nagios and NSCA (for Munin)

Posted: Thu Aug 23, 2012 10:32 am
by gshergill
Hi scottwilkerson,

Yes I am able to ping 192.168.3.121 from the Munin server;

root@muninnagios:~# ping 192.168.3.121
PING 192.168.3.121 (192.168.3.121) 56(84) bytes of data.
64 bytes from 192.168.3.121: icmp_req=1 ttl=64 time=2.71 ms
64 bytes from 192.168.3.121: icmp_req=2 ttl=64 time=0.413 ms
64 bytes from 192.168.3.121: icmp_req=3 ttl=64 time=0.553 ms
^C
--- 192.168.3.121 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.413/1.226/2.714/1.054 ms

Which is why it's so confusing, I can ping it so it knows it's there but it doesn't seem to know where... Is there something wrong with port 5667 on the Munin side maybe?

Thank you.

Kind Regards,

gshergill

Re: Nagios and NSCA (for Munin)

Posted: Thu Aug 23, 2012 12:45 pm
by lmiltchev
Try temporarily disabling the firewall:

Code: Select all

service iptables stop
then try again:

Code: Select all

telnet 192.168.3.121 5667

Re: Nagios and NSCA (for Munin)

Posted: Fri Aug 24, 2012 4:03 am
by gshergill
Hi lmiltchev,

I stopped the IP Tables on Nagios XI machine then ran telnet on the Munin machine.

Here is the result;

Code: Select all

root@muninnagios:~# telnet 192.168.3.121 5667
Trying 192.168.3.121...
Connected to 192.168.3.121.
Escape character is '^]'.
lN??ʦ????ts"?X?*??Uƺs?????f???@???S]#v99??c??ȧ??sC???ﵶ?d
5??n?O]#
        `(???+$A	B?
H߿??#	쪉[kٹ???BY?????G??P7B4
It seems okay because of the line "Connected to 192.168.3.121" but that seems to be a bit of a mess after it, or is that normal?

Running the following commands now as requested in the guide:

On Nagios XI server;

Code: Select all

[root@nagiosxi ~]# /usr/local/nagios/libexec/send_nsca -H localhost -c /usr/local/nagios/etc/send_nsca.cfg
Error: Server closed connection before init packet was received
Error: Could not read init packet from server
On Munin server;

Code: Select all

root@muninnagios:~# /usr/sbin/send_nsca -H 192.168.3.121 -c /etc/send_nsca.cfg
Error: Timeout after 10 seconds
Seems the timeout error is now on the Munin server.

Any idea's what the issue is here please? Note that the passwords in all the send_nsca files are the same on both servers.

Thank you.

Kind Regards,

gshergill

Re: Nagios and NSCA (for Munin)

Posted: Fri Aug 24, 2012 10:34 am
by scottwilkerson
In /etc/xinetd.d/nsca on the Nagios XI server you need to add the munin server's IP in the only_from field. There can be multiple addresses seperated by spaces, ie.

Code: Select all

only_from       = 127.0.0.1 192.168.3.121 <munin_IP>
Then restart xinetd

Code: Select all

service xinetd restart

Re: Nagios and NSCA (for Munin)

Posted: Tue Aug 28, 2012 3:47 am
by gshergill
Hi scottwilkerson,

Sorry for the late response, I've edited the file to add 127.0.0.1 and the Nagios XI IP (I already had the IP for the munin server on there).

The following are now the responses:

On the Nagios XI server;

Code: Select all

[root@nagiosxi ~]# /usr/local/nagios/libexec/send_nsca -H localhost -c /usr/local/nagios/etc/send_nsca.cfg
Error: Timeout after 10 seconds

[root@nagiosxi ~]# /usr/local/nagios/libexec/send_nsca -H 192.168.3.82 -c /usr/local/nagios/etc/send_nsca.cfg
Connection refused by host
Error: Could not connect to host 192.168.3.82 on port 5667
On the Munin server;

Code: Select all

root@muninnagios:~# /usr/sbin/send_nsca -H 192.168.3.121 -c /etc/send_nsca.cfg
Error: Timeout after 10 seconds

root@muninnagios:~# /usr/sbin/send_nsca -H localhost -c /etc/send_nsca.cfg
Connection refused by host
Error: Could not connect to host localhost on port 5667
Not sure why send_nsca to Nagios is timing out, whilst send_nsca to munin is refused.

Thank you.

Kind Regards,

gshergill