Inter server communication monitoring

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
sify_nagios
Posts: 54
Joined: Thu Aug 20, 2015 8:01 am

Inter server communication monitoring

Post by sify_nagios »

Hi Team,

I would like to monitor whether port 443 is listening between the Server A and Server B.

If i would configure 443 TCP port check from Nagios, it would be Server C checking port availability with Server B.
Instead of that i would like to know whether port communication between Two servers are fine or not.

Note : Requirement comes in cross platform (Linux, Windows)

Please let me know if my requirement is not clear.

Rgds
Srini
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Inter server communication monitoring

Post by rkennedy »

You can use check_by_ssh or check_nrpe to execute check_http on either Server A or Server B, which would then check the reciprocal.

This document is for monitoring by SSH - https://assets.nagios.com/downloads/nag ... ng_SSH.pdf
See this one for using NRPE - https://assets.nagios.com/downloads/nag ... g_NRPE.pdf

Here's the file that contains the current check_http from Nagios plugins 2.1.1. You'll still need to compile it. - http://www.nagios-plugins.org/download/ ... 1.1.tar.gz
Former Nagios Employee
sify_nagios
Posts: 54
Joined: Thu Aug 20, 2015 8:01 am

Re: Inter server communication monitoring

Post by sify_nagios »

Sorry i may not be clear to you. I don't wanna monitor the port availability from nagios.

Consider below scenario.

APP SERVER in my infra is SERVER A.
DB SERVER = SERVER B.

Nagios server called SERVER C.

From SERVER C i wanna poll either SERVER A or SERVER B to identified port(22 or 23) communication between SERVER A and SERVER B is happening or not.

Hope i am clear to you this time.
Note : Port numbers are only example. We may check different ports.

Kindly guide us to achieve above.

Rgds
Srini
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Inter server communication monitoring

Post by rkennedy »

Got it, you'll still need to use an agent such as NRPE or check_by_ssh so the same links apply.

As for checking the connection, if you run netstat -an on SERVER A or SERVER B, will it show the connection as established?

You should be able to use this plugin I wrote to accomplish checking the established ports. https://raw.githubusercontent.com/rckna ... netstat.sh

Code: Select all

[root@localhost libexec]# netstat -an | grep :22
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0     64 192.168.4.179:22        192.168.5.47:50684      ESTABLISHED
tcp        0      0 192.168.4.179:22        192.168.5.47:64061      ESTABLISHED
tcp6       0      0 :::22                   :::*                    LISTEN

[root@localhost libexec]# netstat -an | grep :22 | grep 'ESTABLISHED'
tcp        0     64 192.168.4.179:22        192.168.5.47:50684      ESTABLISHED
tcp        0      0 192.168.4.179:22        192.168.5.47:64061      ESTABLISHED

[root@localhost libexec]# netstat -an | grep :22 | grep 'ESTABLISHED' | wc -l
2
The plugin as is, doesn't care if they are established or not. So you'll need to modify line 49 to this -

Code: Select all

count=$($netstat -an | grep :$port | grep 'ESTABLISHED' | wc -l)
Former Nagios Employee
sify_nagios
Posts: 54
Joined: Thu Aug 20, 2015 8:01 am

Re: Inter server communication monitoring

Post by sify_nagios »

Hi Team,

Achieved the same by writing two lines of simple code.
Works simple and efficient.

Attached file and steps for same (to newbies like me :D )

Steps:
*************************
Step 1 : Place the file in the below mentioned path of client server(SERVER_A).
/usr/local/nagios/libexec
Note : Please make sure the file has nagios user to execute permission.

Step 2 : Please append the below command in the respective config file.

File path : /usr/local/nagios/etc/nrpe/common.cfg

command[check_net]=/usr/local/nagios/libexec/check_net.sh $ARG1$

Step 3 : Now check from nagios server by following command.

/usr/local/nagios/libexec/check_nrpe -h SERVER_A -c check_ntp -p PORT_NUMBER -d SERVER_B

***************************
Thanks for your support.

Rgds
Srini
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Inter server communication monitoring

Post by lmiltchev »

@sify_nagios Thanks for sharing! Is it all right if we lock this thread?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked