LinuxMonitor 1.5.7__tar.gz → 1.5.9__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.7 → linuxmonitor-1.5.9/LinuxMonitor.egg-info}/PKG-INFO +4 -2
- {linuxmonitor-1.5.7/LinuxMonitor.egg-info → linuxmonitor-1.5.9}/PKG-INFO +4 -2
- {linuxmonitor-1.5.7 → linuxmonitor-1.5.9}/README.md +3 -1
- {linuxmonitor-1.5.7 → linuxmonitor-1.5.9}/linuxmonitor/__main__.py +2 -1
- {linuxmonitor-1.5.7 → linuxmonitor-1.5.9}/linuxmonitor/linuxmonitor.py +45 -4
- {linuxmonitor-1.5.7 → linuxmonitor-1.5.9}/setup.py +1 -1
- {linuxmonitor-1.5.7 → linuxmonitor-1.5.9}/LICENSE.md +0 -0
- {linuxmonitor-1.5.7 → linuxmonitor-1.5.9}/LinuxMonitor.egg-info/SOURCES.txt +0 -0
- {linuxmonitor-1.5.7 → linuxmonitor-1.5.9}/LinuxMonitor.egg-info/dependency_links.txt +0 -0
- {linuxmonitor-1.5.7 → linuxmonitor-1.5.9}/LinuxMonitor.egg-info/requires.txt +0 -0
- {linuxmonitor-1.5.7 → linuxmonitor-1.5.9}/LinuxMonitor.egg-info/top_level.txt +0 -0
- {linuxmonitor-1.5.7 → linuxmonitor-1.5.9}/linuxmonitor/__init__.py +0 -0
- {linuxmonitor-1.5.7 → linuxmonitor-1.5.9}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: LinuxMonitor
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.9
|
|
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
|
|
@@ -88,7 +88,6 @@ Additionnal functionalities:
|
|
|
88
88
|
echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /sbin/reboot" >> /etc/sudoers.d/USERNAME_HERE
|
|
89
89
|
# Only if this library should be able to kill a process on demand:
|
|
90
90
|
echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /bin/kill" >> /etc/sudoers.d/USERNAME_HERE
|
|
91
|
-
|
|
92
91
|
# To check last user connection
|
|
93
92
|
echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /usr/bin/last" >> /etc/sudoers.d/USERNAME_HERE
|
|
94
93
|
|
|
@@ -98,6 +97,8 @@ echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /bin/systemctl" >> /etc/sudoers.d/USERNA
|
|
|
98
97
|
echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /etc/init.d/apache2" >> /etc/sudoers.d/USERNAME_HERE
|
|
99
98
|
echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /etc/init.d/mariadb" >> /etc/sudoers.d/USERNAME_HERE
|
|
100
99
|
```
|
|
100
|
+
- Install missing packages :
|
|
101
|
+
- If `last` command not available, install needed package: `sudo apt install wtmpdb util-linux`
|
|
101
102
|
- Check monitor possibilities (you can find it out by calling `python -m linuxmonitor --help` from the root of this repository)
|
|
102
103
|
- Load your shell or python script
|
|
103
104
|
|
|
@@ -213,6 +214,7 @@ Example config entry:
|
|
|
213
214
|
Example of python script using this library:
|
|
214
215
|
- [Discord Bot Linux Monitor](https://github.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library)
|
|
215
216
|
|
|
217
|
+
|
|
216
218
|
## License
|
|
217
219
|
|
|
218
220
|
This project is under MIT license. This means you can use it as you want (just don't delete the library header).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: LinuxMonitor
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.9
|
|
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
|
|
@@ -88,7 +88,6 @@ Additionnal functionalities:
|
|
|
88
88
|
echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /sbin/reboot" >> /etc/sudoers.d/USERNAME_HERE
|
|
89
89
|
# Only if this library should be able to kill a process on demand:
|
|
90
90
|
echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /bin/kill" >> /etc/sudoers.d/USERNAME_HERE
|
|
91
|
-
|
|
92
91
|
# To check last user connection
|
|
93
92
|
echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /usr/bin/last" >> /etc/sudoers.d/USERNAME_HERE
|
|
94
93
|
|
|
@@ -98,6 +97,8 @@ echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /bin/systemctl" >> /etc/sudoers.d/USERNA
|
|
|
98
97
|
echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /etc/init.d/apache2" >> /etc/sudoers.d/USERNAME_HERE
|
|
99
98
|
echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /etc/init.d/mariadb" >> /etc/sudoers.d/USERNAME_HERE
|
|
100
99
|
```
|
|
100
|
+
- Install missing packages :
|
|
101
|
+
- If `last` command not available, install needed package: `sudo apt install wtmpdb util-linux`
|
|
101
102
|
- Check monitor possibilities (you can find it out by calling `python -m linuxmonitor --help` from the root of this repository)
|
|
102
103
|
- Load your shell or python script
|
|
103
104
|
|
|
@@ -213,6 +214,7 @@ Example config entry:
|
|
|
213
214
|
Example of python script using this library:
|
|
214
215
|
- [Discord Bot Linux Monitor](https://github.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library)
|
|
215
216
|
|
|
217
|
+
|
|
216
218
|
## License
|
|
217
219
|
|
|
218
220
|
This project is under MIT license. This means you can use it as you want (just don't delete the library header).
|
|
@@ -47,7 +47,6 @@ Additionnal functionalities:
|
|
|
47
47
|
echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /sbin/reboot" >> /etc/sudoers.d/USERNAME_HERE
|
|
48
48
|
# Only if this library should be able to kill a process on demand:
|
|
49
49
|
echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /bin/kill" >> /etc/sudoers.d/USERNAME_HERE
|
|
50
|
-
|
|
51
50
|
# To check last user connection
|
|
52
51
|
echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /usr/bin/last" >> /etc/sudoers.d/USERNAME_HERE
|
|
53
52
|
|
|
@@ -57,6 +56,8 @@ echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /bin/systemctl" >> /etc/sudoers.d/USERNA
|
|
|
57
56
|
echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /etc/init.d/apache2" >> /etc/sudoers.d/USERNAME_HERE
|
|
58
57
|
echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /etc/init.d/mariadb" >> /etc/sudoers.d/USERNAME_HERE
|
|
59
58
|
```
|
|
59
|
+
- Install missing packages :
|
|
60
|
+
- If `last` command not available, install needed package: `sudo apt install wtmpdb util-linux`
|
|
60
61
|
- Check monitor possibilities (you can find it out by calling `python -m linuxmonitor --help` from the root of this repository)
|
|
61
62
|
- Load your shell or python script
|
|
62
63
|
|
|
@@ -172,6 +173,7 @@ Example config entry:
|
|
|
172
173
|
Example of python script using this library:
|
|
173
174
|
- [Discord Bot Linux Monitor](https://github.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library)
|
|
174
175
|
|
|
176
|
+
|
|
175
177
|
## License
|
|
176
178
|
|
|
177
179
|
This project is under MIT license. This means you can use it as you want (just don't delete the library header).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from .linuxmonitor import LinuxMonitor
|
|
1
|
+
from .linuxmonitor import LinuxMonitor, __version__
|
|
2
2
|
|
|
3
3
|
import argparse
|
|
4
4
|
import sys
|
|
@@ -9,6 +9,7 @@ def main() -> None:
|
|
|
9
9
|
parser = argparse.ArgumentParser(description='System Management CLI Tool')
|
|
10
10
|
|
|
11
11
|
# Define available arguments
|
|
12
|
+
parser.add_argument('--version', action='version', version=f'Linux Monitor {__version__}', help='Show the Linux Monitor library version and exit')
|
|
12
13
|
parser.add_argument('--config_file', type=str, required=True, help='Path to the configuration file (must be a JSON file)')
|
|
13
14
|
parser.add_argument('--start_scheduled_task_check_for_issues', action='store_true', help='Start periodic task to show potential issues periodically (in background, will not stop until you stop the script)')
|
|
14
15
|
parser.add_argument('--start_scheduled_task_show_info', action='store_true', help='Start periodic task to show system information periodically (in background, will not stop until you stop the script)')
|
|
@@ -31,9 +31,9 @@ Non exhaustive list of features (available by using it in shell or in python scr
|
|
|
31
31
|
__author__ = 'Quentin Comte-Gaz'
|
|
32
32
|
__email__ = "quentin@comte-gaz.com"
|
|
33
33
|
__license__ = "MIT License"
|
|
34
|
-
__copyright__ = "Copyright Quentin Comte-Gaz (
|
|
34
|
+
__copyright__ = "Copyright Quentin Comte-Gaz (2026)"
|
|
35
35
|
__python_version__ = "3.+"
|
|
36
|
-
__version__ = "1.5.
|
|
36
|
+
__version__ = "1.5.9 (2026/08/22)"
|
|
37
37
|
__status__ = "Usable for any Linux project"
|
|
38
38
|
|
|
39
39
|
import json
|
|
@@ -1538,6 +1538,30 @@ class LinuxMonitor:
|
|
|
1538
1538
|
|
|
1539
1539
|
return out_msg
|
|
1540
1540
|
|
|
1541
|
+
def get_raw_version(self) -> str:
|
|
1542
|
+
"""
|
|
1543
|
+
Get the raw version of the Linux Monitor library.
|
|
1544
|
+
|
|
1545
|
+
:return: The version string (e.g. "1.5.9 (2026/08/22)").
|
|
1546
|
+
"""
|
|
1547
|
+
return __version__
|
|
1548
|
+
|
|
1549
|
+
def get_version(self) -> str:
|
|
1550
|
+
"""
|
|
1551
|
+
Get the version of the Linux Monitor library.
|
|
1552
|
+
|
|
1553
|
+
:return: A string containing the result message.
|
|
1554
|
+
"""
|
|
1555
|
+
out_msg: str = "# 📦 Linux Monitor version 📦\n"
|
|
1556
|
+
try:
|
|
1557
|
+
out_msg += f"- **{__version__}**"
|
|
1558
|
+
logging.info(msg=out_msg)
|
|
1559
|
+
except Exception as e:
|
|
1560
|
+
out_msg += f"⚠️ **Error getting version**:\n```sh\n{e}\n```"
|
|
1561
|
+
logging.exception(msg=out_msg)
|
|
1562
|
+
|
|
1563
|
+
return out_msg
|
|
1564
|
+
|
|
1541
1565
|
#endregion
|
|
1542
1566
|
|
|
1543
1567
|
#region Users
|
|
@@ -1575,11 +1599,11 @@ class LinuxMonitor:
|
|
|
1575
1599
|
:return: A dictionary containing the recent user logins.
|
|
1576
1600
|
"""
|
|
1577
1601
|
# Format the date without microseconds (milliseconds)
|
|
1578
|
-
past_date: str = (datetime.now() - timedelta(days=days)).strftime('%Y-%m-%
|
|
1602
|
+
past_date: str = (datetime.now() - timedelta(days=days)).strftime('%Y-%m-%d %H:%M:%S')
|
|
1579
1603
|
|
|
1580
1604
|
try:
|
|
1581
1605
|
# Fetch the logs since the specified date
|
|
1582
|
-
command: str = f"sudo last --ip --hostlast --time-format iso --since '{past_date}' | grep 'pts/' || true"
|
|
1606
|
+
command: str = f"sudo /usr/bin/last --ip --hostlast --time-format iso --since '{past_date}' | grep 'pts/' || true"
|
|
1583
1607
|
last_output: str = subprocess.check_output(
|
|
1584
1608
|
args=command,
|
|
1585
1609
|
shell=True,
|
|
@@ -2233,6 +2257,23 @@ class LinuxMonitor:
|
|
|
2233
2257
|
logging.exception(msg=out_msg)
|
|
2234
2258
|
return out_msg
|
|
2235
2259
|
|
|
2260
|
+
def get_command_names(self, is_private: bool) -> List[Tuple[str, str]]:
|
|
2261
|
+
"""
|
|
2262
|
+
Return the available commands (name and display name) for the given visibility.
|
|
2263
|
+
Same visibility rules as list_commands. Useful to build UI autocompletion.
|
|
2264
|
+
|
|
2265
|
+
:param is_private: True to get all commands (private context), False for public-only commands.
|
|
2266
|
+
|
|
2267
|
+
:return: A list of (command_name, display_name) tuples.
|
|
2268
|
+
"""
|
|
2269
|
+
result: List[Tuple[str, str]] = []
|
|
2270
|
+
for command_config_key in self.config['commands'].keys():
|
|
2271
|
+
if is_private or is_private == self.config['commands'][command_config_key]['is_private']:
|
|
2272
|
+
display_name: str = self.config['commands'][command_config_key]['display_name']
|
|
2273
|
+
result.append((command_config_key, display_name))
|
|
2274
|
+
return result
|
|
2275
|
+
|
|
2276
|
+
|
|
2236
2277
|
#endregion
|
|
2237
2278
|
|
|
2238
2279
|
#region Scheduled Tasks
|
|
@@ -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.9",
|
|
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
|