Skip to content
/ mon-con Public

PowerShell script to monitor network connection (w/ console output)

License

Notifications You must be signed in to change notification settings

poeggi/mon-con

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

.\mon-con.ps1

SYNOPSIS

MON(itor)-CON(nection), test and monitor your internet connection.

SYNTAX

.\mon-con.ps1 [-BeepOnError] [[-Display] <String>] [[-FocusTest] <String>] [[-Iterations] <Int32>] [-ListTests] [[-TestInterval] <Int32>] [[-Timeout] <Int32>] [<CommonParameters>]

DESCRIPTION

This script does monitor a chain of interfaces / connections.

DEV<->LAN<->ROUTER<->INTERNET<->Ext.SERVER

IPv4 and IPv6 are tested concurrently, if available.

From your local system, all the way up the the mighty internet, it tests different intermediate hops. These hops are automatically determined.

It runs in the foreground and cyclically generates information on the console.

There is a number of Ping and DNS tests already defined and enabled. These tests should allow debugging an internet connection and help identify the cause for spurious connectivity problems.

Each test can either pass (green) or fail (red).
Warnings in (yellow), e.g. if a ping tests RTT is high or DNS TTL is 0.

PARAMETERS

-BeepOnError <SwitchParameter>

Switch to enable acoustic feedback (beeping) for every test that failed.

Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Accept wildcard characters?  false

-Display <String>

Define [enum] how to scroll the output and which information to retain.
Full -> Retain all test lines, scroll after each test (Default)
Warning -> Retain lines with Error or Warning
Error -> Retain only lines with Error
Note: Output will also retain margin, i.e. one line before/after an event.

Required?                    false
Position?                    1
Default value                Full
Accept pipeline input?       false
Accept wildcard characters?  false

-FocusTest <String>

With this parameter, only the test named [string] is executed.

Required?                    false
Position?                    2
Default value
Accept pipeline input?       false
Accept wildcard characters?  false

-Iterations <Int32>

Define the [int] number of cycles that the test(s) will be run.
Default is -1, i.e. infinitely (until CTRL-C is received).

Required?                    false
Position?                    3
Default value                -1
Accept pipeline input?       false
Accept wildcard characters?  false

-ListTests <SwitchParameter>

Switch to make the script print a list of available tests. No test(s) will actually be run.

Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Accept wildcard characters?  false

-TestInterval <Int32>

Defines the [int] cycle time (in milliseconds) at which tests are repeated.
Default is 3000(ms), i.e. 3 seconds.
NOTE: in most setups, 3 (seconds) is the lowest usable value.

Required?                    false
Position?                    4
Default value                3000
Accept pipeline input?       false
Accept wildcard characters?  false

-Timeout <Int32>

The [int] time to wait for any individual test to complete, in milliseconds. Default is 2000(ms), i.e. 2 seconds.
NOTE: in most setups, 2 (seconds) is the lowest viable value.

Required?                    false
Position?                    5
Default value                2000
Accept pipeline input?       false
Accept wildcard characters?  false

INPUTS

None. You can't pipe objects.

OUTPUTS

Only Text (as this is a command-line live monitoring tool).

NOTES

Author : Kai Poggensee
Version : 0.3 (2024-11-05) - Add WWAN / direct P2P connection support

EXAMPLES

EXAMPLE 1

PS>.\mon-con.ps1 -BeepOnError -Display Warning -Timeout 2500 -Verbose

About

PowerShell script to monitor network connection (w/ console output)

Resources

License

Stars

Watchers

Forks

Packages

No packages published