LinuxMonitor 1.0.1__tar.gz → 1.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: LinuxMonitor
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: Get information and warning status of Linux server like service, port, ping, ssl certificate, disk/folder/cpu/ram/swap usage, ip connection, ... (Python and shell library, Linux ONLY)
5
5
  Home-page: https://github.com/QuentinCG/Linux-Monitor-Python-Library
6
6
  Author: Quentin Comte-Gaz
@@ -27,7 +27,7 @@ Requires-Dist: typing
27
27
  Requires-Dist: asyncio
28
28
 
29
29
  # Linux Monitor (Python library)
30
- [![PyPI version](https://badge.fury.io/py/Linux-Monitor.svg)](https://badge.fury.io/py/Linux-Monitor) [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://github.com/QuentinCG/Linux-Monitor-Python-Library/blob/master/LICENSE.md) [![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://paypal.me/QuentinCG)
30
+ [![PyPI version](https://badge.fury.io/py/LinuxMonitor.svg)](https://pypi.org/project/LinuxMonitor/) [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://github.com/QuentinCG/Linux-Monitor-Python-Library/blob/master/LICENSE.md) [![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://paypal.me/QuentinCG) [![Downloads](https://static.pepy.tech/badge/LinuxMonitor)](https://pepy.tech/project/LinuxMonitor) [![Downloads](https://static.pepy.tech/badge/LinuxMonitor/month)](https://pepy.tech/project/LinuxMonitor)
31
31
 
32
32
  ## What is it
33
33
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: LinuxMonitor
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: Get information and warning status of Linux server like service, port, ping, ssl certificate, disk/folder/cpu/ram/swap usage, ip connection, ... (Python and shell library, Linux ONLY)
5
5
  Home-page: https://github.com/QuentinCG/Linux-Monitor-Python-Library
6
6
  Author: Quentin Comte-Gaz
@@ -27,7 +27,7 @@ Requires-Dist: typing
27
27
  Requires-Dist: asyncio
28
28
 
29
29
  # Linux Monitor (Python library)
30
- [![PyPI version](https://badge.fury.io/py/Linux-Monitor.svg)](https://badge.fury.io/py/Linux-Monitor) [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://github.com/QuentinCG/Linux-Monitor-Python-Library/blob/master/LICENSE.md) [![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://paypal.me/QuentinCG)
30
+ [![PyPI version](https://badge.fury.io/py/LinuxMonitor.svg)](https://pypi.org/project/LinuxMonitor/) [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://github.com/QuentinCG/Linux-Monitor-Python-Library/blob/master/LICENSE.md) [![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://paypal.me/QuentinCG) [![Downloads](https://static.pepy.tech/badge/LinuxMonitor)](https://pepy.tech/project/LinuxMonitor) [![Downloads](https://static.pepy.tech/badge/LinuxMonitor/month)](https://pepy.tech/project/LinuxMonitor)
31
31
 
32
32
  ## What is it
33
33
 
@@ -1,5 +1,5 @@
1
1
  # Linux Monitor (Python library)
2
- [![PyPI version](https://badge.fury.io/py/Linux-Monitor.svg)](https://badge.fury.io/py/Linux-Monitor) [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://github.com/QuentinCG/Linux-Monitor-Python-Library/blob/master/LICENSE.md) [![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://paypal.me/QuentinCG)
2
+ [![PyPI version](https://badge.fury.io/py/LinuxMonitor.svg)](https://pypi.org/project/LinuxMonitor/) [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://github.com/QuentinCG/Linux-Monitor-Python-Library/blob/master/LICENSE.md) [![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://paypal.me/QuentinCG) [![Downloads](https://static.pepy.tech/badge/LinuxMonitor)](https://pepy.tech/project/LinuxMonitor) [![Downloads](https://static.pepy.tech/badge/LinuxMonitor/month)](https://pepy.tech/project/LinuxMonitor)
3
3
 
4
4
  ## What is it
5
5
 
@@ -28,7 +28,7 @@ __email__ = "quentin@comte-gaz.com"
28
28
  __license__ = "MIT License"
29
29
  __copyright__ = "Copyright Quentin Comte-Gaz (2024)"
30
30
  __python_version__ = "3.+"
31
- __version__ = "1.0.1 (2024/09/13)"
31
+ __version__ = "1.0.3 (2024/09/13)"
32
32
  __status__ = "Usable for any Linux project"
33
33
 
34
34
  import json
@@ -701,7 +701,7 @@ class LinuxMonitor:
701
701
 
702
702
  #region Ping Websites
703
703
 
704
- def _ping_website(self, website: str, display_name: str, display_only_if_critical: bool=False) -> str:
704
+ def _ping_website(self, website: str, display_name: str, timeout_in_sec: int, display_only_if_critical: bool=False) -> str:
705
705
  """
706
706
  Ping a website.
707
707
 
@@ -715,7 +715,7 @@ class LinuxMonitor:
715
715
  display_name = f"[{display_name}](https://{website})"
716
716
 
717
717
  start_time: float = time.time()
718
- res, out_msg = self.execute_and_verify(command=ping_command, display_name=f"ping {display_name}", timeout_in_sec=5, display_only_if_critical=display_only_if_critical)
718
+ res, out_msg = self.execute_and_verify(command=ping_command, display_name=f"ping {display_name}", timeout_in_sec=timeout_in_sec, display_only_if_critical=display_only_if_critical)
719
719
  end_time: float = time.time()
720
720
 
721
721
  if res == True and not display_only_if_critical:
@@ -737,7 +737,8 @@ class LinuxMonitor:
737
737
  out_msg: str = ""
738
738
  for ping_config in self.config['pings']:
739
739
  if is_private or is_private == ping_config['is_private']:
740
- result: str = self._ping_website(website=ping_config['website'], display_name=ping_config['display_name'], display_only_if_critical=display_only_if_critical)
740
+ timeout_in_sec: int = ping_config.get('timeout_in_sec', 5)
741
+ result: str = self._ping_website(website=ping_config['website'], display_name=ping_config['display_name'], timeout_in_sec=timeout_in_sec, display_only_if_critical=display_only_if_critical)
741
742
  if result:
742
743
  if out_msg:
743
744
  out_msg += "\n"
@@ -937,6 +938,10 @@ class LinuxMonitor:
937
938
 
938
939
  out_msg_full += out_msg + "\n"
939
940
  out_msg_full += self.restart_service(is_private=is_private, service_name=service_name) + "\n"
941
+ elif status is None:
942
+ out_msg: str = f"⚠️ **Error checking status of {self.config['services'][service_name]['display_name']}** (not restarting it)."
943
+ logging.error(msg=out_msg)
944
+ out_msg_full += out_msg + "\n"
940
945
  except Exception as e:
941
946
  out_msg_full = f"**Internal error during service status check.**:\n```sh\n{e}\n```"
942
947
  logging.exception(msg=out_msg_full)
@@ -6,7 +6,7 @@ with io.open(file='README.md', mode='r', encoding='utf-8') as readme_file:
6
6
 
7
7
  setup(
8
8
  name="LinuxMonitor",
9
- version="1.0.1",
9
+ version="1.0.3",
10
10
  description="Get information and warning status of Linux server like service, port, ping, ssl certificate, disk/folder/cpu/ram/swap usage, ip connection, ... (Python and shell library, Linux ONLY)",
11
11
  long_description=readme,
12
12
  long_description_content_type="text/markdown",
File without changes
File without changes