Pagina 1 di 1

Distribuisci l'agente GLPI

Pubblicato: 4 agosto 2023 - 09:17
di SebR
Salve,

sto cercando di distribuire l'agente GLPI sulla nostra rete. Abbiamo provato a usare una GPO, ma non ha funzionato.
Ho provato a creare un pacchetto tramite WAPT, ma non riusciamo a inserire gli argomenti corretti (`/qn /i RUNNOW=1 SERVER="htt*://server/front/inventory.php")` nel file Py.
Abbiamo visto che esiste un pacchetto GLPI in WAPT, ma non riusciamo a capire come aggiungere gli argomenti (nome del server e tipo di installazione).
Avete qualche suggerimento o qualcuno ha un esempio di come creare il pacchetto?
Grazie in anticipo per l'aiuto.
Sebastien

Re: Distribuzione dell'agente GLPI

Pubblicato: 4 agosto 2023 - 13:56
di jorico
Ciao Seb,

Ho installato l'agente GLPI in questo modo sulla mia rete, ma non ho utilizzato il pacchetto dal repository, né sono riuscito a integrare gli argomenti con il pacchetto dallo store.

Ho aggiunto funzioni di audit per verificare lo stato del servizio.

Codice: Seleziona tutto

# -*- 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: Distribuzione dell'agente GLPI

Pubblicato: 16 agosto 2023 - 10:42
di blemoigne
Buongiorno,
Sarebbe in questa forma:

Codice: Seleziona tutto

# -*- 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: Distribuzione dell'agente GLPI

Pubblicato: 22 agosto 2023 - 15:51
di SeiyaGame
Buongiorno,

Vorrei proporvi la mia soluzione che, pur incorporando le vostre idee, include anche alcuni miglioramenti :D

Codice: Seleziona tutto

# -*- 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"