Introduction

This tutorial is for people who had a GLPI server and a Shinken installation; and those who want monitoring our server / computer in GLPI. If you don’t have this kind of software installed, please read following tutorials:

To have already data in GLPI, you can do it by hand or use an automate tool, like FusionInventory. it will allow you to have hosts to monitor.

All below configurations had be done on Shinken 2.4.2 and GLPI 0.90.1 servers. It is therefore advisable to have similar servers. However, most configurations are expected to be virtually identical, except for versions of the plugins used.

Note: You can not import hosts already created in Shinken files to GLPI!

Prerequisites

To follow this tutorial, you must have:

A GLPI server, with root access or an account who had required access on GLPI installation.

A Shinken server with root access.

DNS records that allow two servers mentionned above to communicate.

It is best also have a minimum of hosts/servers in GLPI to monitor.

GLPI Plugins

At the moment, we already install plugins required by GLPI to communicate with Shinken. GLPI will need 2 plugins:

glpi_Monitoring : this plugin will display servers you will monitor in Shinken.

For this to be practical, I suggest doing a glpi_plugin directory in your HOME, able to come back later in future updates. I also recommend using [Git] (https://git-scm.com/) to get your plugins easily.

Download glpi_monitoring

To get this plugin, simply clone the repository and switch to the wanted tag (here 0.90+1.0):

Note: GLPI will recognize the plugin through its folder name and other files. Be careful not to change the folder names of your plugins unless GLPI ask you!

Enable plugins

Now go to your GLPI interface and log in.

If you go to the menu Configuration => Plugins you should see your two newly installed plugins. It is possible that the web_services module will display a message: Installing PHP incorrect. Requires xmlrpc module! This is normal if your server does not have the extension xmlrpc installed.

sudo apt-get install -y php5-xmlrpc
sudo service apache2 restart

Refresh your page, you should not have an error.

Now you can click the buttons Install of each plugin and then the Activate button. That’s it, your plugins are ready to be used. If you go on Plugins => Monitoring you will see only a blank page. This is normal for this time it has nothing to show but we will give him something to work.

Add the necessary users in GLPI

You’ll have to create a user in MySQL and GLPI, so they can connect to the Web Services to retrieve its configuration.

For GLPI: go to Administration => Users and add an account shinken.

For MySQL, follow below steps:

Connect to MySQL, on glpi Database:

mysql -u root -p glpi

And type following commands (and obviously change password):

GRANT select,update ON glpi_plugin_monitoring_services TO shinkenbroker IDENTIFIED BY 'password';
GRANT insert ON glpi_plugin_monitoring_serviceevents TO shinkenbroker;
GRANT select,update ON glpi_plugin_monitoring_servicescatalogs TO shinkenbroker;

Warning: if your Shinken and GLPI server are not on same machine, you must define the username with his machine: 'shinkenbroker'@'ip_shinken_server'!

Type CTRL-D or exit to go out of MySQL.

Your two users are set.

Configure Web Services

Go to GLPI interface and Configuration => Webservices menu. Add a service with following parameters:

Name: Shinken

Active services: Yes

Enable compression: No (Not tested this feature so far)

Draw connections: No (turn on if you want to keep track of connections)

Debug: No (Turn it on when debugging)

Reason SQL services. * .*

IPv4 address range: set the address of your server Shinken in the 2 boxes.

IPv6 address: if you have activated the IPv6.

User ID: leave blank in this case.

Password: leave blank in this case.

Then click on Add button to save your configuration.

Shinken Modules

Now, let configure Shinken modules. You’ll have to set Arbiter and Broker daemons to let them connect to GLPI and his Database.

Configure import-glpi

You must have an import-glpi.cfg configuration file in your modules folder, open it and write depending on your configuration:

definemodule {
module_nameimport-glpimodule_typeimport-glpi# URI of Web service for GLPI
urihttp://ip_server/glpi/plugins/webservices/xmlrpc.php# If you had a valid DNS, point to the right address:
# uri http://glpi.domain.com/plugins/webservices/xmlrpc.php
# Credentials you had set before:
login_nameshinkenlogin_passwordpassword
}

Save and quit.

Then you must add it in Arbiter (vi arbiters/arbiter-master.cfg):

[...]
address0.0.0.0# Change localhost to 0.0.0.0 display system state in GLPI.
modulesimport-glpi
[...]

Save and quit. Now, Shinken can connect to GLPI.

Configure glpidb

You must first change the module configuration:

definemodule {
module_nameglpidbmodule_typeglpidbhostip_serveur# Name of GLPI server or his IP
port3306databaseglpi# Database name of GLPI
usershinkenbroker# User created in MySQL
passwordpassword# User password
[...]
}

Save and quit. Now add this module to Broker (vi brokers/broker-master.cfg):

[...]
moduleswebui2,glpidb
[...]

Save and quit this file. Shinken can now connect to GLPI database.

Configure ws-arbiter

For this module, there are no special modification to perform. However if in GLPI you have defined a password and a username in Webservices plugin you will have the same data in the configuration file (modules/ws_arbiter.cfg).

But you still have to indicate in Shinken Arbiter (vi arbiters/arbiter-master.cfg):

[...]
modulesimport-glpi,ws-arbiter
[...]

Save and quit again.

Check that everything works

Now, all your configuration are ready. Just restart Shinken and GLPI:

On Shinken server:

sudo service shinken restart

On GLPI server:

sudo service apache2 restart

And now, you must have the following window if you go in GLPI monitoring page:

GLPI Monitoring

You should see a green dot in front of State system indicating that all Shinken daemon works as well as ping. You can see that you can restart Shinken from the GLPI interface. If you restart Shinken from here a GLPI notification will appear: Communication with Shinken works....

Check your logs

If you encounter any problems, remember to check your logs!

On Shinken server:

sudo tail -f /var/log/shinken/*.log | grep ERROR

You can also test your xmlrpc connection via the following command as shinken user:

Components

Once the command defined, you must associate a component to her. Fill the following fields:

Provide a name

Select the command you want

Select a graphic template. Most of the templates are already well defined. If you lack a graphic template, create one:

Just put your order in Example of perfdata for this control field and click Save. The plugin will generate your own template.

Set a Control: it is used to determine how many times shinken will try this command before changing state.

Active Control => Yes

Passive Control => Yes

Control Period: Select period.

Then save!

Component Catalog

Just create a catalog component to all of this. The catalog will be set according to your wishes: multiple hosts through catalogs or not, several components, etc … up to you to see how you then want to monitor your hosts. However the process will look something to the following:

Give it a name

Add one (or more) component(s)

Add a Host: you can set a rule to import dynamically or choose a static host.

Add a contact: You can also add a contact to be warned if your state change (UP, DOWN, WARNING…).

Once your catalog is finish, Shinken should normally restart automatically when you click Add button.

Conclusion

Glpi-Monitoring is not necessarily easy to configure and install; including the complete installation of all these servers.

Take the time to check your settings and your logs to make sure that there is no errors. Do not hesitate to contact the development team on forums or IRC channels.

Also keep in mind that we are mostly volunteers for all these software and we can not always respond quickly.