Página 1 de 1

Implementar el agente GLPI

Publicado: 4 de agosto de 2023 - 09:17
por SebR
Hola,

estoy intentando implementar el agente GLPI en nuestra red. Intentamos usar una GPO, pero no funcionó.
Intenté crear un paquete a través de WAPT, pero no logramos insertar los argumentos correctos (`/qn /i RUNNOW=1 SERVER="htt*://server/front/inventory.php")` en el archivo .py.
Vimos que hay un paquete GLPI en WAPT, pero no sabemos cómo agregar los argumentos (nombre del servidor y tipo de instalación). ¿
Tienen alguna idea o alguien tiene un ejemplo de cómo crear el paquete?
Gracias de antemano por su ayuda.
Sébastien

Re: Implementación del agente GLPI

Publicado: 4 de agosto de 2023 - 13:56
por jorico
Hola Seb,

Instalé el agente GLPI de esta manera en mi red, pero no utilicé el paquete del repositorio, ni logré integrar los argumentos con el paquete del store.

Agregué funciones de auditoría para verificar el estado del servicio.

Código: Seleccionar todo

# -*- coding: utf-8 -*-
from setuphelpers import *

r"""
Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()

"""
# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls

uninstallkey = ['{E1BE6C18-6BF4-1014-844A-F1F114E3EA24}']

def install():
    # Declaring local variables

    # Installing the software
    print("Installing: GLPI-Agent-1.4-x64.msi")
    run(r'MsiExec.exe /i GLPI-Agent-1.4-x64.msi /quiet SERVER=https://xxxxxxxxxxx  ADD_FIREWALL_EXCEPTION=1 SCAN_PROFILES=1 RUNNOW=1')
    print("Installation de GLPI-Agent-1.4 terminée")

def audit():

   if service_is_running('glpi-agent'):
    print("Le service GLPI Agent est démarré")
    return "OK"

   else:
    print("Le service GLPI Agent n'est pas démarré !")
    return "WARNING"

Re: Implementación del agente GLPI

Publicado: 16 de agosto de 2023 - 10:42
por blemoigne
Buen día,
Quedaría de esta forma:

Código: Seleccionar todo

# -*- coding: utf-8 -*-
from setuphelpers import *


def install():

    install_msi_if_needed(
        glob.glob("*.msi")[0], properties ='RUNNOW=1 SERVER="htt*://serveur/front/inventory.php"'    )
Bertrand

Re: Implementación del agente GLPI

Publicado: 22 de agosto de 2023 - 15:51
por SeiyaGame
Buen día,

Me gustaría proponer mi solución que, si bien incorpora sus ideas, también incluye algunas mejoras :D

Código: Seleccionar todo

# -*- coding: utf-8 -*-

import glob
from setuphelpers import *

# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls

# https://glpi-agent.readthedocs.io/en/latest/installation/windows-command-line.html#command-line-parameters
properties = {
    "RUNNOW": 1,
    "ADDLOCAL": "feat_NETINV,feat_DEPLOY,feat_COLLECT", # ALL Or feat_AGENT,feat_NETINV,feat_DEPLOY,feat_COLLECT,feat_WOL
    "ADD_FIREWALL_EXCEPTION": 1,
    "AGENTMONITOR": 1,
    "SERVER": "http://URL_SERVER/marketplace/glpiinventory/",
}

def install():
    # Declaring local variables
    exe_file = glob.glob("*.msi")[0]

    # Installing the software
    print(f"Installing: {exe_file}")
    install_msi_if_needed(exe_file, properties=properties)

def audit():
    if service_installed("glpi-agent") and service_is_running("glpi-agent"):
        print("Service installed and started!")
        return "OK"
    else:
        print("Service is not installed and started !")
        return "ERROR"