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:
Kevin Rojas 2024-04-16 16:12:43 +00:00
commit 9bcc24009c
1 changed files with 9 additions and 2 deletions

11
pandora_agents/unix/plugins/autodiscover Normal file → Executable file
View 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