A bi directional script that will monitor the TCP/IP connections between two physical


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting A bi directional script that will monitor the TCP/IP connections between two physical
# 1  
Old 01-16-2009
Power A bi directional script that will monitor the TCP/IP connections between two physical

Dear All ,

I'm looking for a unix script that will monitor the TCP/IP connections between two physical ip addresses and when it dectes an IP is down it generates an alarm and sends SMS to mobile numbers.

Can any one help, I need this urgently.

Waiting for positive replies..


==================================
# 2  
Old 01-16-2009
Hi samura,

If I were in your case, I'd be using 2 scripts.

Script 1 will be the one sending all those pings or "hellos" and will only be executed in one server which will serve as the checker.

Script 2 will be the "agent" who will send "acks" or acknowledgents or just simple ping backs to the server to express that the server is alive.

Its like a "I say hey you say ho" program.

Your problem can be solved with one script only but the problem with that is the checker may be able to ping or "see" the other machine but the other machine may not necessarily be able to "see" the server (due to firewalls or whatever reasons). Hence, the need for the "checker" and the "agent". But like I said earlier, just 1 script can suffice in some cases.

As for the sending of SMS, you'll have to have a machine that picks-up SMS messages and send it.

In my current company, we have an SMS server that parses XML files to be sent as SMS.

What we do is the server (checker), when needed to, ftps an XML file to the SMS server in an XML format. The SMS server, which just waits for available files, picks it up, parses it, then sends it.

The main script can be a cron job or an infinite script that uses a flat-file for reference of servers which it must ping (or ftp a file. The point is it must establish some means of communication with the other machine).

Now the 2nd script (if needed) may be a cron job or an infinite script that just waits for pings (or files from the server) then pings (or ftp's back) just to say "Yep, I'm still here"
# 3  
Old 01-16-2009
hi Ango


Thnx for you reply but i need a sample of these scripts if you have any of them.
# 4  
Old 01-16-2009
Not tested but gives you the idea

Say you have your list.

Code:
cat <list_of_server> | while read x; do
ping $x
if [ $? -ne 0 ]; then
  # Oh no, there's something wrong with the server. Ping exited with a non-zero. Do stuff here like ftp SMS file to your SMS server
fi
done

Check ping command for more info (man ping)

Code:
...
...
If ping does not receive any reply packets at all it will exit with code
1.  On error it exits with code 2. Otherwise it exits with code 0. This
makes it possible to use the exit code to see if a host is alive or not.

This program is intended for use in network testing, measurement and man-
agement.  Because of the load it can impose on the network, it is unwise
to use ping during normal operations or from automated scripts.
...
...

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

30 tcp connections Established for a while and after a few minutes are close

Good morning, I need your help please After Restarting Aps or connection, these are connections tcp 0 0 10.80.1.26.57597 10.81.248.79.53008 ESTABLISHED tcp 0 47 10.80.1.26.57607 10.81.248.79.53008 ESTABLISHED tcp 0 0 ... (4 Replies)
Discussion started by: alexcol
4 Replies

2. IP Networking

Need to know reason for connections closed in netstat -p tcp

Hello netstat -p give below 6634176 connections as closed.How do we trace that which all connections are being closed on the server? 1366888371 data packet headers correctly predicted 1195906 connection requests 5227320 connection accepts 5992919... (6 Replies)
Discussion started by: Vishal_dba
6 Replies

3. AIX

Monitor Physical CPU usage on multiple servers

Hello, Looking for some help. I am trying to gather data at each server showing when the physical CPU is being used the most based on a weekly timeframe. I know this data can be seen through NMON but with multiple servers in our environment it could take a real long time. is there a easier... (4 Replies)
Discussion started by: audis$
4 Replies

4. IP Networking

How to test max number of tcp connections

Hello, I wanna test max tcp connection value. Please suggest how to do that. Thanks. (2 Replies)
Discussion started by: gstoychev
2 Replies

5. Shell Programming and Scripting

Script to block IP with too many connections

Hello everyone. I'd really appreciate some help on this since someone is ddosing or doing something to cause our server to overload. It happens once a day and always from the same isp. I've reported it to abuse email of this isp but they don't seem to care. It happens once a day. And... (0 Replies)
Discussion started by: thesting
0 Replies

6. AIX

Maximum Limit of HMC to handle Physical Power Virtualization Physical Machine

Hello All, Can anybody please tell me what is the maximum limit of Physical IBM Power Machine which can be handled by single HMC at a single point of time? Thanks, Jenish (1 Reply)
Discussion started by: jenish_shah
1 Replies

7. Red Hat

How to kill all active tcp connections from an IP?

How to kill all active tcp connections from an IP? I am using CentOS (3 Replies)
Discussion started by: an00p
3 Replies

8. UNIX for Advanced & Expert Users

Redirecting output to remote monitor over TCP/IP.

We have AIX4.1 (yeah I know - we're upgrading to 5 soon) and have been running almost entirely on ASynch direct connects. We're now converting to TCP/IP thin client terminals and PC's. One of processes was a Turn Around Time screen job that would constantly update various information from 6... (4 Replies)
Discussion started by: gamesman02
4 Replies

9. IP Networking

Unix Scripts & Counting TCP Connections

Here's a question I received on a test recently. I'm new to Linux/Unix so if this is easy, don't kill me. What scripting or tools could you use to count and sort the number of connections from each internal host? I'd appreciate any feedback and resources. "The Cisco PIX firewall provides... (5 Replies)
Discussion started by: daveohr
5 Replies

10. UNIX for Dummies Questions & Answers

Physical volume- no free physical partitions

I was in smit, checking on disc space, etc. and it appears that one of our physical volumes that is part of a large volume group, has no free physical partitions. The server is running AIX 5.1. What would be the advisable step to take in this instance? (9 Replies)
Discussion started by: markper
9 Replies
Login or Register to Ask a Question