Looking for a connection monitor that tells you if your internet died

Discussion in 'Networking and Security' started by Daal, Jan 21, 2011.

  1. Daal

    Daal

    Not an option, its the wireless internet offered by the building I live
     
    #21     Jan 24, 2011
  2. Opening a TCP connection to see if it connects is sometimes referred to as a TCP-ping.

    A word of caution about TCP-pings. Some servers, such as MySQL, keep track of failed authentication attempts. Remember that from the server's point of view, it accepted the socket and began the authentication protocol which was not successfully completed. A client which repeatedly consumes server resources without successful authentication is, by some servers, treated as a Denial-Of-Service attacker and banned.

    It was a real surprise when seemingly random servers objects were no longer able to connect to any of the MySQL servers after my custom network monitoring tool had been upgraded for a few days. :confused:

    In addition to the methods previously mentioned, there are services on the Internet which will ping your address from several networks, and give you notification/detailed reporting. This can be useful since your server may not be able to notify you that it has lost connectivity. I was able to add monitors on employee's home networks to help with this, but usually a reported outage was due to the employee's network.

    Good Luck with it.
     
    #22     Jan 24, 2011
  3. omti

    omti

    I had the same issue - I have several computers that needs to communicate to a host Server. So I wrote a cmd file which uses the ping -t and tracert (if wanted) and captures the results to a txt file with date and time. I wanted to be able to run the capture from the host server for all my computers, and forget it. I downloaded forfiles.exe from the windows resource kit (google forfiles.exe download), and added a line in the script that deletes old logs to prevent the hard drive from filling up down the road. I've been running this script for several months and works like a champ.

    To create the cmd file. Copy and paste the below script into notepad, and save it any name you want, with a .cmd ext. (example is Ping_Capture.cmd). Make a folder C:\Ping_Test and save the file there (unless you modify the script to run from a different folder)

    A couple of things to look for. Make sure forfiles.exe is your path (I copied it to the windows\system32 folder), and make sure the cmd file ends with .cmd and not .txt. I had to go to a command window and rename it.

    Doubleclick the script and it prompt for
    - the IP address or Host name you want to ping (google.com)
    - folder name (don't put in a path - just the name (Google)
    - how many days to keep the logs
    - include Traceert in the logs (Y/N)

    Then a screen will show the details about the running script. Go to the log files and open them up in notepad.

    ----------------

    @echo off

    Rem This script needs to be ran from C:\Ping_Test, unless the script is modified.
    Rem The script does a tracert, 500 pings and everyday deletes old log files.
    Rem Creates a new log file every hour, in a date folder

    Cls
    Echo.
    Echo.
    Setlocal

    Set _IP_Address=
    Set _Fld_Name=
    Set _Log_Limit=
    Set _Tracert=
    set _tr=

    :IP
    Set /P _IP_Address=Enter IP address or Host Name:
    IF ERRORLEVEL 1 GOTO IP
    :Fdr
    Set /P _Fld_Name=Enter Folder Name:
    IF ERRORLEVEL 1 GOTO Fdr
    :log
    Set /P _Log_Limit=Enter how many days to keep logs:
    IF ERRORLEVEL 1 GOTO Log
    :Trc
    Set /P _Tracert=Inclued Tracert in Logs (Y/N) :
    IF ERRORLEVEL 1 GOTO Trc
    Set _logpath=c:\ping_test\Logs\%_Fld_Name%

    echo %_Tracert%| find /i "Y" >NUL && set _tr=is
    echo %_Tracert%| find /i "N" >NUL && set _tr=is not
    if "%_tr%" == "" (set _tr=is not)
    if not %_log_Limit% LEQ 100 set _log_Limit=1
    for /F "tokens=2-4 delims=/- " %%c in ('date/T') do set _today=%%c-%%d-%%e

    cls
    Echo.
    Echo.
    Echo ******************************************************************
    Echo.
    Echo. Script started on %_today% at %Time%
    Echo. Ping Capture for %_IP_Address%
    Echo. Logs are located at c:\ping_test\Logs\%_Fld_Name%
    Echo. Logs will be kept for %_Log_Limit% Day(s)
    Echo. Trace Route %_tr% included in the logs
    Echo.
    Echo. CTL-C to stop the script
    Echo.
    Echo ******************************************************************

    :Start

    for /F %%a in ('Date /t') do (For /F "delims=/" %%b in ("%%a") do set _pday=%%b)
    for /F "tokens=2-4 delims=/- " %%c in ('date/T') do set _today=%%c-%%d-%%e
    for /F "tokens=1 delims=:" %%h in ('time /t') do set _Hour=%%h
    for /F "tokens=2 delims=:" %%m in ('time /t') do set _min=%%m
    echo %_min%| find /i "AM" >NUL && set _AmPm=AM
    echo %_min%| find /i "PM" >NUL && set _AmPm=PM

    if not exist "%_logpath%\%_today% %_pday%" md "%_logpath%\%_today% %_pday%"
    Set _logfile="%_logpath%\%_today% %_pday%\%_Fld_Name%-%_hour%-%_AmPm%.txt"
    Set _D=Date: %_today%
    Set _T=Time: %Time%

    echo %_D% >> %_logfile%
    echo %_T% >> %_logfile%

    If /i NOT %_Tracert% == Y goto :ping

    tracert %_IP_Address% >> %_logfile%

    :ping
    ping %_IP_Address% -n 500 >> %_logfile%
    echo ----------------------------------------------------------- >> %_logfile%

    for /F "tokens=2-4 delims=/- " %%c in ('date/T') do set _date=%%c-%%d-%%e

    If NOT ("%_today%") == ("%_Date%") goto Cleanup

    :Cleanup

    ForFiles /P "%_logpath%" /d -%_Log_Limit% /C "CMD /C if @isdir==TRUE /Q /S @FILE &RD /Q /S @FILE" 2>Nul

    goto start
     
    #23     Jan 26, 2011
  4. Nothing against, good old cmd or powershell, but I usually write such maintenance scripts in Perl or VBScript(cscript). Perl makes it very easy to do list and date comparisons. VBScript is good if you want to get at performance metrics.
     
    #24     Jan 26, 2011