Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ea8a3ac

Browse files
Network_Monitor script added
1 parent 8da6e06 commit ea8a3ac

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

‎Network_Monitor/Network_Monitor.py‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import ping3
2+
import time
3+
4+
def ping_servers(server_list):
5+
while True:
6+
for server in server_list:
7+
response_time = ping3.ping(server)
8+
if response_time is not None:
9+
print(f"{server} is up (Response Time: {response_time} ms)")
10+
else:
11+
print(f"{server} is down! ALERT!")
12+
13+
time.sleep(60) # Ping every 60 seconds
14+
15+
if __name__ == "__main__":
16+
servers_to_monitor = ["google.com", "example.com", "localhost"]
17+
18+
print("Network Monitoring Script")
19+
print("Press Ctrl+C to stop monitoring")
20+
21+
try:
22+
ping_servers(servers_to_monitor)
23+
except KeyboardInterrupt:
24+
print("\nMonitoring stopped.")

‎Network_Monitor/README.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Network_Monitor
2+
3+
Short description of package/script
4+
5+
- This Script Was simple to setup
6+
- Need import ping3
7+
8+
9+
## Setup instructions
10+
11+
12+
Just Need to run this command "pip install ping3" then run the Network_Monitor.py file and for running python3 is must be installed!
13+
14+
## Detailed explanation of script, if needed
15+
16+
This Script Is Only for Network_Monitoring use only!

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /