LinuxMonitor 1.3.2__tar.gz → 1.3.4__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.3.2
3
+ Version: 1.3.4
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.3.2
3
+ Version: 1.3.4
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
@@ -33,7 +33,7 @@ __email__ = "quentin@comte-gaz.com"
33
33
  __license__ = "MIT License"
34
34
  __copyright__ = "Copyright Quentin Comte-Gaz (2024)"
35
35
  __python_version__ = "3.+"
36
- __version__ = "1.3.2 (2024/09/19)"
36
+ __version__ = "1.3.4 (2024/09/19)"
37
37
  __status__ = "Usable for any Linux project"
38
38
 
39
39
  import json
@@ -235,13 +235,13 @@ class LinuxMonitor:
235
235
  # Command returned an error code
236
236
  if not show_only_std_and_exception:
237
237
  out_msg = f"❌ **Error {display_name}**\n"
238
- out_msg += f" - Error code: `{returncode}`"
238
+ out_msg += f" - Error code: `{returncode}`"
239
239
 
240
240
  if stderr_str != "":
241
- out_msg += f"\n - Error log:\n```sh\n{stderr_str}\n```"
241
+ out_msg += f"\n - Error log:\n```sh\n{stderr_str}\n```"
242
242
 
243
243
  if stdout_str != "":
244
- out_msg += f"\n - Info:\n```sh\n{stdout_str}\n```"
244
+ out_msg += f"\n - Info:\n```sh\n{stdout_str}\n```"
245
245
  elif res == None:
246
246
  # Command timed out
247
247
  if not show_only_std_and_exception:
@@ -302,9 +302,9 @@ class LinuxMonitor:
302
302
  percent_used: float = (used / total) * 100
303
303
  if critical_disk_percent != -1 and percent_used > critical_disk_percent:
304
304
  out_msg = f"- 🚨 Critical disk {display_name} (`{disk_path}`) space:\n" \
305
- f" - Total: {total_gb:.2f}GB\n" \
306
- f" - Used: {used_gb:.2f}GB ({percent_used:.2f}%)\n" \
307
- f" - Free: {free_gb:.2f}GB\n" \
305
+ f" - Total: {total_gb:.2f}GB\n" \
306
+ f" - Used: {used_gb:.2f}GB ({percent_used:.2f}%)\n" \
307
+ f" - Free: {free_gb:.2f}GB\n" \
308
308
  f"⚠️ **Free up disk space** ⚠️"
309
309
  logging.warning(msg=out_msg)
310
310
  elif not display_only_if_critical:
@@ -409,8 +409,8 @@ class LinuxMonitor:
409
409
 
410
410
  if critical_usage_giga > 0 and total_used_bytes >= critical_usage_giga * (2**30):
411
411
  out_msg = f"- 🚨 Critical folder {display_name} space (`{folder_path}`):\n" \
412
- f" - Total allowed: {critical_usage_giga:.2f}GB\n" \
413
- f" - Used: {total_used_giga:.2f}GB ({percent_used:.2f}%)\n" \
412
+ f" - Total allowed: {critical_usage_giga:.2f}GB\n" \
413
+ f" - Used: {total_used_giga:.2f}GB ({percent_used:.2f}%)\n" \
414
414
  f"⚠️ **Please free up space in this folder** ⚠️"
415
415
  logging.warning(msg=out_msg)
416
416
  elif not display_only_if_critical:
@@ -880,7 +880,7 @@ class LinuxMonitor:
880
880
 
881
881
  if not res and service_name_to_restart != "":
882
882
  restart_msg = await self.restart_service(is_private=is_private, service_name=service_name_to_restart, force_restart=False)
883
- out_msg += f"\n - {restart_msg}"
883
+ out_msg += f"\n - {restart_msg}"
884
884
 
885
885
  if out_msg != "":
886
886
  out_msg = f"# 🌐 Website access state 🌐\n{out_msg}"
@@ -915,17 +915,17 @@ class LinuxMonitor:
915
915
  out_msg += "\n"
916
916
  out_msg += f"- `{service_name}`: {service['display_name']}:\n"
917
917
  if not is_allowed_to_restart:
918
- out_msg += " - ❌ Not authorized to restart (no 'restart_command')\n"
918
+ out_msg += " - ❌ Not authorized to restart (no 'restart_command')\n"
919
919
  else:
920
920
  if auto_restart:
921
- out_msg += " - ✅ Can be restarted (automatically & manually)\n"
921
+ out_msg += " - ✅ Can be restarted (automatically & manually)\n"
922
922
  else:
923
- out_msg += " - ✅ Can be restarted (manually only because 'auto_restart' = false)\n"
923
+ out_msg += " - ✅ Can be restarted (manually only because 'auto_restart' = false)\n"
924
924
 
925
925
  if is_allowed_to_stop:
926
- out_msg += " - ✅ Can be stopped manually"
926
+ out_msg += " - ✅ Can be stopped manually"
927
927
  else:
928
- out_msg += " - ❌ Not authorized to stop manually (no 'stop_command')"
928
+ out_msg += " - ❌ Not authorized to stop manually (no 'stop_command')"
929
929
 
930
930
  if out_msg != "":
931
931
  out_msg = f"# 🔄 Services list 🔄\n{out_msg}"
@@ -1049,7 +1049,7 @@ class LinuxMonitor:
1049
1049
  res, out_msg = await self.execute_and_verify(command=status_command, display_name=f"état de {display_name}", show_only_std_and_exception=True, timeout_in_sec=timeout_in_sec, display_only_if_critical=False, check_also_stdout_not_containing=check_also_stdout_not_containing)
1050
1050
  return res, out_msg
1051
1051
  except Exception as e:
1052
- out_msg = f"⚠️ **Error checking status of service {service_name}**:\n```sh\n{e}\n```"
1052
+ out_msg = f" - ⚠️ **Error checking status of service {service_name}**:\n```sh\n{e}\n```"
1053
1053
  logging.exception(msg=out_msg)
1054
1054
  return None, out_msg
1055
1055
 
@@ -1089,10 +1089,10 @@ class LinuxMonitor:
1089
1089
  out_msg += "\n"
1090
1090
  out_msg += f"- {service_icon} {self.config['services'][service_name]['display_name']}: **{service_status}**"
1091
1091
  if status != True and status_msg != "":
1092
- out_msg += f"\n - {status_msg}"
1092
+ out_msg += f"\n{status_msg}"
1093
1093
 
1094
1094
  if status is False:
1095
- out_msg += f"\n - " + await self.restart_service(is_private=is_private, service_name=service_name, force_restart=False)
1095
+ out_msg += f"\n - " + await self.restart_service(is_private=is_private, service_name=service_name, force_restart=False)
1096
1096
 
1097
1097
  except Exception as e:
1098
1098
  out_msg = f"**Internal error checking services status**:\n```sh\n{e}\n```"
@@ -1236,14 +1236,14 @@ class LinuxMonitor:
1236
1236
 
1237
1237
  if not cert_infos["is_valid"]:
1238
1238
  out_msg = f"- ❌ **Invalid SSL certificate [{display_name}](https://{hostname})**\n" \
1239
- f" - **Certificate expired on {expiry_date.strftime('%d/%m/%Y')}**\n" \
1240
- f" - **Renew the SSL certificate immediately**"
1239
+ f" - **Certificate expired on {expiry_date.strftime('%d/%m/%Y')}**\n" \
1240
+ f" - **Renew the SSL certificate immediately**"
1241
1241
  logging.warning(msg=out_msg)
1242
1242
  elif critical_remaining_days > 0 and remaining_days < critical_remaining_days:
1243
1243
  out_msg = f"- ⚠️ **SSL certificate [{display_name}](https://{hostname}) will expire soon**:\n" \
1244
- f" - Certificate expires on {expiry_date.strftime('%d/%m/%Y')}\n" \
1245
- f" - **{remaining_days} remaining days (which is in less than {critical_remaining_days} days)**\n" \
1246
- f" - **Renew the SSL certificate quickly**"
1244
+ f" - Certificate expires on {expiry_date.strftime('%d/%m/%Y')}\n" \
1245
+ f" - **{remaining_days} remaining days (which is in less than {critical_remaining_days} days)**\n" \
1246
+ f" - **Renew the SSL certificate quickly**"
1247
1247
  logging.warning(msg=out_msg)
1248
1248
  elif not display_only_if_critical:
1249
1249
  if warning_remaining_days > 0 and remaining_days < warning_remaining_days:
@@ -1258,7 +1258,7 @@ class LinuxMonitor:
1258
1258
 
1259
1259
  # Display the error of retrieving the certificate if there is one
1260
1260
  if cert_infos["error"]:
1261
- out_msg += f"\n - Reason: `{cert_infos['error']}`"
1261
+ out_msg += f"\n - Reason: `{cert_infos['error']}`"
1262
1262
  except Exception as e:
1263
1263
  out_msg = f"- ⚠️ **Error checking SSL certificate of [{display_name}](https://{hostname})**:\n```sh\n{e}\n```"
1264
1264
  logging.exception(msg=out_msg)
@@ -1596,7 +1596,7 @@ class LinuxMonitor:
1596
1596
  out_msg += "\n"
1597
1597
 
1598
1598
  restart_res: str = await self.restart_service(is_private=is_private, service_name=service_name_to_restart, force_restart=False)
1599
- out_msg += f" - {restart_res}"
1599
+ out_msg += f" - {restart_res}"
1600
1600
 
1601
1601
  if out_msg != "":
1602
1602
  out_msg = f"# 🛡️ Ports 🛡️\n{out_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.3.2",
9
+ version="1.3.4",
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