How glpi-project/glpi-agent works
Project type and purpose
• This is an open-source, cross-platform management agent ("GLPI Agent") written primarily in Perl (with a small Go subcommand).
• Its purpose is to run on endpoints (Windows, Linux, macOS, Unix variants, ESX hosts), perform inventory/discovery/deployment tasks, and communicate results back to a GLPI server or act standalone via a local web interface (“Toolbox”).
High-level architecture and file-structure cues
• Top-level “bin/” holds CLI entry points (glpi-agent, glpi-inventory, glpi-netdiscovery, glpi-injector, etc.).
• “lib/GLPI/Agent” contains the agent core, scheduler, configuration loader, task runners, protocol handlers (HTTP client/server, SNMP, SOAP).
• “etc/” holds default configuration files.
• “share/html” provides HTML templates and static assets for the embedded web UI (Toolbox).
• “contrib/”, “debian/”, “snap/”, “contrib/windows/” house packaging and installer scripts.
• “t/” contains extensive unit and integration tests.
• “src/cmd” holds a Go-based injector tool.
• CI workflows are defined under “.github/workflows/”.
a. Agent Core
• Configuration Loader (reads etc/*.cfg)
• Scheduler/Plan Engine (determines when tasks run)
• Plugin/Task Manager (dynamically loads Task modules under lib/GLPI/Agent/Task)
b. Task Modules (group into logical tiers)
• Inventory Tasks (OS/hardware profiling across AIX, BSD, Linux, Windows, macOS, Solaris, Virtualization, ESX)
• Network Discovery Tasks
• Network Inventory Tasks
• Deploy Task (file copy, scripts, P2P)
• WakeOnLan Task
• Remote Inventory Task (SSH, WinRM)
c. Communication & Protocol Layers
• HTTP Client (GLPI protocol, FusionInventory, OCS)
• HTTP Server (optional web UI, plugins: BasicAuth, Inventory, Toolbox API)
• SNMP Client
• SOAP Client (VMware WS-Man)
d. External Tools & Programs
• dmidecode, lspci, hdparm, arp, ip, powercfg, SNMP utilities, etc.
e. CLI Interfaces
• bin/glpi-agent (main daemon/foreground runner)
• Other bin/ scripts invoking specific tasks or installers
• glpi-injector (Go tool)
f. Packaging & Deployment Pipelines
• snapcraft.yaml (Snap)
• debian/* (deb packages, postinst scripts)
• contrib/windows MSI toolchain
• MacOSX packaging scripts (munkipkg, hdiutil)
• GitHub Actions workflows (.github/workflows/*.yml)
g. Testing & CI
• t/ (Perl test suites)
• .github Actions badges and pipelines
Relationships & data flows
• The Agent Core reads config → schedules Tasks → invokes Task modules → each Task may call External Tools or use internal Perl library to collect data → collected data flows into Protocol layer → HTTP Client sends to the GLPI Server (or FusionInventory endpoint) over HTTP/HTTPS.
• SNMP and SOAP modules interact directly with network devices or ESX hosts.
• CLI scripts wrap Agent Core or specific Task calls for ad-hoc operations.
• Packaging pipelines consume the codebase and produce platform installers.
Architectural patterns & principles
• Modular/Plugin architecture: Task types are organized under namespace lib/GLPI/Agent/Task, auto-loaded via UNIVERSAL::require.
• Separation of concerns: distinct layers for configuration, scheduling, task execution, communication, and UI.
• Strategy pattern: each Task implements well-defined interfaces for collect/deploy/discovery.
• Extensibility: new Task modules or protocol handlers can be added without touching core scheduler.
Detail level
• Be explicit: include all Task categories, external dependencies, packaging targets, and CI pipelines.
• Configuration inputs (etc/*.cfg) and resource directories (resources/) feeding Tasks.