LinuxMonitor 1.5.3__tar.gz → 1.5.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.
- {linuxmonitor-1.5.3 → linuxmonitor-1.5.4/LinuxMonitor.egg-info}/PKG-INFO +1 -1
- {linuxmonitor-1.5.3/LinuxMonitor.egg-info → linuxmonitor-1.5.4}/PKG-INFO +1 -1
- {linuxmonitor-1.5.3 → linuxmonitor-1.5.4}/linuxmonitor/linuxmonitor.py +15 -5
- {linuxmonitor-1.5.3 → linuxmonitor-1.5.4}/setup.py +1 -1
- {linuxmonitor-1.5.3 → linuxmonitor-1.5.4}/LICENSE.md +0 -0
- {linuxmonitor-1.5.3 → linuxmonitor-1.5.4}/LinuxMonitor.egg-info/SOURCES.txt +0 -0
- {linuxmonitor-1.5.3 → linuxmonitor-1.5.4}/LinuxMonitor.egg-info/dependency_links.txt +0 -0
- {linuxmonitor-1.5.3 → linuxmonitor-1.5.4}/LinuxMonitor.egg-info/requires.txt +0 -0
- {linuxmonitor-1.5.3 → linuxmonitor-1.5.4}/LinuxMonitor.egg-info/top_level.txt +0 -0
- {linuxmonitor-1.5.3 → linuxmonitor-1.5.4}/README.md +0 -0
- {linuxmonitor-1.5.3 → linuxmonitor-1.5.4}/linuxmonitor/__init__.py +0 -0
- {linuxmonitor-1.5.3 → linuxmonitor-1.5.4}/linuxmonitor/__main__.py +0 -0
- {linuxmonitor-1.5.3 → linuxmonitor-1.5.4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: LinuxMonitor
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.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.5.
|
|
3
|
+
Version: 1.5.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.5.
|
|
36
|
+
__version__ = "1.5.4 (2024/10/27)"
|
|
37
37
|
__status__ = "Usable for any Linux project"
|
|
38
38
|
|
|
39
39
|
import json
|
|
@@ -435,7 +435,7 @@ class LinuxMonitor:
|
|
|
435
435
|
|
|
436
436
|
def _get_folder_size_in_bytes(self, start_path: str = '.') -> float:
|
|
437
437
|
"""
|
|
438
|
-
Get the size of a folder in bytes.
|
|
438
|
+
Get the size of a folder in bytes, including hard-linked files only once.
|
|
439
439
|
|
|
440
440
|
:param start_path: The path to the folder.
|
|
441
441
|
|
|
@@ -443,13 +443,23 @@ class LinuxMonitor:
|
|
|
443
443
|
"""
|
|
444
444
|
try:
|
|
445
445
|
total_size = 0
|
|
446
|
+
seen_inodes: set[int] = set() # Track inodes to avoid double-counting hard-linked files
|
|
447
|
+
|
|
446
448
|
for dirpath, _, filenames in os.walk(start_path):
|
|
447
449
|
for f in filenames:
|
|
448
450
|
fp = os.path.join(dirpath, f)
|
|
451
|
+
try:
|
|
452
|
+
# Get file information
|
|
453
|
+
stat_info = os.stat(fp)
|
|
454
|
+
inode = stat_info.st_ino
|
|
455
|
+
|
|
456
|
+
# Include file size only if we haven't seen this inode before
|
|
457
|
+
if inode not in seen_inodes:
|
|
458
|
+
seen_inodes.add(inode)
|
|
459
|
+
total_size += stat_info.st_size
|
|
460
|
+
except FileNotFoundError:
|
|
461
|
+
logging.warning(f"File {fp} not found. It may be a broken link.")
|
|
449
462
|
|
|
450
|
-
# Skip if it is symbolic link
|
|
451
|
-
if not os.path.islink(fp):
|
|
452
|
-
total_size += os.path.getsize(fp)
|
|
453
463
|
logging.info(msg=f"Total size of folder {start_path}: {total_size} bytes")
|
|
454
464
|
return total_size
|
|
455
465
|
except Exception as e:
|
|
@@ -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.5.
|
|
9
|
+
version="1.5.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|