mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
Merge branch 'ent-13567-autodiscover-de-agente-falla-si-no-tienes-systemd' into 'develop'
Resolve "autodiscover de agente falla si no tienes systemd" See merge request artica/pandorafms!7213
This commit is contained in:
commit
9bcc24009c
11
pandora_agents/unix/plugins/autodiscover
Normal file → Executable file
11
pandora_agents/unix/plugins/autodiscover
Normal file → Executable file
@ -22,12 +22,19 @@ try:
|
||||
from subprocess import PIPE
|
||||
from subprocess import DEVNULL
|
||||
from subprocess import getstatusoutput
|
||||
import signal
|
||||
except ModuleNotFoundError as err:
|
||||
print("{} error: {}. Exiting...".format(argv[0], err), file=stderr)
|
||||
exit(1)
|
||||
|
||||
module_list = []
|
||||
VERSION = "1.2"
|
||||
VERSION = "1.3"
|
||||
|
||||
# Define a function to handle the SIGTERM signal
|
||||
def sigterm_handler(signum, frame):
|
||||
print("Received SIGTERM signal. Cleaning up...")
|
||||
sys.exit(0)
|
||||
signal.signal(signal.SIGTERM, sigterm_handler)
|
||||
|
||||
def win_service(servicelist, option=False, memcpu=False):
|
||||
|
||||
@ -74,7 +81,7 @@ def win_service(servicelist, option=False, memcpu=False):
|
||||
def lnx_service(services_list, memcpu=False):
|
||||
"""Creates modules for Linux servers"""
|
||||
modules = []
|
||||
sysctl = getstatusoutput("command -v systemctl")[0]
|
||||
sysctl = getstatusoutput("systemd-notify --booted")[0]
|
||||
servic = getstatusoutput("command -v service")[0]
|
||||
for srvc in services_list:
|
||||
status = None
|
||||
|
Loading…
x
Reference in New Issue
Block a user