Agents can :
- inventory the hardware and software of computers, servers, virtual machines
- inventory the hardware and software of android smartphones
- inventory network devices through SNMP (switch, router, network printer…)
- network discovery (discover all devices connected to the network)
- deploy applications on devices
- wake on lan (wake a computer remotely)
- inventory ESX servers (on each ESX server or through vcenter)
The agents can be installed with GPO or with scripts and run on many operating systems (Windows, Mac OS X, Linux, BSD…).
This process can save time and money to make inventory and so the “Sysadmin” life.
To use this tutorial, you need a GLPI server and it’s better to have the version
0.90.1 (the last stable release). Anyway, other versions of GLPI can work.
administratoraccess on this server needed.
- You also need to have one (or many) Linux server/client to install the agent.
- One (or many) Windows server/client to install the agent.
It’s not necessary to have a Windows and a Linux device for this tutorial, but both can be needed.
How to get the archive
Get the last stable version on the releases page
wget https://github.com/fusioninventory/fusioninventory-for-glpi/releases/download/glpi090%2B1.2/fusioninventory-for-glpi_0.90.1.2.tar.gz tar zxvf fusioninventory-for-glpi_0.90.1.2.tar.gz sudo cp -R fusioninventory/ /var/www/glpi/plugins/
Be careful, do not give rights to apache on this folder (security ^^)
Your folder is ready!
Developer method with git
To get the FusionInventory GLPI plugin , you can use git. Install it if it is not yet available:
sudo apt-get install -y git
Then, clone the git repository and go to the required
tag (I mean the last release):
sudo cd /var/www/glpi/plugins/ && git clone https://github.com/fusioninventory/fusioninventory-for-glpi.git fusioninventory sudo cd /var/www/glpi/plugins/fusioninventory && git checkout glpi090+1.2
Be careful, do not not give rights to apache on this folder (security ^^)
Your folder is ready!
Activate the plugin
Go on the web interface of GLPI, log in and select the menu Configuration => Plugins.
Click on Install then on Activate. Your plugin is now ok.
Now, we need to configure it. It’s not easy to find, select the menu Administration => Entities => Root entity and click on tab
Root entityis the default main entity in GLPI. If your configuration is different, apply changes with it.
In this form, fill the field
URL service access with your url (or with you IP). Check that the url is ok and work!). The url to provide is the GLPI url, so the url must stop to GLPI (example : http://ipserver/glpi). Then save!
Congratulations, your plugin is ready.
Install an agent
The windows installation is very simple. Download the client on the dedicated page and choose the right
Then, follow the setup process and enter the url of your GLPI server:
or if you have a DNS:
For Linux, it’s quite different. You need to add package repositories and install with them or install from sources.
Installation with repositories
Be sure to have a stable system version and that you can update it easily. Get the GnuPG key with this command:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 049ED9B94765572E
Note: The official documentation uses the address
keyserver.ubuntu.comwithout port and URI.
However, under Ubuntu Server, I need to force port 80 and add
hkp://. With this the command, it works.
If you not have tool
lsb-release, install it:
sudo apt-get install lsb-release
Once this done, we can add the repository in file
echo "deb http://debian.fusioninventory.org/debian/ `lsb_release -cs` main" >> /etc/apt/sources.list
Update you packages and install the agent
sudo apt-get update sudo apt-get install fusioninventory-agent
Installation from source
To install from source, we need to install dependencies:
sudo apt-get install dmidecode nmap make
Then, we need to install “some”
sudo apt-get install libmodule-install-perl libmodule-build-perl libhttp-server-simple-psgi-perl libhttp-proxy-perl libio-captureoutput-perl libipc-run-perl libnet-snmp-perl libnet-telnet-cisco-perl libpoe-component-client-dns-perl libpoe-component-resolver-perl libtest-compile-perl libtest-deep-perl libtest-exception-perl libtest-most-perl libhttp-server-simple-authen-perl libio-capture-perl libio-captureoutput-perl libpoe-component-client-ping-perl libtest-http-server-simple-perl libtest-mockmodule-perl libtest-mockobject-perl libtest-nowarnings-perl libtest-failwarnings-perl libtest-warnings-perl libfile-copy-recursive-perl libxml-treepp-perl libproc-daemon-perl libproc-pid-file-perl
Get the most recent archive, so the 2.3.17:
wget https://github.com/fusioninventory/fusioninventory-agent/archive/2.3.17.tar.gz tar xzvf 2.3.17.tar.gz cd fusioninventory-agent-2.3.17
perl Makefile.PL make sudo make install
And voila, you should read a summary of the used folders:
Installation summary -------------------- prefix: /usr/local configuration installation directory: /usr/local/etc/fusioninventory constant data installation directory: /usr/local/share/fusioninventory variable data installation directory: /usr/local/var/fusioninventory
make install, you will have an important information: where to find the agent configuration file!
if [ -f //usr/local/etc/fusioninventory/agent.cfg ]; then \ install -m 644 etc/agent.cfg /usr/local/etc/fusioninventory/agent.cfg.new; \ else \ install -m 644 etc/agent.cfg /usr/local/etc/fusioninventory/agent.cfg; \ fi
It’s possible that some dependencies are missing when you run the agent the first time.
To solve this problem, just install missing modules with this command and replace
MODULE:MODULE with the module name:
sudo perl -MCPAN -e 'install "MODULE:MODULE"'
core requires at minimum the dependencies:
You can check on the agent repository to see all required dependencies.
Configure the agent
According with your installation, you should have a configuration file for your agent in the folder
Edit this file and uncomment the line
#server. Update the url to make it match with your GLPI installation:
[...] # send tasks results to a FusionInventory for GLPI server server = http://glpi_fqdn/plugins/fusioninventory/ [...]
Run the agent
Now your agent is installed, you can run it. For that, use the command:
You should have this text and see what the agent is doing:
[info] sending prolog request to server server0 [info] running task Deploy [info] running task ESX [info] ESX support disabled server side. [info] running task Inventory [info] running task Collect
You can also run a network discovery, with beginning and ending IP addresses:
# You can add --debug if needed sudo fusioninventory-netdiscovery --first x.x.x.x --last x.x.x.x
You should see a list of the discovered devices.
Schedule a task
We need to import all the agent-equiped devices in GLPI and thus, we need to configure a task.
Before beginning, check if your agent is right in GLPI.
On the GLPI web interface, select the menu Plugins => FusionInventory.
Go to General => Agents management.
If you have yet run your agent at least one time (see above), you should see your agent on this page.
If you did not, you missed something. Please re-check previous steps.
Create a task
Now, select Tasks => Tasks management.
You should see an empty page because you did not yet created a task.
Click on the button + beside Tasks management and name your task (eg. “discover”) then click on button Add.
Your task is created. Don’t miss to check the checkbox Active.
Go in tab Jobs configuration. Click on Add a job!
Add a job
To add a job, we need to define many things:
- Name it (eg “LAN discovery”) and select a method. Here, use “network discover”, then Add.
- Click on the name of the job you just created. You can see now that you can add targets and actors.
- The “targets” are the elements that will be targeted by the job
- The “actors” are the agents that will execute the job.
- Add a target by clicking on +, select IP range. Then choose the IP range you previously created.
If you didn’t yet created an IP range, click on the i below.
This will open a new tab and you will be able to create a new IP range.
Of course, you need to define a range that your agent can see and that exists! Then click on Add target.
- For actors, add an agent you already installed and click on Add Actor.
- Once both steps completed, click on Update! Do not leave the current page before having clicked Update, otherwize your configuration will be lost!
Back to tasks management page, you will see the task you just created.
Start the task
When you go in Tasks => Monitoring / logs, you should see your task with many step names below and with zeros in front of each name.
You can see the task is inactive for the moment. Now, the goal is to put your task in Prepared!
To do this, go in menu Setup => Automatic actions.
In this page, you can see all tasks GLPI will run (core and plugins).
Search the task named taskscheduler and click on it!
In other versions of GLPI and FusionInventory, it seems the action has different name.
Check if it is right link to FusionInventory, it should be indicated.
Does not look anything like that, but many of us has problem to find this.
One on the page of task taskscheduler, click on Run!
If you go back on your FusionInventory task, in tab Monitoring / Logs, it should be in Prepared!
If not, you can select above the Refresh interval of tasks. In most cases, 5 minutes is enough.
Now, go back on your terminal and run the agent:
And you can follow the steps of your task in GLPI. It should be passe to Running (in purple).
You can click on it, this will display your agent and the job it do.
Next, click on the name of your agent to see more details.
Depend on the IP range defined, your network speed and the number of devices to find, the task can make more or less time before finish and to pass to Succee (green).
See found devices
Once agent finish his job, your equipment had to be added automatically in GLPI. FusionInventory must also (in logs) display the following message:
YYYY-DD-MM HH:MM:SS Ok Total Found:XX Created:XX Updated:X
If not or if the plugin display the message
Import Denied, it mean Equipment import and link rules of the plugin has too restricted.
FusionInventory has default rules in Rules => Equipment import and link rules.
Your inventory can be successful, but FusionInventory not have valid them and put them in kind of blacklist in Rules => Ignored import devices.
If the plugin has sucessfuly imported your device, you will not find it directly in menu Assets.
We need go in menu Assets => Unmanaged devices and surprise, all found devices are here!
If this device is right and known and should be in your inventory, you can import it, by defining the type of device, otherwize GLPI will refuse import it (normal because it don’t know where import it).
Once device have a type, check them and do Actions and Import.
Now, if you go in Computers menu (or else if you have imported other than computers), your devices are here with some data pre-filled.
You can say after to GLPI to protect the data yet imported and never modify them (see that in
Congratulations, you have done the major part of job!
Automate a task
Obviously, this is really nice, but run agent manually on GLPI and on Shinken, it’s not very usefull… so we need automate the process.
If you have search in all the web like me to find tutorials about this plugin, you certainly have same problem.
In fact, there is a solution on the official wiki but it’s not easy to find.
We will define 2 things:
crontask to run the GLPI pseudo-cron.
crontask for FusionInventory agent.
In a previous version of FusionInventory, seems daemon mode not works nicely. It’s why I have configured agent with
To run agent in daemon, add the option
-d. You can add
--debugto be more verbose.
Cron task for FusionInventory
To configure agent FusionInventory with cron, we need use the
root cron or else if you have a dedicated user, but with rights to run it.
After, define the time to run in the cron (
sudo crontab -e) :
# Adapt the path of fusioninventory in this job! # The task will run all days of all months at 03h05 a.m. 5 3 * * * /usr/local/bin/fusioninventory-agent
Save and quit.
Cron task for GLPI
Like said on the documentation above, we only need edit the cron of web server user run GLPI!
If you do on another user, it will not works. Be carefull, we need
sudo apt-get install php5-cli
Once done, edit the cron of user:
sudo crontab -u www-data -e
And add the line at the end of file:
# The GLPI path need match path of your installation! */1 * * * * /usr/bin/php5 /var/www/glpi/front/cron.php &>/dev/null
Save and quit the crontab.
This task will execute the file
cron.php each minute.
You can define an another frequency according your installation, see what is the best for you.
The job will create an activity in GLPI and execute the automatic crontasks of GLPI, included our
If you are patient, You can wait 3h00 a.m. to see if it works… else you can modify time execution of the agent to test your process.
You can follow after your inventory in GLPI in Monitoring / Logs of Fusioninventory menu.
It will go in mode Prepared, and after go step to step and finish.
You can too check the right working jobs with logs of the Cron:
grep CRON /var/log/syslog
Now, you have a solution to automate the inventory of your assets easily and so have the data up to date.