DiscordBotLinuxMonitor 1.2.2__tar.gz → 1.3.0__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.
- {discordbotlinuxmonitor-1.2.2 → discordbotlinuxmonitor-1.3.0}/DiscordBotLinuxMonitor.egg-info/PKG-INFO +4 -2
- {discordbotlinuxmonitor-1.2.2 → discordbotlinuxmonitor-1.3.0}/DiscordBotLinuxMonitor.egg-info/requires.txt +1 -1
- {discordbotlinuxmonitor-1.2.2 → discordbotlinuxmonitor-1.3.0}/PKG-INFO +4 -2
- {discordbotlinuxmonitor-1.2.2 → discordbotlinuxmonitor-1.3.0}/README.md +2 -0
- {discordbotlinuxmonitor-1.2.2 → discordbotlinuxmonitor-1.3.0}/discordbotlinuxmonitor/__main__.py +4 -0
- {discordbotlinuxmonitor-1.2.2 → discordbotlinuxmonitor-1.3.0}/discordbotlinuxmonitor/discordbotlinuxmonitor.py +28 -5
- {discordbotlinuxmonitor-1.2.2 → discordbotlinuxmonitor-1.3.0}/setup.py +2 -2
- {discordbotlinuxmonitor-1.2.2 → discordbotlinuxmonitor-1.3.0}/DiscordBotLinuxMonitor.egg-info/SOURCES.txt +0 -0
- {discordbotlinuxmonitor-1.2.2 → discordbotlinuxmonitor-1.3.0}/DiscordBotLinuxMonitor.egg-info/dependency_links.txt +0 -0
- {discordbotlinuxmonitor-1.2.2 → discordbotlinuxmonitor-1.3.0}/DiscordBotLinuxMonitor.egg-info/top_level.txt +0 -0
- {discordbotlinuxmonitor-1.2.2 → discordbotlinuxmonitor-1.3.0}/LICENSE.md +0 -0
- {discordbotlinuxmonitor-1.2.2 → discordbotlinuxmonitor-1.3.0}/discordbotlinuxmonitor/__init__.py +0 -0
- {discordbotlinuxmonitor-1.2.2 → discordbotlinuxmonitor-1.3.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: DiscordBotLinuxMonitor
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: From discord channels: 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/Discord-Bot-Linux-Monitor-Python-Library
|
|
6
6
|
Author: Quentin Comte-Gaz
|
|
@@ -22,7 +22,7 @@ Classifier: Environment :: Console
|
|
|
22
22
|
Requires-Python: >=3.3
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
License-File: LICENSE.md
|
|
25
|
-
Requires-Dist: linuxmonitor~=1.
|
|
25
|
+
Requires-Dist: linuxmonitor~=1.3.0
|
|
26
26
|
Requires-Dist: discord.py
|
|
27
27
|
Requires-Dist: typing
|
|
28
28
|
Requires-Dist: asyncio
|
|
@@ -75,6 +75,8 @@ Displayed infos are not the same if you do the command in private or public chan
|
|
|
75
75
|
- `/restart_service {service_name}`: 🚀 Restart a service 🚀
|
|
76
76
|
<img src="https://raw.githubusercontent.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library/master/example/restart_service.jpg" height="150">
|
|
77
77
|
|
|
78
|
+
- `/stop_service {service_name}`: 🚫 Stop a service 🚫
|
|
79
|
+
|
|
78
80
|
- `/list_services`: 📋 List all available services 📋
|
|
79
81
|
<img src="https://raw.githubusercontent.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library/master/example/list_services.jpg" height="150">
|
|
80
82
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: DiscordBotLinuxMonitor
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: From discord channels: 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/Discord-Bot-Linux-Monitor-Python-Library
|
|
6
6
|
Author: Quentin Comte-Gaz
|
|
@@ -22,7 +22,7 @@ Classifier: Environment :: Console
|
|
|
22
22
|
Requires-Python: >=3.3
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
License-File: LICENSE.md
|
|
25
|
-
Requires-Dist: linuxmonitor~=1.
|
|
25
|
+
Requires-Dist: linuxmonitor~=1.3.0
|
|
26
26
|
Requires-Dist: discord.py
|
|
27
27
|
Requires-Dist: typing
|
|
28
28
|
Requires-Dist: asyncio
|
|
@@ -75,6 +75,8 @@ Displayed infos are not the same if you do the command in private or public chan
|
|
|
75
75
|
- `/restart_service {service_name}`: 🚀 Restart a service 🚀
|
|
76
76
|
<img src="https://raw.githubusercontent.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library/master/example/restart_service.jpg" height="150">
|
|
77
77
|
|
|
78
|
+
- `/stop_service {service_name}`: 🚫 Stop a service 🚫
|
|
79
|
+
|
|
78
80
|
- `/list_services`: 📋 List all available services 📋
|
|
79
81
|
<img src="https://raw.githubusercontent.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library/master/example/list_services.jpg" height="150">
|
|
80
82
|
|
|
@@ -46,6 +46,8 @@ Displayed infos are not the same if you do the command in private or public chan
|
|
|
46
46
|
- `/restart_service {service_name}`: 🚀 Restart a service 🚀
|
|
47
47
|
<img src="https://raw.githubusercontent.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library/master/example/restart_service.jpg" height="150">
|
|
48
48
|
|
|
49
|
+
- `/stop_service {service_name}`: 🚫 Stop a service 🚫
|
|
50
|
+
|
|
49
51
|
- `/list_services`: 📋 List all available services 📋
|
|
50
52
|
<img src="https://raw.githubusercontent.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library/master/example/list_services.jpg" height="150">
|
|
51
53
|
|
{discordbotlinuxmonitor-1.2.2 → discordbotlinuxmonitor-1.3.0}/discordbotlinuxmonitor/__main__.py
RENAMED
|
@@ -98,6 +98,10 @@ def main() -> None:
|
|
|
98
98
|
async def restart_service(interaction: discord.Interaction, service_name: str) -> None: # type: ignore
|
|
99
99
|
await discord_bot_linux_monitor.restart_service(interaction, service_name)
|
|
100
100
|
|
|
101
|
+
@discord_bot.tree.command(name="stop_service", description="🚫 Stop a service 🚫")
|
|
102
|
+
async def stop_service(interaction: discord.Interaction, service_name: str) -> None: # type: ignore
|
|
103
|
+
await discord_bot_linux_monitor.stop_service(interaction, service_name)
|
|
104
|
+
|
|
101
105
|
@discord_bot.tree.command(name="list_services", description="📋 List all available services 📋")
|
|
102
106
|
async def list_services(interaction: discord.Interaction) -> None: # type: ignore
|
|
103
107
|
await discord_bot_linux_monitor.list_services(interaction)
|
|
@@ -20,6 +20,8 @@ Non exhaustive list of features (available by using it in shell or in python scr
|
|
|
20
20
|
- Get hostname, OS details, kernel version, server datetime, uptime
|
|
21
21
|
- Get connected users
|
|
22
22
|
|
|
23
|
+
- Restart/Stop a service
|
|
24
|
+
|
|
23
25
|
- Get processes list (PID and name)
|
|
24
26
|
- Kill a process by PID
|
|
25
27
|
|
|
@@ -31,7 +33,7 @@ __email__ = "quentin@comte-gaz.com"
|
|
|
31
33
|
__license__ = "MIT License"
|
|
32
34
|
__copyright__ = "Copyright Quentin Comte-Gaz (2024)"
|
|
33
35
|
__python_version__ = "3.+"
|
|
34
|
-
__version__ = "1.
|
|
36
|
+
__version__ = "1.3.0 (2024/09/19)"
|
|
35
37
|
__status__ = "Usable for any Linux project"
|
|
36
38
|
|
|
37
39
|
# pyright: reportMissingTypeStubs=false
|
|
@@ -558,7 +560,7 @@ class DiscordBotLinuxMonitor:
|
|
|
558
560
|
|
|
559
561
|
try:
|
|
560
562
|
is_private: bool = self._is_private_channel(channel=interaction.channel) # type: ignore
|
|
561
|
-
out_msg: str = await self.monitoring.check_all_websites(is_private=is_private, display_only_if_critical=False
|
|
563
|
+
out_msg: str = await self.monitoring.check_all_websites(is_private=is_private, display_only_if_critical=False)
|
|
562
564
|
|
|
563
565
|
# Respond to the user
|
|
564
566
|
await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
|
|
@@ -661,7 +663,7 @@ class DiscordBotLinuxMonitor:
|
|
|
661
663
|
try:
|
|
662
664
|
# Redémarrer le service et récupérer le message de sortie
|
|
663
665
|
is_private: bool = self._is_private_channel(channel=interaction.channel) # type: ignore
|
|
664
|
-
out_msg: str = await self.monitoring.restart_service(is_private=is_private, service_name=service_name)
|
|
666
|
+
out_msg: str = await self.monitoring.restart_service(is_private=is_private, service_name=service_name, force_restart=True)
|
|
665
667
|
|
|
666
668
|
# Répondre à l'utilisateur
|
|
667
669
|
await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
|
|
@@ -671,6 +673,27 @@ class DiscordBotLinuxMonitor:
|
|
|
671
673
|
logging.exception(msg=out_msg)
|
|
672
674
|
await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
|
|
673
675
|
|
|
676
|
+
async def stop_service(self, interaction: discord.Interaction, service_name: str) -> None:
|
|
677
|
+
if not self._check_if_valid_guild(guild=interaction.guild):
|
|
678
|
+
return
|
|
679
|
+
if not (await self._is_bot_channel_interaction(interaction=interaction, send_message_if_not_bot=True)):
|
|
680
|
+
return
|
|
681
|
+
|
|
682
|
+
# Indiquer que la commande est en cours de traitement
|
|
683
|
+
await interaction.response.defer()
|
|
684
|
+
|
|
685
|
+
try:
|
|
686
|
+
# Arrêter le service et récupérer le message de sortie
|
|
687
|
+
is_private: bool = self._is_private_channel(channel=interaction.channel) # type: ignore
|
|
688
|
+
out_msg: str = await self.monitoring.stop_service(is_private=is_private, service_name=service_name)
|
|
689
|
+
|
|
690
|
+
# Répondre à l'utilisateur
|
|
691
|
+
await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
|
|
692
|
+
except Exception as e:
|
|
693
|
+
out_msg = f"**Internal error stopping service {service_name}**:\n```sh\n{e}\n```"
|
|
694
|
+
logging.exception(msg=out_msg)
|
|
695
|
+
await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
|
|
696
|
+
|
|
674
697
|
async def list_services(self, interaction: discord.Interaction) -> None:
|
|
675
698
|
if not self._check_if_valid_guild(guild=interaction.guild):
|
|
676
699
|
return
|
|
@@ -683,7 +706,7 @@ class DiscordBotLinuxMonitor:
|
|
|
683
706
|
try:
|
|
684
707
|
# Récupérer la liste des services
|
|
685
708
|
is_private: bool = self._is_private_channel(channel=interaction.channel) # type: ignore
|
|
686
|
-
out_msg: str = self.monitoring.
|
|
709
|
+
out_msg: str = self.monitoring.get_all_services(is_private=is_private)
|
|
687
710
|
|
|
688
711
|
# Répondre à l'utilisateur
|
|
689
712
|
await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
|
|
@@ -704,7 +727,7 @@ class DiscordBotLinuxMonitor:
|
|
|
704
727
|
try:
|
|
705
728
|
# Récupérer le statut des ports
|
|
706
729
|
is_private: bool = self._is_private_channel(channel=interaction.channel) # type: ignore
|
|
707
|
-
out_msg: str = await self.monitoring.check_all_ports(is_private=is_private, display_only_if_critical=False
|
|
730
|
+
out_msg: str = await self.monitoring.check_all_ports(is_private=is_private, display_only_if_critical=False)
|
|
708
731
|
|
|
709
732
|
# Répondre à l'utilisateur
|
|
710
733
|
await self._interaction_followup_send_no_limit(interaction=interaction, msg=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="DiscordBotLinuxMonitor",
|
|
9
|
-
version="1.
|
|
9
|
+
version="1.3.0",
|
|
10
10
|
description="From discord channels: 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",
|
|
@@ -36,7 +36,7 @@ setup(
|
|
|
36
36
|
keywords='discord bot warning info linux monitor monitoring server service port ping ssl certificate disk folder cpu ram swap usage ip connection',
|
|
37
37
|
platforms='Linux',
|
|
38
38
|
install_requires=[
|
|
39
|
-
"linuxmonitor~=1.
|
|
39
|
+
"linuxmonitor~=1.3.0", # follows the {MAJOR}.{MINOR}.x version range (because LinuxMonitor and DiscordBotLinuxMonitor are tightly coupled and should have same major and minor version)
|
|
40
40
|
"discord.py",
|
|
41
41
|
"typing",
|
|
42
42
|
"asyncio",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{discordbotlinuxmonitor-1.2.2 → discordbotlinuxmonitor-1.3.0}/discordbotlinuxmonitor/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|