LinuxMonitor 1.5.9__tar.gz → 1.5.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: LinuxMonitor
3
- Version: 1.5.9
3
+ Version: 1.5.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
@@ -177,7 +177,7 @@ python3 -m linuxmonitor --list_commands --config_file config-example.json --node
177
177
  python3 -m linuxmonitor --execute_command CUSTOM_COMMAND_HERE --config_file config-example.json --nodebug
178
178
 
179
179
  # Execute a custom command with parameters (only for commands with "accept_parameters": true or a {arg1}/{args} placeholder)
180
- python3 -m linuxmonitor --execute_command unban_ip --parameters "1.2.3.4" --config_file config-example.json --nodebug
180
+ python3 -m linuxmonitor --execute_command unban_ip --parameters "127.0.0.1" --config_file config-example.json --nodebug
181
181
 
182
182
  # Execute all custom commands
183
183
  python3 -m linuxmonitor --execute_all_commands --config_file config-example.json --nodebug
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: LinuxMonitor
3
- Version: 1.5.9
3
+ Version: 1.5.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
@@ -177,7 +177,7 @@ python3 -m linuxmonitor --list_commands --config_file config-example.json --node
177
177
  python3 -m linuxmonitor --execute_command CUSTOM_COMMAND_HERE --config_file config-example.json --nodebug
178
178
 
179
179
  # Execute a custom command with parameters (only for commands with "accept_parameters": true or a {arg1}/{args} placeholder)
180
- python3 -m linuxmonitor --execute_command unban_ip --parameters "1.2.3.4" --config_file config-example.json --nodebug
180
+ python3 -m linuxmonitor --execute_command unban_ip --parameters "127.0.0.1" --config_file config-example.json --nodebug
181
181
 
182
182
  # Execute all custom commands
183
183
  python3 -m linuxmonitor --execute_all_commands --config_file config-example.json --nodebug
@@ -136,7 +136,7 @@ python3 -m linuxmonitor --list_commands --config_file config-example.json --node
136
136
  python3 -m linuxmonitor --execute_command CUSTOM_COMMAND_HERE --config_file config-example.json --nodebug
137
137
 
138
138
  # Execute a custom command with parameters (only for commands with "accept_parameters": true or a {arg1}/{args} placeholder)
139
- python3 -m linuxmonitor --execute_command unban_ip --parameters "1.2.3.4" --config_file config-example.json --nodebug
139
+ python3 -m linuxmonitor --execute_command unban_ip --parameters "127.0.0.1" --config_file config-example.json --nodebug
140
140
 
141
141
  # Execute all custom commands
142
142
  python3 -m linuxmonitor --execute_all_commands --config_file config-example.json --nodebug
@@ -33,7 +33,7 @@ __email__ = "quentin@comte-gaz.com"
33
33
  __license__ = "MIT License"
34
34
  __copyright__ = "Copyright Quentin Comte-Gaz (2026)"
35
35
  __python_version__ = "3.+"
36
- __version__ = "1.5.9 (2026/08/22)"
36
+ __version__ = "1.5.11 (2026/08/29)"
37
37
  __status__ = "Usable for any Linux project"
38
38
 
39
39
  import json
@@ -155,6 +155,10 @@ class LinuxMonitor:
155
155
  raise ValueError("The basic configuration must contain the 'warning_uptime_seconds' key")
156
156
  self.warning_uptime_seconds: int = basic_config.get('warning_uptime_seconds') # type: ignore
157
157
 
158
+ self.processes_to_display_if_error: int = 10
159
+ if 'processes_to_display_if_error' in basic_config:
160
+ self.processes_to_display_if_error = basic_config.get('processes_to_display_if_error') # type: ignore
161
+
158
162
  self.excluded_interfaces: List[str] = basic_config.get('excluded_interfaces', []) # type: ignore
159
163
 
160
164
  # Get the scheduled tasks for issues configuration
@@ -614,7 +618,7 @@ class LinuxMonitor:
614
618
  out_msg = f"- 🚨 **Critical CPU usage**:\n- **{cpu_percent:.2f}%** used on {cpu_cores} core of {cpu_info:.2f}GHz ({cpu_name})\n⚠️ **Check what is using so much CPU power** ⚠️"
615
619
 
616
620
  # If there is a critical CPU usage, we also display the top 10 processes consuming the most CPU
617
- out_msg += "\n" + await self.get_ordered_processes(get_non_consuming_processes=False, order_by_ram=False, max_processes=10)
621
+ out_msg += "\n" + await self.get_ordered_processes(get_non_consuming_processes=False, order_by_ram=False, max_processes=self.processes_to_display_if_error)
618
622
 
619
623
  logging.warning(msg=out_msg)
620
624
  elif not display_only_if_critical:
@@ -657,7 +661,7 @@ class LinuxMonitor:
657
661
  out_msg = f"- 🚨 **Critical RAM usage**:\n- Total: {total_ram:.2f}GB\n- Used: {used_ram:.2f}GB ({percent_ram:.2f}%)\n- Free: {free_ram:.2f}GB\n⚠️ **Check what is using so much RAM** ⚠️"
658
662
 
659
663
  # If there is a critical RAM usage, we also display the top 10 processes consuming the most RAM
660
- out_msg += "\n" + await self.get_ordered_processes(get_non_consuming_processes=False, order_by_ram=True, max_processes=10)
664
+ out_msg += "\n" + await self.get_ordered_processes(get_non_consuming_processes=False, order_by_ram=True, max_processes=self.processes_to_display_if_error)
661
665
 
662
666
  logging.warning(msg=out_msg)
663
667
  elif not display_only_if_critical:
@@ -703,7 +707,7 @@ class LinuxMonitor:
703
707
  out_msg = f"- 🚨 **High load average**: **{avg_load_avg:.2f}%**\n⚠️ **Check what is causing the high load average** ⚠️"
704
708
 
705
709
  # If there is a critical load average, we also display the top 10 processes consuming the most CPU
706
- out_msg += "\n" + await self.get_ordered_processes(get_non_consuming_processes=False, order_by_ram=False, max_processes=10)
710
+ out_msg += "\n" + await self.get_ordered_processes(get_non_consuming_processes=False, order_by_ram=False, max_processes=self.processes_to_display_if_error)
707
711
 
708
712
  logging.warning(msg=out_msg)
709
713
  elif not display_only_if_critical:
@@ -746,7 +750,7 @@ class LinuxMonitor:
746
750
  out_msg = f"- 🚨 **Critical SWAP usage**\n- Total: {total_swap:.2f}GB\n- Used: {used_swap:.2f}GB ({percent_swap:.2f}%)\n- Free: {free_swap:.2f}GB\n⚠️ **Check what is using so much SWAP** ⚠️"
747
751
 
748
752
  # If there is a critical SWAP/RAM usage, we also display the top 10 processes consuming the most RAM
749
- out_msg += "\n" + await self.get_ordered_processes(get_non_consuming_processes=False, order_by_ram=True, max_processes=10)
753
+ out_msg += "\n" + await self.get_ordered_processes(get_non_consuming_processes=False, order_by_ram=True, max_processes=self.processes_to_display_if_error)
750
754
 
751
755
  logging.warning(msg=out_msg)
752
756
  elif not display_only_if_critical:
@@ -1542,7 +1546,7 @@ class LinuxMonitor:
1542
1546
  """
1543
1547
  Get the raw version of the Linux Monitor library.
1544
1548
 
1545
- :return: The version string (e.g. "1.5.9 (2026/08/22)").
1549
+ :return: The version string (e.g. "x.x.x (20xx/xx/xx)").
1546
1550
  """
1547
1551
  return __version__
1548
1552
 
@@ -1816,7 +1820,7 @@ class LinuxMonitor:
1816
1820
  try:
1817
1821
  create_time = datetime.fromtimestamp(process.info['create_time']).strftime("%Y-%m-%d %H:%M:%S")
1818
1822
 
1819
- cmdline = ' '.join(process.info['cmdline']) # Join the command line arguments
1823
+ cmdline = ' '.join(process.info['cmdline'] or []) # cmdline can be None (e.g. kernel threads)
1820
1824
  # Remove extra spaces
1821
1825
  cmdline = re.sub(r'\s+', ' ', cmdline).strip()
1822
1826
  if len(cmdline) > 60:
@@ -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",
9
+ version="1.5.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