LinuxMonitor 1.2.4__tar.gz → 1.2.5__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.2.4
3
+ Version: 1.2.5
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: LinuxMonitor
3
- Version: 1.2.4
3
+ Version: 1.2.5
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
@@ -30,7 +30,7 @@ __email__ = "quentin@comte-gaz.com"
30
30
  __license__ = "MIT License"
31
31
  __copyright__ = "Copyright Quentin Comte-Gaz (2024)"
32
32
  __python_version__ = "3.+"
33
- __version__ = "1.2.3 (2024/09/16)"
33
+ __version__ = "1.2.5 (2024/09/16)"
34
34
  __status__ = "Usable for any Linux project"
35
35
 
36
36
  import json
@@ -944,13 +944,18 @@ class LinuxMonitor:
944
944
  logging.info(f"Trying to restart {display_name} (command: {service_call}) in less than {timeout_in_sec}sec...")
945
945
 
946
946
  start_time: float = time.time()
947
- res, out_msg = await self.execute_and_verify(command=service_call, display_name=f"restart {display_name}", show_only_std_and_exception=False, timeout_in_sec=timeout_in_sec, display_only_if_critical=False)
947
+ res, res_msg = await self.execute_and_verify(command=service_call, display_name=f"restart {display_name}", show_only_std_and_exception=True, timeout_in_sec=timeout_in_sec, display_only_if_critical=False)
948
948
  end_time: float = time.time()
949
949
 
950
950
  if res == True:
951
951
  readable_duration: str = "{:.2f}".format(end_time - start_time)
952
952
  out_msg = f"✅ **{display_name} restarted with success** in {readable_duration}sec."
953
953
  logging.info(msg=out_msg)
954
+ else:
955
+ out_msg = f"❌ **Error restarting service {display_name}**"
956
+ if res_msg and res_msg != "":
957
+ out_msg += f"\n{res_msg}"
958
+ logging.warning(msg=out_msg)
954
959
 
955
960
  return out_msg
956
961
  except Exception as e:
@@ -1071,10 +1076,11 @@ class LinuxMonitor:
1071
1076
  out_msg_full: str = ""
1072
1077
  try:
1073
1078
  for service_name in self.config["services"].keys():
1079
+ out_msg: str = ""
1074
1080
  if is_private or self.config["services"][service_name]['is_private'] == is_private:
1075
1081
  status, status_msg = await self._get_service_status(is_private=is_private, service_name=service_name)
1076
1082
  if status is False:
1077
- out_msg: str = f"❌ **{self.config['services'][service_name]['display_name']} inactive**. Restarting the service is necessary."
1083
+ out_msg = f"❌ **{self.config['services'][service_name]['display_name']} inactive**. Restarting the service is necessary."
1078
1084
  logging.warning(msg=out_msg)
1079
1085
  if status_msg != "":
1080
1086
  out_msg += f"\n{status_msg}"
@@ -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.2.4",
9
+ version="1.2.5",
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
File without changes