Network Monitor
A PowerShell-based network monitoring tool that provides real-time status monitoring of multiple IP addresses with comprehensive logging features.
Features
- Real-time Network Monitoring: Continuously pings specified IP addresses and displays their status
- Visual Status Display: Color-coded console output shows UP/DOWN status at a glance
- Performance Metrics: Tracks min/max/mean response times and success rates
- Trend Indicators: Shows whether response times are increasing, decreasing, or stable
- Comprehensive Logging: Multiple log types for different purposes
- Flexible IP Configuration: Supports both individual IPs and IP ranges
Getting Started
Prerequisites
- Windows with PowerShell 3.0 or later
- Administrative privileges (recommended for reliable ICMP ping)
Installation
- Download the
NetworkMonitor.ps1script - No additional installation required
Usage
Run the script in PowerShell:
.\NetworkMonitor.ps1
To stop monitoring, press Ctrl+C.
Configuration
Edit the script to modify the following:
IP Addresses
Modify the $addressDefinitions array at the top of the script:
$addressDefinitions = @(
"1.1.1.1", # Single IP address
"1.0.0.1", # Single IP address
"8.8.8.8-9" # IP range (will monitor 8.8.8.8 and 8.8.8.9)
)
Monitoring Parameters
Adjust these values in the main monitoring loop:
$pingInterval = 1 # Seconds between pings
$statsLogInterval = 15 # Minutes between logging statistics
$csvLogFrequency = 5 # Log every Nth ping to CSV
Log Location
Change the log directory by modifying:
$logFolder = ".\Logs" # Default is a "Logs" subfolder in the current directory
Log Files
The script creates the following log files in the Logs folder:
| File | Description |
|---|---|
network_monitor.log |
General events and status changes |
statistics.log |
Periodic performance metrics |
ping_data.csv |
Structured ping data for analysis |
errors.log |
Detailed error information |
Console Display
The console display shows:
- IP Address: The address being monitored
- Status: UP (green) or DOWN (red)
- Min: Minimum response time in milliseconds
- Max: Maximum response time in milliseconds
- Mean: Average response time in milliseconds
- Success%: Percentage of successful pings
- Fails: Count of failed pings
- Trend: Direction of recent response times (↑, ↓, or ━)
Use Cases
- Server Monitoring: Track the availability of critical servers
- Network Troubleshooting: Identify intermittent connectivity issues
- Performance Analysis: Monitor response times over time
- Historical Reporting: Use CSV logs for creating reports and visualizations
Advanced Usage
Creating Visualizations
The CSV log file (ping_data.csv) can be imported into tools like Excel or PowerBI to create visualizations of network performance over time.
Scheduled Monitoring
To run the monitor as a scheduled task:
- Create a
.batfile with:powershell -ExecutionPolicy Bypass -File "C:\path\to\NetworkMonitor.ps1" - Set up a scheduled task to run this batch file
Troubleshooting
Common issues:
- Permission errors: Run PowerShell as Administrator
- No responses: Check firewall settings that might block ICMP traffic
- Script errors: Check the
errors.logfile for detailed error information
License
This script is provided as-is with no warranty. Use at your own risk.
Acknowledgments
- Inspired by the need for a simple yet effective network monitoring solution
- PowerShell community for various examples and best practices
Description
Languages
PowerShell
100%