Skip to content

Python script for ping remote resources through the list every with a check interval (with and without color labels),

blyamur/pingG-pingC-Tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pingG-pingC

Python script for ping remote resources through the list every with a check interval (with and without color labels)

Скрипт на Python для пинга удаленных ресурсов по списку, с заданным интервалом проверки (с цветными метками и без них)

pingG-pingC

Description

Описание

This script is written using the python 3 language. Its main task is to check the availability of remote resources, according to a prepared list, with a given check interval. When the script is launched, the resources from the back list are pinged, and based on the response time results, the availability status is generated. Ping repeats through the list at a specified time interval. If there is no connection, it is written to a text log file (in the case of a Windows system, there is also a sound notification).

Данный скрипт написан с использованием языка python 3. Основная его задача проверка доступности удаленных ресурсам, по подготовленному списку, с заданным интервалом проверки. При запуске скрипта, ресурсы из заднного списка, пингуются, а по результатам времени ответа, формируется статус доступности. Пинг повторяется по списку через заданный интервал времени. При отсутствии подключения, производится запись в текстовый log файл ( в случае системы виндовс еще и звуковое оповещение).

Two versions of the script are presented

pingG.py - option without colored labels

pingG

pingC.py - color-coded variant (requires module colorama)

pingC

Представлены две версии скрипта

pingG.py - вариант без цветных меток

pingC.py - вариант с цветными метками (необходим модуль colorama)


Fill in the list of checked resources, it can be both sites and computers and servers in your local network. Set the check interval. After that, simply run the script with administrator rights (in windows, CMD.exe must be run as administrator) this is due to the peculiarity of the operation of the services that do the ping. During the scan, the scan results will be displayed in the console.

Заполняете список проверяемых ресурсов, это могут быть как сайты, так и компьютеры и серверы в вашей локальной сети. Задаете интервал проверки. После чего просто запускаете скрипт с правами администратора (в системе windows, CMD.exe должна быть запущена от имени администратора) это связанно с особенностью работы служб, которые делают пинг. В ходе проверки в консоли будут выводиться результаты проверки.

Start

Запуск

Before starting the script for the first time, you need to install the following modules for Python:

Перед первым запуском скрипта, необходимо установить следующие модули для Python:

pythonping (pip install pythonping)

datetime (pip install datetime)

time (pip install time)

os (pip install os)

If you are using the version with flowers, then you must also install:

Если вы используете версию с цветами то необходимо установить еще и:

colorama (pip install colorama)

Settings

Настройки

In the script, you can manually set the parameters:

sleep_interval = 30  # (In seconds) Check Interval
source = {'8.8.8.8': 'Google',  #list of addresses and names. For example 'IP or domain': 'Source name',
           'yandex.ru': 'ya.ru'}

В скрипте можно вручную задать следующие параметры:

sleep_interval = 30  # (В секундах) Интервал проверки
source = {'8.8.8.8': 'Google',  #список в виде "адрес и название". Для примера 'IP адресили домен': 'Название ресурса',
           'yandex.ru': 'ya.ru'}

The general process is simple and is performed only once if the list of verified resources does not change

Общий процесс прост и выполняется только один раз, если список проверяемых ресурсов не изменяется

  1. Download the script.
  1. Скачиваете скрипт.
  1. Install the required modules.
  1. Устанавливаете необходимые модули.
  1. Fill out the address list.
  1. Заполняете список адресов.
  1. Run the script.
  1. Запускаете скрипт.

This script does not claim to be original or correct. It is provided as is, the main thing is that it completely allows you to solve the tasks.

Данный скрипт не претендует на оригинальность и правильность. Предоставляется как есть, главное он вполне позволяет решать поставленные задачи.

Copyrights and Licenses

Not for commercial use.

Did you find this useful?! | Вы нашли это полезным ?!

Happy to hear that :) If You want to help me, you can buy me a cup of coffee ☕ ( yoomoney or ko-fi, boosty.to )

Рад это слышать :) Если вы хотите мне помочь, вы можете угостить меня чашечкой кофе

Thanks for reading 😻

Спасибо за чтение!

© 2022

About

Python script for ping remote resources through the list every with a check interval (with and without color labels),

Topics

Resources

Stars

Watchers

Forks

Languages