LinuxMonitor 1.3.2__tar.gz → 1.3.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.
- {linuxmonitor-1.3.2 → linuxmonitor-1.3.3/LinuxMonitor.egg-info}/PKG-INFO +1 -1
- {linuxmonitor-1.3.2/LinuxMonitor.egg-info → linuxmonitor-1.3.3}/PKG-INFO +1 -1
- {linuxmonitor-1.3.2 → linuxmonitor-1.3.3}/linuxmonitor/linuxmonitor.py +18 -18
- {linuxmonitor-1.3.2 → linuxmonitor-1.3.3}/setup.py +1 -1
- {linuxmonitor-1.3.2 → linuxmonitor-1.3.3}/LICENSE.md +0 -0
- {linuxmonitor-1.3.2 → linuxmonitor-1.3.3}/LinuxMonitor.egg-info/SOURCES.txt +0 -0
- {linuxmonitor-1.3.2 → linuxmonitor-1.3.3}/LinuxMonitor.egg-info/dependency_links.txt +0 -0
- {linuxmonitor-1.3.2 → linuxmonitor-1.3.3}/LinuxMonitor.egg-info/requires.txt +0 -0
- {linuxmonitor-1.3.2 → linuxmonitor-1.3.3}/LinuxMonitor.egg-info/top_level.txt +0 -0
- {linuxmonitor-1.3.2 → linuxmonitor-1.3.3}/README.md +0 -0
- {linuxmonitor-1.3.2 → linuxmonitor-1.3.3}/linuxmonitor/__init__.py +0 -0
- {linuxmonitor-1.3.2 → linuxmonitor-1.3.3}/linuxmonitor/__main__.py +0 -0
- {linuxmonitor-1.3.2 → linuxmonitor-1.3.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: LinuxMonitor
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: LinuxMonitor
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.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
|
|
@@ -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.
|
|
36
|
+
__version__ = "1.3.3 (2024/09/19)"
|
|
37
37
|
__status__ = "Usable for any Linux project"
|
|
38
38
|
|
|
39
39
|
import json
|
|
@@ -235,7 +235,7 @@ 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"
|
|
238
|
+
out_msg += f" - Error code: `{returncode}`"
|
|
239
239
|
|
|
240
240
|
if stderr_str != "":
|
|
241
241
|
out_msg += f"\n - Error log:\n```sh\n{stderr_str}\n```"
|
|
@@ -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"
|
|
306
|
-
f"
|
|
307
|
-
f"
|
|
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"
|
|
413
|
-
f"
|
|
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:
|
|
@@ -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 += "
|
|
918
|
+
out_msg += " - ❌ Not authorized to restart (no 'restart_command')\n"
|
|
919
919
|
else:
|
|
920
920
|
if auto_restart:
|
|
921
|
-
out_msg += "
|
|
921
|
+
out_msg += " - ✅ Can be restarted (automatically & manually)\n"
|
|
922
922
|
else:
|
|
923
|
-
out_msg += "
|
|
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 += "
|
|
926
|
+
out_msg += " - ✅ Can be stopped manually"
|
|
927
927
|
else:
|
|
928
|
-
out_msg += "
|
|
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}"
|
|
@@ -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"
|
|
1240
|
-
f"
|
|
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"
|
|
1245
|
-
f"
|
|
1246
|
-
f"
|
|
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:
|
|
@@ -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"
|
|
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.
|
|
9
|
+
version="1.3.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|