LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-06-2004, 12:05 AM   #1
bax
Member
 
Registered: Dec 2001
Location: NoVA
Distribution: Ubuntu, Solaris, OpenBSD
Posts: 492

Rep: Reputation: 30
Remotely monitor my network?


I'm having problems w/ my ISP at my network at work. They keep losing our connectivity and I need to keep an eye on the connectivity.
Can anybody recommend a simple way just make sure I can hit our IP address? Pretty graphs are nice but as long as I know when the network's down and when it's up I'll be fine. Thanks!
 
Old 04-06-2004, 12:41 AM   #2
adz
Senior Member
 
Registered: Jun 2003
Location: Sydney
Distribution: Debian, FreeBSD
Posts: 1,713

Rep: Reputation: 53
Can't you just ping the IP?
 
Old 04-06-2004, 08:42 AM   #3
bax
Member
 
Registered: Dec 2001
Location: NoVA
Distribution: Ubuntu, Solaris, OpenBSD
Posts: 492

Original Poster
Rep: Reputation: 30
Of course. But I don't want to stay up 24/7 pinging that IP
 
Old 04-06-2004, 08:56 AM   #4
usernamenumber
Member
 
Registered: Sep 2003
Location: Somerville, MA
Distribution: Fedora/RHEL currently. Red Hat, Slackware, Debian, SuSe and Mandrake at other times
Posts: 104

Rep: Reputation: 15
Here's a simple script I use that does something similar. It is meant to run on your machine and tests for connectivity to the outside world (ie is yahoo.com pingable?) and reacts by running a specified command. You could tweak it to run on an external machine, pinging your machine's IP (set the CHECK_ADDR variable) and reacting when the connection is lost.

Code:
#!/bin/sh
### This simple script monitors the state of a network ###

# Configuration variables
CHECK_ADDR="www.yahoo.com"
CHECK_CMD="ping -c1 -w2 $CHECK_ADDR"
OUTAGE_CMD="echo NETWORK OUTAGE DETECTED AT $(date)"
OUTAGE_WAIT=0
RESTORE_CMD="echo NETWORK RESTORE DETECTED AT $(date)"
RESTORE_WAIT=0

# This function does nothing until $CHECK_CMD fails.
# When that happens, $OUTAGE_CMD runs and the function exits
check_for_outage() 
{	
	$CHECK_CMD &> /dev/null
	while [ $? -eq 0 ]
	do
		sleep $OUTAGE_WAIT
		$CHECK_CMD &> /dev/null
	done
	$OUTAGE_CMD
}

# This function is the same as check_for_outage but it waits for $CHECK_CMD to succeed.
# When that happens, $RESTORE_CMD runs and the function exits
check_for_restore()
{
	$CHECK_CMD &> /dev/null
	while [ $? -ne 0 ]
	do
		sleep $RESTORE_WAIT
		$CHECK_CMD &> /dev/null 
	done
	$RESTORE_CMD 
}

# This function loops forever, alternating between checking to see if the net is down
# and checking to see if it's back up again. 
while [ 1 -eq 1 ]
do
	check_for_outage
	check_for_restore
done

Hope this helps.
 
Old 04-06-2004, 09:01 AM   #5
BarryM45
LQ Newbie
 
Registered: Jan 2004
Location: UK, South East
Distribution: slackware, SUSE
Posts: 24

Rep: Reputation: 15
If you have access to snmp comunities on the router read only should be enougth then you could monitor the isp router via snmp alerts. Which could easily be setup to send an alert when the connection has dropped.

if that option is not available then you would need some form of backup link such as a server --> modem link that could dial the same or alternative isp and send snmp alerts to you that way.

best
barry
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Screenlock + Battery Monitor + Network monitor Atrocity Slackware 1 10-02-2005 03:06 PM
Best Network monitor masand Linux - Networking 2 11-20-2004 02:40 PM
More than one monitor in a network? theonebeyond Linux - General 4 09-20-2004 03:26 AM
Network Monitor agallant Linux - Security 4 06-10-2004 04:12 PM
Network Monitor Xiang Wei Linux - Newbie 3 07-17-2002 03:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration