├── icmp_monitoring.py └── readme.md /icmp_monitoring.py: -------------------------------------------------------------------------------- 1 | import time 2 | import threading 3 | import subprocess 4 | import matplotlib.pyplot as plt 5 | import matplotlib.animation as animation 6 | from matplotlib import rcParams 7 | import arabic_reshaper 8 | from bidi.algorithm import get_display 9 | import tkinter as tk 10 | from tkinter import simpledialog 11 | 12 | rcParams['font.family'] = 'Tahoma' 13 | rcParams['font.size'] = 12 14 | 15 | def get_ips(): 16 | root = tk.Tk() 17 | root.withdraw() # مخفی کردن پنجره اصلی 18 | ip_input = simpledialog.askstring("Input", "لطفاً IPها را وارد کنید، آنها را با کاما جدا کنید:") 19 | if ip_input: 20 | return ip_input.split(",") 21 | else: 22 | return [] 23 | 24 | ips = get_ips() 25 | if not ips: 26 | print("هیچ IP وارد نشد. برنامه خاتمه یافت.") 27 | exit(1) 28 | 29 | def ping_ips(): 30 | while True: 31 | responses = [] 32 | for ip in ips: 33 | response = subprocess.run(["ping", "-n", "1", "-w", "500", ip], 34 | stdout=subprocess.PIPE, 35 | stderr=subprocess.PIPE, 36 | creationflags=subprocess.CREATE_NO_WINDOW) 37 | responses.append(response.returncode == 0) 38 | ping_results.append(responses) 39 | if len(ping_results) > max_display_time: 40 | ping_results.pop(0) 41 | time.sleep(1) 42 | 43 | fig, ax = plt.subplots() 44 | ping_results = [] 45 | max_display_time = 100 # حداکثر تعداد نقاط زمانی که در نمودار نمایش داده میشود 46 | 47 | def update_graph(i): 48 | ax.clear() 49 | # استفاده از arabic_reshaper و bidi برای پشتیبانی از حروف فارسی و عربی 50 | xlabel = arabic_reshaper.reshape("زمان (ثانیه)") 51 | ylabel = arabic_reshaper.reshape("وضعیت (پاسخ دارد/ندارد)") 52 | xlabel = get_display(xlabel) 53 | ylabel = get_display(ylabel) 54 | 55 | ax.set_title("PHOENIX Monitoring", fontname='Tahoma', loc='right') 56 | ax.set_xlabel(xlabel, fontname='Tahoma', loc='right') 57 | ax.set_ylabel(ylabel, fontname='Tahoma', loc='top') 58 | 59 | times = list(range(len(ping_results))) 60 | for idx, ip in enumerate(ips): 61 | ax.plot(times, [result[idx] for result in ping_results], label=ip) 62 | 63 | ax.set_xlim(left=max(0, len(ping_results) - max_display_time), right=len(ping_results)) 64 | ax.set_ylim(-0.1, 1.1) 65 | 66 | labels = [get_display(arabic_reshaper.reshape(ip)) for ip in ips] 67 | ax.legend(labels=labels, prop={'family': 'Tahoma'}, loc='upper right') 68 | 69 | ping_thread = threading.Thread(target=ping_ips) 70 | ping_thread.daemon = True 71 | ping_thread.start() 72 | 73 | ani = animation.FuncAnimation(fig, update_graph, interval=500, save_count=100, cache_frame_data=False) 74 | 75 | plt.show() 76 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 |
⚡️ Welcome to ICMP Monitor VPS/SERVER ⚡️ 2 | 3 |4 | 🍟 Easy to sell with ICMP Monitor easy install with few clicks 5 |
6 | 7 | ## Support project 8 | 9 | **We don't need financial support, only Star (⭐) is enough, thank you.** 10 | 11 | ## Install & Upgrade 12 | 13 | ``` 14 | mkdir icmp_monitor 15 | cd icmp_monitor 16 | wget https://raw.githubusercontent.com/dev-ir/icmp-monitor/master/icmp_monitoring.py 17 | python icmp_monitoring.py 18 | ``` 19 | 20 | ## Languages 21 | 22 | - English 23 | 24 | ## 🪚 Preview 25 |  26 | 27 | **If this project is helpful to you, you may wish to give it a**:star2: 28 | 29 | 30 | 31 | - USDT (TRC20): `TVUqVMoCEe5DVUoxmPg8MwmgcHvZLqLjr4` 32 | 33 | --------------------------------------------------------------------------------