LinuxMonitor 1.3.9__tar.gz → 1.3.11__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.9 → linuxmonitor-1.3.11/LinuxMonitor.egg-info}/PKG-INFO +1 -1
- {linuxmonitor-1.3.9/LinuxMonitor.egg-info → linuxmonitor-1.3.11}/PKG-INFO +1 -1
- {linuxmonitor-1.3.9 → linuxmonitor-1.3.11}/linuxmonitor/linuxmonitor.py +19 -11
- {linuxmonitor-1.3.9 → linuxmonitor-1.3.11}/setup.py +1 -1
- {linuxmonitor-1.3.9 → linuxmonitor-1.3.11}/LICENSE.md +0 -0
- {linuxmonitor-1.3.9 → linuxmonitor-1.3.11}/LinuxMonitor.egg-info/SOURCES.txt +0 -0
- {linuxmonitor-1.3.9 → linuxmonitor-1.3.11}/LinuxMonitor.egg-info/dependency_links.txt +0 -0
- {linuxmonitor-1.3.9 → linuxmonitor-1.3.11}/LinuxMonitor.egg-info/requires.txt +0 -0
- {linuxmonitor-1.3.9 → linuxmonitor-1.3.11}/LinuxMonitor.egg-info/top_level.txt +0 -0
- {linuxmonitor-1.3.9 → linuxmonitor-1.3.11}/README.md +0 -0
- {linuxmonitor-1.3.9 → linuxmonitor-1.3.11}/linuxmonitor/__init__.py +0 -0
- {linuxmonitor-1.3.9 → linuxmonitor-1.3.11}/linuxmonitor/__main__.py +0 -0
- {linuxmonitor-1.3.9 → linuxmonitor-1.3.11}/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.11
|
|
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.11
|
|
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.11 (2024/09/23)"
|
|
37
37
|
__status__ = "Usable for any Linux project"
|
|
38
38
|
|
|
39
39
|
import json
|
|
@@ -146,6 +146,8 @@ class LinuxMonitor:
|
|
|
146
146
|
raise ValueError("The basic configuration must contain the 'warning_uptime_seconds' key")
|
|
147
147
|
self.warning_uptime_seconds: int = basic_config.get('warning_uptime_seconds') # type: ignore
|
|
148
148
|
|
|
149
|
+
self.excluded_interfaces: List[str] = basic_config.get('excluded_interfaces', []) # type: ignore
|
|
150
|
+
|
|
149
151
|
# Get the scheduled tasks for issues configuration
|
|
150
152
|
if self.allow_scheduled_tasks_check_for_issues:
|
|
151
153
|
schedule_check_for_issues_config: Dict[str, Any] = self.config.get('scheduled_tasks_check_for_issues', {}) # type: ignore
|
|
@@ -196,6 +198,9 @@ class LinuxMonitor:
|
|
|
196
198
|
md: str = ""
|
|
197
199
|
indent: str = " " * level # type: ignore # Indentation for markdown headings
|
|
198
200
|
|
|
201
|
+
# Preprocess the input to convert single quotes to double quotes
|
|
202
|
+
json_string = re.sub(r"'", '"', json_string)
|
|
203
|
+
|
|
199
204
|
# Parse the JSON string to a Python object
|
|
200
205
|
try:
|
|
201
206
|
data = json.loads(json_string)
|
|
@@ -212,11 +217,13 @@ class LinuxMonitor:
|
|
|
212
217
|
md += f"{indent}- {key}\n"
|
|
213
218
|
process_data(value, level + 1) # type: ignore
|
|
214
219
|
elif isinstance(data, list):
|
|
215
|
-
|
|
216
|
-
md += f"{indent}-
|
|
217
|
-
|
|
220
|
+
if not data: # Show "nothing" for empty lists
|
|
221
|
+
md += f"{indent}- Nothing\n"
|
|
222
|
+
else:
|
|
223
|
+
for item in data: # type: ignore
|
|
224
|
+
process_data(item, level) # Skip "Item" label # type: ignore
|
|
218
225
|
else:
|
|
219
|
-
md += f"{indent}
|
|
226
|
+
md += f"{indent}- {data}\n"
|
|
220
227
|
|
|
221
228
|
process_data(data, level)
|
|
222
229
|
|
|
@@ -1826,11 +1833,8 @@ class LinuxMonitor:
|
|
|
1826
1833
|
stats = psutil.net_if_stats()
|
|
1827
1834
|
network_usage: str = ""
|
|
1828
1835
|
|
|
1829
|
-
# List of interfaces to exclude (e.g., local interface)
|
|
1830
|
-
excluded_interfaces = {"lo"}
|
|
1831
|
-
|
|
1832
1836
|
for interface in interfaces:
|
|
1833
|
-
if interface in excluded_interfaces or interface not in stats:
|
|
1837
|
+
if interface in self.excluded_interfaces or interface not in stats:
|
|
1834
1838
|
continue
|
|
1835
1839
|
|
|
1836
1840
|
ip_addresses = []
|
|
@@ -1919,7 +1923,9 @@ class LinuxMonitor:
|
|
|
1919
1923
|
is_content_json: bool = self.config['commands'][command_config_key].get('is_content_json', False)
|
|
1920
1924
|
timeout_in_sec: int = self.config['commands'][command_config_key].get('timeout_in_sec', 10)
|
|
1921
1925
|
|
|
1922
|
-
res: str = await self._execute_command(command=command, display_name=display_name, show_content_if_success=show_content_if_success,
|
|
1926
|
+
res: str = await self._execute_command(command=command, display_name=display_name, show_content_if_success=show_content_if_success,
|
|
1927
|
+
show_content_if_issue=show_content_if_issue, is_content_json=is_content_json,
|
|
1928
|
+
timeout_in_sec=timeout_in_sec, display_only_if_critical=False)
|
|
1923
1929
|
if res != "":
|
|
1924
1930
|
if out_msg != "":
|
|
1925
1931
|
out_msg += "\n"
|
|
@@ -1957,7 +1963,9 @@ class LinuxMonitor:
|
|
|
1957
1963
|
if is_scheduled_tasks_for_infos and not self.config['commands'][command_config_key].get('execute_in_scheduled_tasks_for_infos', False):
|
|
1958
1964
|
continue
|
|
1959
1965
|
|
|
1960
|
-
res: str = await self._execute_command(command=command, display_name=display_name, show_content_if_success=show_content_if_success,
|
|
1966
|
+
res: str = await self._execute_command(command=command, display_name=display_name, show_content_if_success=show_content_if_success, # type: ignore
|
|
1967
|
+
show_content_if_issue=show_content_if_issue, is_content_json=is_content_json,
|
|
1968
|
+
timeout_in_sec=timeout_in_sec, display_only_if_critical=display_only_if_critical)
|
|
1961
1969
|
if res != "":
|
|
1962
1970
|
if out_msg != "":
|
|
1963
1971
|
out_msg += "\n"
|
|
@@ -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.11",
|
|
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
|