Developers:Unified Agent 2.x
This is a draft about the futur development of the Perl agent (AKA OCS Inventory Unified Agent) (AKA OCS Inventory UNIX Agent).
Current issue with the 1.x series
- Memory usage. Currently the agent uses 40MB of memory. It's even worst with daemon mode because this memory is not given back to the system when there is no activity.
- Limited module mechanism. It was designed for inventory and don't feet weel with the new needs (software deployment, SNMP, WoL, ...)
- Only one OCS Inventory server per agent.
- Task: it's a feature of the agent (inventory, network scan, wol)
Ocsinventory::Agent # the agent itself
Create a module herarchy per task
Ocsinventory::Agent::Task::Inventory # Main Inventory module Ocsinventory::Agent::Task::Inventory::OS::Linux # Get inventory information from Linux ... Ocsinventory::Agent::Task::Deploy # Software deployment job ... Ocsinventory::Agent::Task::SNMP # SNMP feature module Ocsinventory::Agent::Task::SNMP::XXXXXX # The private modules for SNMP
Split in subprocesses
In order to free the memory, every “task” has it own process. A minimalist main script will be used to launch them (ocsinventory-agent).
Minimalist main script
- Very light
- A minimalist HTTP server listen on the 62354 port
- Limited execution time (Max 10 minutes)
- Can contact the server themself
- ocsinventory-agent is started
- It checks another agent is not running, if so → 
- It loads it settings from the cfg and the params like today
- It removes $VARDIR/$pid if needed (TODO, lock mechanism)
- It store() the $config object $VARDIR/config.dump
- It goes to background if daemon/service mode is requested
- For every servers, if it get a remove wakeup of if the next_timefile is done
- It contacts the server (PROLOG) and get back the PROLOG response (Ocsinventory::Agent::XML::Response::Prolog) with the parameter for the different “task”
- It write the PROLOG response object in $VARDIR/prolog.dump
- it starts the “task” modules (perl -MOcsinventory::Agent::Task::$TaskName -e'Ocsinventory::Agent::Task::$TaskName::main()' -- $VARDIR)
- Remove the prolog.dump
Q: What to do if the server doesn't anwser to the prolog?
For now we will use HTTP::Daemon::SSL.
These HTTP error code are used:
Purpose: Download a file. The file have to be in the $VARDIR/shared
- action: download
- file: filename
Purpose: Get the last log file of the agent
- action: log
- deviceid: $DEVICEID
Returns an err 403 if $DEVICEID != machine deviceid
Ocsinventory::Agent::Logger will be used. We need to extend it to record the $TaskName too.
[core][ERROR]This is an example from ocsinventory-agent [SNMP][ERROR]This is another example from the SNMP task [Inventory][ERROR]Yet another example from Inventory task