Hi. I have installed both OCS and GLPI on an Apache2 and MySQL server, on the same…
- User
Hi. I have installed both OCS and GLPI on an Apache2 and MySQL server, on the same machine, running the system Ubuntu 22.04 Server. I would like the two to communicate together and exchange information about the clients linked to OCS from its agents. How can I achieve that?
- Assistant
Integrating OCS (Open Computer and Software Inventory Next Generation) with GLPI (Gestionnaire Libre de Parc Informatique) enables you to synchronize asset information seamlessly, enhancing your IT asset management capabilities. Below is a comprehensive guide to achieve this integration on your Ubuntu 22.04 Server running Apache2 and MySQL.
Prerequisites
-
Installed Software:
- GLPI: Ensure GLPI is installed and accessible via your web server.
- OCS Inventory NG: Ensure OCS is installed, agents are running on client machines, and the OCS server is operational.
- Apache2 & MySQL: Properly configured and running on your server.
-
Versions Compatibility:
- Verify that the versions of GLPI and OCS Inventory NG are compatible. It's recommended to use the latest stable releases to ensure compatibility and access to the latest features.
-
Backup:
- Before making changes, back up your GLPI and OCS databases and configurations to prevent data loss in case of unexpected issues.
Step-by-Step Integration Guide
1. Download and Install the OCSNG Plugin for GLPI
The OCSNG plugin facilitates communication between GLPI and OCS Inventory NG.
-
Download the Plugin:
- Visit the GLPI Plugins Repository to download the latest version of the OCSNG plugin compatible with your GLPI installation.
cd /var/www/html/glpi/plugins wget https://github.com/glpi-project/ocsinventoryng/releases/download/{version}/ocsinventoryng-{version}.tgz tar -xvzf ocsinventoryng-{version}.tgz rm ocsinventoryng-{version}.tgzReplace
{version}with the appropriate version number. -
Set Correct Permissions:
chown -R www-data:www-data /var/www/html/glpi/plugins/ocsinventoryng chmod -R 755 /var/www/html/glpi/plugins/ocsinventoryng
2. Activate the OCSNG Plugin in GLPI
-
Access GLPI Web Interface:
- Navigate to
http://your-server-ip/glpiin your web browser.
- Navigate to
-
Log in as Admin:
- Ensure you have administrative privileges.
-
Navigate to Plugins:
- Go to Configuration > Plugins.
-
Install and Activate:
- Locate OCS Inventory NG in the list and click Install.
- After installation, click Activate.
3. Configure OCS Inventory NG Plugin in GLPI
-
Access Plugin Configuration:
- Go to Plugins > OCS Inventory NG.
-
Set OCS Server Details:
- OCS Server Address: Enter the URL where your OCS server is accessible (e.g.,
http://your-server-ip/ocsinventory). - Port: Default is
80unless you’ve configured it otherwise. - Credentials: Provide the necessary credentials if OCS requires authentication.
- OCS Server Address: Enter the URL where your OCS server is accessible (e.g.,
-
Database Configuration:
- If OCS and GLPI are using the same MySQL server but different databases:
- Database Host: Usually
localhost. - Database Name: The name of your OCS Inventory NG database.
- Database User: A MySQL user with read access to the OCS database.
- Password: The corresponding password.
- Database Host: Usually
- If OCS and GLPI are using the same MySQL server but different databases:
-
Synchronization Settings:
- Automatic Synchronization: Enable if you want GLPI to periodically fetch data from OCS.
- Cron Job: Set up a cron job to handle the synchronization at regular intervals.
4. Configure OCS Inventory NG to Communicate with GLPI
-
Access OCS Server Configuration:
- Navigate to your OCS server’s configuration files, typically found in
/etc/ocsinventory-server/or via the OCS web interface.
- Navigate to your OCS server’s configuration files, typically found in
-
Enable Remote Access:
- Ensure that the OCS server is configured to allow remote access for data export. This might involve enabling the OCS web services or API.
-
Set Up API or Token (If Required):
- Some integrations require an API token or key. Generate and set this up in OCS and GLPI accordingly.
5. Test the Integration
-
Perform a Manual Sync:
- In GLPI, navigate to Plugins > OCS Inventory NG and initiate a manual synchronization to test the connection.
-
Verify Data Import:
- After synchronization, check Assets > Computers in GLPI to see if the OCS data has been imported correctly.
-
Check Logs for Errors:
- If data isn’t appearing as expected, check GLPI and OCS Inventory NG logs for any error messages to troubleshoot issues.
6. Schedule Regular Synchronizations
-
Set Up a Cron Job:
- To automate data synchronization, set up a cron job that runs at desired intervals.
Example cron job to run every hour:
sudo crontab -u www-data -eAdd the following line:
0 * * * * /usr/bin/php /var/www/html/glpi/plugins/ocsinventoryng/scripts/synchronize.phpEnsure the path to
synchronize.phpmatches your installation.
7. Additional Configuration (Optional)
-
Mapping Fields:
- Customize how OCS inventory fields map to GLPI asset fields for better data coherence.
-
User Synchronization:
- If needed, set up user synchronization between OCS and GLPI to manage user access effectively.
-
Notifications and Alerts:
- Configure GLPI to send alerts based on inventory changes detected from OCS.
Troubleshooting Tips
-
Permissions Issues:
- Ensure that the web server user (
www-datafor Apache on Ubuntu) has the necessary permissions to read plugin files and access databases.
- Ensure that the web server user (
-
Firewall Settings:
- If OCS and GLPI communicate over network ports, ensure that Ubuntu’s firewall (
ufw) allows traffic on the necessary ports.
sudo ufw allow 80/tcp # HTTP sudo ufw allow 443/tcp # HTTPS, if used sudo ufw reload - If OCS and GLPI communicate over network ports, ensure that Ubuntu’s firewall (
-
Check PHP Extensions:
- Ensure that required PHP extensions for GLPI and the OCSNG plugin are installed.
sudo apt install php-xml php-mbstring php-curl sudo systemctl restart apache2 -
Review Logs:
- GLPI logs can be found in GLPI's files or via the web interface under Administration > Logs.
- OCS Inventory NG logs are typically located in
/var/log/ocsinventory-server/.
References
- GLPI Official Documentation: GLPI Documentation
- OCS Inventory NG Documentation: OCS Inventory NG Docs
- OCS Inventory NG Plugin for GLPI: GLPI Plugins - OCSNG
- Community Forums:
By following this guide, you should achieve a robust integration between OCS Inventory NG and GLPI, allowing for efficient synchronization of your IT assets and streamlined asset management.
If you encounter specific issues or need further customization, consulting the official documentation or reaching out to the respective community forums can provide additional assistance.
-