LinuxMonitor 1.0.4__tar.gz → 1.0.6__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.1
2
2
  Name: LinuxMonitor
3
- Version: 1.0.4
3
+ Version: 1.0.6
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
@@ -34,7 +34,7 @@ Requires-Dist: asyncio
34
34
  This python library is designed to be integrated in python or shell projects to monitor Linux servers.
35
35
  It is compatible with python 3+ and usable only on Linux.
36
36
 
37
- It is also designed to be easily integrated in discussion channel bots python scripts (example: [Discord Linux Monitor Bot](https://github.com/QuentinCG/Discord-Linux-Monitor-Bot-Python-Library))
37
+ It is also designed to be easily integrated in discussion channel bots python scripts (example: [Discord Bot Linux Monitor](https://github.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library))
38
38
 
39
39
  <img src="https://github.com/QuentinCG/Linux-Monitor-Python-Library/raw/master/welcome.png" width="300">
40
40
 
@@ -77,14 +77,14 @@ echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /bin/systemctl" >> /etc/sudoers.d/USERNA
77
77
  echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /etc/init.d/apache2" >> /etc/sudoers.d/USERNAME_HERE
78
78
  echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /etc/init.d/mariadb" >> /etc/sudoers.d/USERNAME_HERE
79
79
  ```
80
- - Check monitor possibilities (you can find it out by calling `python -m linuxmonitor.py --help` from the root of this repository)
80
+ - Check monitor possibilities (you can find it out by calling `python -m linuxmonitor --help` from the root of this repository)
81
81
  - Load your shell or python script
82
82
 
83
83
  ## How to use in shell
84
84
 
85
85
  ```shell
86
86
  # Get help
87
- python3 -m linuxmonitor.py --help
87
+ python3 -m linuxmonitor --help
88
88
  # Use "--debug" to show more information during command
89
89
  # Use "--nodebug" to not show any warning information during command
90
90
 
@@ -92,61 +92,61 @@ python3 -m linuxmonitor.py --help
92
92
 
93
93
  # Start periodic task to show potential issues periodically (will run indefinitely)
94
94
  # Best is to call this as a service and put the result in a log file or do something of the stdout
95
- python3 -m linuxmonitor.py --start_scheduled_task_check_for_issues --config_file config-example.json --nodebug
95
+ python3 -m linuxmonitor --start_scheduled_task_check_for_issues --config_file config-example.json --nodebug
96
96
 
97
97
  # Start periodic task to show system information periodically (will run indefinitely)
98
98
  # Best is to call this as a service and put the result in a log file or do something of the stdout
99
- python3 -m linuxmonitor.py --start_scheduled_task_show_info --config_file config-example.json --nodebug
99
+ python3 -m linuxmonitor --start_scheduled_task_show_info --config_file config-example.json --nodebug
100
100
 
101
101
 
102
102
 
103
103
  # View disk space, CPU, RAM, ...
104
- python3 -m linuxmonitor.py --usage --config_file config-example.json
104
+ python3 -m linuxmonitor --usage --config_file config-example.json
105
105
 
106
106
  # View basic system information
107
- python3 -m linuxmonitor.py --os_infos --config_file config-example.json
107
+ python3 -m linuxmonitor --os_infos --config_file config-example.json
108
108
 
109
109
  # View connected users
110
- python3 -m linuxmonitor.py --users --config_file config-example.json
110
+ python3 -m linuxmonitor --users --config_file config-example.json
111
111
 
112
112
  # View last user connections
113
- python3 -m linuxmonitor.py --user_logins --config_file config-example.json
113
+ python3 -m linuxmonitor --user_logins --config_file config-example.json
114
114
 
115
115
  # Check websites (ping)
116
- python3 -m linuxmonitor.py --ping --config_file config-example.json
116
+ python3 -m linuxmonitor --ping --config_file config-example.json
117
117
 
118
118
  # Check SSL certificates
119
- python3 -m linuxmonitor.py --certificates --config_file config-example.json
119
+ python3 -m linuxmonitor --certificates --config_file config-example.json
120
120
 
121
121
  # Check if services are running and restart if down
122
- python3 -m linuxmonitor.py --services_status --config_file config-example.json
122
+ python3 -m linuxmonitor --services_status --config_file config-example.json
123
123
 
124
124
  # List all available services
125
- python3 -m linuxmonitor.py --list_services --config_file config-example.json
125
+ python3 -m linuxmonitor --list_services --config_file config-example.json
126
126
 
127
127
  # Restart all services
128
- python3 -m linuxmonitor.py --restart_all --config_file config-example.json
128
+ python3 -m linuxmonitor --restart_all --config_file config-example.json
129
129
 
130
130
  # Restart a service
131
- python3 -m linuxmonitor.py --restart_service SERVICE_NAME_HERE --config_file config-example.json
131
+ python3 -m linuxmonitor --restart_service SERVICE_NAME_HERE --config_file config-example.json
132
132
 
133
133
  # Check ports
134
- python3 -m linuxmonitor.py --ports --config_file config-example.json
134
+ python3 -m linuxmonitor --ports --config_file config-example.json
135
135
 
136
136
  # List active processes
137
- python3 -m linuxmonitor.py --list_processes --config_file config-example.json
137
+ python3 -m linuxmonitor --list_processes --config_file config-example.json
138
138
 
139
139
  # Stop a process by PID
140
- python3 -m linuxmonitor.py --kill_process PID_HERE --config_file config-example.json
140
+ python3 -m linuxmonitor --kill_process PID_HERE --config_file config-example.json
141
141
 
142
142
  # Restart the entire server
143
- python3 -m linuxmonitor.py --reboot_server --config_file config-example.json
143
+ python3 -m linuxmonitor --reboot_server --config_file config-example.json
144
144
  ```
145
145
 
146
146
  ## How to use in python script
147
147
 
148
148
  Example of python script using this library:
149
- - [Discord Linux Monitor Bot](https://github.com/QuentinCG/Discord-Linux-Monitor-Bot-Python-Library)
149
+ - [Discord Bot Linux Monitor](https://github.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library)
150
150
 
151
151
  ## License
152
152
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: LinuxMonitor
3
- Version: 1.0.4
3
+ Version: 1.0.6
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
@@ -34,7 +34,7 @@ Requires-Dist: asyncio
34
34
  This python library is designed to be integrated in python or shell projects to monitor Linux servers.
35
35
  It is compatible with python 3+ and usable only on Linux.
36
36
 
37
- It is also designed to be easily integrated in discussion channel bots python scripts (example: [Discord Linux Monitor Bot](https://github.com/QuentinCG/Discord-Linux-Monitor-Bot-Python-Library))
37
+ It is also designed to be easily integrated in discussion channel bots python scripts (example: [Discord Bot Linux Monitor](https://github.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library))
38
38
 
39
39
  <img src="https://github.com/QuentinCG/Linux-Monitor-Python-Library/raw/master/welcome.png" width="300">
40
40
 
@@ -77,14 +77,14 @@ echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /bin/systemctl" >> /etc/sudoers.d/USERNA
77
77
  echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /etc/init.d/apache2" >> /etc/sudoers.d/USERNAME_HERE
78
78
  echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /etc/init.d/mariadb" >> /etc/sudoers.d/USERNAME_HERE
79
79
  ```
80
- - Check monitor possibilities (you can find it out by calling `python -m linuxmonitor.py --help` from the root of this repository)
80
+ - Check monitor possibilities (you can find it out by calling `python -m linuxmonitor --help` from the root of this repository)
81
81
  - Load your shell or python script
82
82
 
83
83
  ## How to use in shell
84
84
 
85
85
  ```shell
86
86
  # Get help
87
- python3 -m linuxmonitor.py --help
87
+ python3 -m linuxmonitor --help
88
88
  # Use "--debug" to show more information during command
89
89
  # Use "--nodebug" to not show any warning information during command
90
90
 
@@ -92,61 +92,61 @@ python3 -m linuxmonitor.py --help
92
92
 
93
93
  # Start periodic task to show potential issues periodically (will run indefinitely)
94
94
  # Best is to call this as a service and put the result in a log file or do something of the stdout
95
- python3 -m linuxmonitor.py --start_scheduled_task_check_for_issues --config_file config-example.json --nodebug
95
+ python3 -m linuxmonitor --start_scheduled_task_check_for_issues --config_file config-example.json --nodebug
96
96
 
97
97
  # Start periodic task to show system information periodically (will run indefinitely)
98
98
  # Best is to call this as a service and put the result in a log file or do something of the stdout
99
- python3 -m linuxmonitor.py --start_scheduled_task_show_info --config_file config-example.json --nodebug
99
+ python3 -m linuxmonitor --start_scheduled_task_show_info --config_file config-example.json --nodebug
100
100
 
101
101
 
102
102
 
103
103
  # View disk space, CPU, RAM, ...
104
- python3 -m linuxmonitor.py --usage --config_file config-example.json
104
+ python3 -m linuxmonitor --usage --config_file config-example.json
105
105
 
106
106
  # View basic system information
107
- python3 -m linuxmonitor.py --os_infos --config_file config-example.json
107
+ python3 -m linuxmonitor --os_infos --config_file config-example.json
108
108
 
109
109
  # View connected users
110
- python3 -m linuxmonitor.py --users --config_file config-example.json
110
+ python3 -m linuxmonitor --users --config_file config-example.json
111
111
 
112
112
  # View last user connections
113
- python3 -m linuxmonitor.py --user_logins --config_file config-example.json
113
+ python3 -m linuxmonitor --user_logins --config_file config-example.json
114
114
 
115
115
  # Check websites (ping)
116
- python3 -m linuxmonitor.py --ping --config_file config-example.json
116
+ python3 -m linuxmonitor --ping --config_file config-example.json
117
117
 
118
118
  # Check SSL certificates
119
- python3 -m linuxmonitor.py --certificates --config_file config-example.json
119
+ python3 -m linuxmonitor --certificates --config_file config-example.json
120
120
 
121
121
  # Check if services are running and restart if down
122
- python3 -m linuxmonitor.py --services_status --config_file config-example.json
122
+ python3 -m linuxmonitor --services_status --config_file config-example.json
123
123
 
124
124
  # List all available services
125
- python3 -m linuxmonitor.py --list_services --config_file config-example.json
125
+ python3 -m linuxmonitor --list_services --config_file config-example.json
126
126
 
127
127
  # Restart all services
128
- python3 -m linuxmonitor.py --restart_all --config_file config-example.json
128
+ python3 -m linuxmonitor --restart_all --config_file config-example.json
129
129
 
130
130
  # Restart a service
131
- python3 -m linuxmonitor.py --restart_service SERVICE_NAME_HERE --config_file config-example.json
131
+ python3 -m linuxmonitor --restart_service SERVICE_NAME_HERE --config_file config-example.json
132
132
 
133
133
  # Check ports
134
- python3 -m linuxmonitor.py --ports --config_file config-example.json
134
+ python3 -m linuxmonitor --ports --config_file config-example.json
135
135
 
136
136
  # List active processes
137
- python3 -m linuxmonitor.py --list_processes --config_file config-example.json
137
+ python3 -m linuxmonitor --list_processes --config_file config-example.json
138
138
 
139
139
  # Stop a process by PID
140
- python3 -m linuxmonitor.py --kill_process PID_HERE --config_file config-example.json
140
+ python3 -m linuxmonitor --kill_process PID_HERE --config_file config-example.json
141
141
 
142
142
  # Restart the entire server
143
- python3 -m linuxmonitor.py --reboot_server --config_file config-example.json
143
+ python3 -m linuxmonitor --reboot_server --config_file config-example.json
144
144
  ```
145
145
 
146
146
  ## How to use in python script
147
147
 
148
148
  Example of python script using this library:
149
- - [Discord Linux Monitor Bot](https://github.com/QuentinCG/Discord-Linux-Monitor-Bot-Python-Library)
149
+ - [Discord Bot Linux Monitor](https://github.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library)
150
150
 
151
151
  ## License
152
152
 
@@ -6,7 +6,7 @@
6
6
  This python library is designed to be integrated in python or shell projects to monitor Linux servers.
7
7
  It is compatible with python 3+ and usable only on Linux.
8
8
 
9
- It is also designed to be easily integrated in discussion channel bots python scripts (example: [Discord Linux Monitor Bot](https://github.com/QuentinCG/Discord-Linux-Monitor-Bot-Python-Library))
9
+ It is also designed to be easily integrated in discussion channel bots python scripts (example: [Discord Bot Linux Monitor](https://github.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library))
10
10
 
11
11
  <img src="https://github.com/QuentinCG/Linux-Monitor-Python-Library/raw/master/welcome.png" width="300">
12
12
 
@@ -49,14 +49,14 @@ echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /bin/systemctl" >> /etc/sudoers.d/USERNA
49
49
  echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /etc/init.d/apache2" >> /etc/sudoers.d/USERNAME_HERE
50
50
  echo "USERNAME_HERE ALL=(ALL) NOPASSWD: /etc/init.d/mariadb" >> /etc/sudoers.d/USERNAME_HERE
51
51
  ```
52
- - Check monitor possibilities (you can find it out by calling `python -m linuxmonitor.py --help` from the root of this repository)
52
+ - Check monitor possibilities (you can find it out by calling `python -m linuxmonitor --help` from the root of this repository)
53
53
  - Load your shell or python script
54
54
 
55
55
  ## How to use in shell
56
56
 
57
57
  ```shell
58
58
  # Get help
59
- python3 -m linuxmonitor.py --help
59
+ python3 -m linuxmonitor --help
60
60
  # Use "--debug" to show more information during command
61
61
  # Use "--nodebug" to not show any warning information during command
62
62
 
@@ -64,61 +64,61 @@ python3 -m linuxmonitor.py --help
64
64
 
65
65
  # Start periodic task to show potential issues periodically (will run indefinitely)
66
66
  # Best is to call this as a service and put the result in a log file or do something of the stdout
67
- python3 -m linuxmonitor.py --start_scheduled_task_check_for_issues --config_file config-example.json --nodebug
67
+ python3 -m linuxmonitor --start_scheduled_task_check_for_issues --config_file config-example.json --nodebug
68
68
 
69
69
  # Start periodic task to show system information periodically (will run indefinitely)
70
70
  # Best is to call this as a service and put the result in a log file or do something of the stdout
71
- python3 -m linuxmonitor.py --start_scheduled_task_show_info --config_file config-example.json --nodebug
71
+ python3 -m linuxmonitor --start_scheduled_task_show_info --config_file config-example.json --nodebug
72
72
 
73
73
 
74
74
 
75
75
  # View disk space, CPU, RAM, ...
76
- python3 -m linuxmonitor.py --usage --config_file config-example.json
76
+ python3 -m linuxmonitor --usage --config_file config-example.json
77
77
 
78
78
  # View basic system information
79
- python3 -m linuxmonitor.py --os_infos --config_file config-example.json
79
+ python3 -m linuxmonitor --os_infos --config_file config-example.json
80
80
 
81
81
  # View connected users
82
- python3 -m linuxmonitor.py --users --config_file config-example.json
82
+ python3 -m linuxmonitor --users --config_file config-example.json
83
83
 
84
84
  # View last user connections
85
- python3 -m linuxmonitor.py --user_logins --config_file config-example.json
85
+ python3 -m linuxmonitor --user_logins --config_file config-example.json
86
86
 
87
87
  # Check websites (ping)
88
- python3 -m linuxmonitor.py --ping --config_file config-example.json
88
+ python3 -m linuxmonitor --ping --config_file config-example.json
89
89
 
90
90
  # Check SSL certificates
91
- python3 -m linuxmonitor.py --certificates --config_file config-example.json
91
+ python3 -m linuxmonitor --certificates --config_file config-example.json
92
92
 
93
93
  # Check if services are running and restart if down
94
- python3 -m linuxmonitor.py --services_status --config_file config-example.json
94
+ python3 -m linuxmonitor --services_status --config_file config-example.json
95
95
 
96
96
  # List all available services
97
- python3 -m linuxmonitor.py --list_services --config_file config-example.json
97
+ python3 -m linuxmonitor --list_services --config_file config-example.json
98
98
 
99
99
  # Restart all services
100
- python3 -m linuxmonitor.py --restart_all --config_file config-example.json
100
+ python3 -m linuxmonitor --restart_all --config_file config-example.json
101
101
 
102
102
  # Restart a service
103
- python3 -m linuxmonitor.py --restart_service SERVICE_NAME_HERE --config_file config-example.json
103
+ python3 -m linuxmonitor --restart_service SERVICE_NAME_HERE --config_file config-example.json
104
104
 
105
105
  # Check ports
106
- python3 -m linuxmonitor.py --ports --config_file config-example.json
106
+ python3 -m linuxmonitor --ports --config_file config-example.json
107
107
 
108
108
  # List active processes
109
- python3 -m linuxmonitor.py --list_processes --config_file config-example.json
109
+ python3 -m linuxmonitor --list_processes --config_file config-example.json
110
110
 
111
111
  # Stop a process by PID
112
- python3 -m linuxmonitor.py --kill_process PID_HERE --config_file config-example.json
112
+ python3 -m linuxmonitor --kill_process PID_HERE --config_file config-example.json
113
113
 
114
114
  # Restart the entire server
115
- python3 -m linuxmonitor.py --reboot_server --config_file config-example.json
115
+ python3 -m linuxmonitor --reboot_server --config_file config-example.json
116
116
  ```
117
117
 
118
118
  ## How to use in python script
119
119
 
120
120
  Example of python script using this library:
121
- - [Discord Linux Monitor Bot](https://github.com/QuentinCG/Discord-Linux-Monitor-Bot-Python-Library)
121
+ - [Discord Bot Linux Monitor](https://github.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library)
122
122
 
123
123
  ## License
124
124
 
@@ -28,7 +28,7 @@ __email__ = "quentin@comte-gaz.com"
28
28
  __license__ = "MIT License"
29
29
  __copyright__ = "Copyright Quentin Comte-Gaz (2024)"
30
30
  __python_version__ = "3.+"
31
- __version__ = "1.0.4 (2024/09/14)"
31
+ __version__ = "1.0.6 (2024/09/14)"
32
32
  __status__ = "Usable for any Linux project"
33
33
 
34
34
  import json
@@ -1023,15 +1023,15 @@ class LinuxMonitor:
1023
1023
  expiry_date = cert_infos["expiry_date"]
1024
1024
 
1025
1025
  if not cert_infos["is_valid"]:
1026
- out_msg = f"- 🚨 **Invalid SSL certificate [{display_name}](https://{hostname})**\n" \
1026
+ out_msg = f"- **Invalid SSL certificate [{display_name}](https://{hostname})**\n" \
1027
1027
  f" - **Certificate expired on {expiry_date.strftime('%d/%m/%Y')}**\n" \
1028
- f"⚠️ **Renew the SSL certificate immediately** ⚠️"
1028
+ f" - **Renew the SSL certificate immediately**"
1029
1029
  logging.warning(msg=out_msg)
1030
1030
  elif critical_remaining_days > 0 and remaining_days < critical_remaining_days:
1031
- out_msg = f"- 🚨 **Critical SSL certificate [{display_name}](https://{hostname})**:\n" \
1031
+ out_msg = f"- ⚠️ **SSL certificate [{display_name}](https://{hostname}) will expire soon**:\n" \
1032
1032
  f" - Certificate expires on {expiry_date.strftime('%d/%m/%Y')}\n" \
1033
- f" - **{remaining_days} remaining days**\n" \
1034
- f"⚠️ **Renew the SSL certificate quickly** ⚠️"
1033
+ f" - **{remaining_days} remaining days (which is in less than {critical_remaining_days} days)**\n" \
1034
+ f" - **Renew the SSL certificate quickly**"
1035
1035
  logging.warning(msg=out_msg)
1036
1036
  elif not display_only_if_critical:
1037
1037
  if warning_remaining_days > 0 and remaining_days < warning_remaining_days:
@@ -1041,14 +1041,14 @@ class LinuxMonitor:
1041
1041
  else:
1042
1042
  icon = "✅ "
1043
1043
 
1044
- out_msg = f"{icon}[{display_name}](https://{hostname}): {remaining_days} remaining days (expires on {expiry_date.strftime('%d/%m/%Y')})"
1044
+ out_msg = f"- {icon}[{display_name}](https://{hostname}): {remaining_days} remaining days (expires on {expiry_date.strftime('%d/%m/%Y')}))"
1045
1045
  logging.info(msg=out_msg)
1046
1046
 
1047
1047
  # Display the error of retrieving the certificate if there is one
1048
1048
  if cert_infos["error"]:
1049
- out_msg += f":\n- Error: `{cert_infos['error']}`"
1049
+ out_msg += f"\n - Reason: `{cert_infos['error']}`"
1050
1050
  except Exception as e:
1051
- out_msg = f"⚠️ **Error checking SSL certificate of [{display_name}](https://{hostname})**:\n```sh\n{e}\n```"
1051
+ out_msg = f"- ⚠️ **Error checking SSL certificate of [{display_name}](https://{hostname})**:\n```sh\n{e}\n```"
1052
1052
  logging.exception(msg=out_msg)
1053
1053
 
1054
1054
  return out_msg
@@ -1078,7 +1078,7 @@ class LinuxMonitor:
1078
1078
  if result and result != "":
1079
1079
  if out_msg != "":
1080
1080
  out_msg += "\n"
1081
- out_msg += f"- {result}"
1081
+ out_msg += f"{result}"
1082
1082
 
1083
1083
  if out_msg != "":
1084
1084
  out_msg = f"# 🔐 Certificates 🔐\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.0.4",
9
+ version="1.0.6",
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