How to monitor my connection continuity within 24 hours

10,468

You mentioned using ping, and you're absolutely right, only you don't need to stare at your screen and wait for connectivity issues. Send the output of ping to a file, and Ctrl+C to stop pinging when you feel enough time has passed.

ping 8.8.8.8 > log.txt

8.8.8.8 is Google's public DNS. The ping command will write to log.txt in whatever your current working directory is.

Alternatively, here is a quick-and-dirty way to incorporate time stamps with each ping using Powershell, assuming you're using a version of Windows with PowerShell. When you break and decide to run this again later, it will append to your log file.

    $hostToPing = '8.8.8.8'
    $logPath = "C:\Users\username\Desktop\temp\pinglog.txt"
    $alwaysTrue = 1


while($alwaysTrue -eq "1")
{

        # refresh the timestamp before each ping attempt
        $theTime = Get-Date -format g

        # refresh the ping variable
        $result = ping $hostToPing -n 1

                if ($result -like '*reply*')
                {
                    Write-Output "$theTime - pass - connection to $hostToPing is up" | Out-File $logPath -append
                }
                else
                {
                    Write-Output "$theTime - fail - connection to $hostToPing is down" | Out-File $logPath -append
                }

        Sleep 1
        echo ' '

}
Share:
10,468

Related videos on Youtube

random-xyz
Author by

random-xyz

Updated on September 18, 2022

Comments

  • random-xyz
    random-xyz almost 2 years

    I have a bad ISP, and my internet cuts off for like 10 seconds every 2 hours or so and return. According to my ISP it's fixed, but they've been saying that for weeks now.

    My question is, is there a way to monitor if my internet is being cut off for a duration of 24 hours?

    I tried ping, but it's hardly reliable and I will have to set on front of the pc to keep track.

    Is there a software that can monitor the continuity of my internet connection for 24 hours straight?

    Your help would be highly appreciated on the matter.

    Thank you for taking the time in reading this.

    • conquistador
      conquistador over 8 years
      Depending on the brand/firmware most routers and modems have built-in capabilities to log your connection status. Have you checked them?
    • random-xyz
      random-xyz over 8 years
      @MustafaAKTAŞ, thank you for your response, I have a DLINK DSL-2740U, however the only report available is a general statistics report, that shows the amount of packets sent and received, but nothing to indicate if the the internet connection is being lost, I was wondering if there's a software that does the same job as the pinging function but with detailed reports, That I can know if at some point the destination was unreachable, or something along those lines.
    • Matt King
      Matt King over 8 years
      Wireshark might fit the bill?
  • Zoredache
    Zoredache over 8 years
    Just a thought, but if you are going to use Powershell, why not use Test-Connection which do a ping with the default options, and the output can be used directly. ie if (Test-Connection remotehost -Count 1) { "pass"} else { "fail" } .