Docs » 03.
Basic documentation » Deploying database server
Deploying database server
OCS Inventory server need a database to store information from inventory
Install database server requirements
Database server need to match database version indicated in the prerequisites page
Note : On Fedora/Redhat/Centos 7 mariadb is avalaible onEPEL. you need to install
this repo for install database server.
On Fedora/Redhat/Centos 7 you can use "yum" to install mariadb
yum install mariadb-server
On Debian 9 Stretch you can use "apt" to install mariadb
apt install mariadb-server mariadb-common mariadb-client
Launch MariaDB
First step we need to launch MariaDB. On Fedora/Redhat/Centos 7 you need to enable
and start mariadb first
systemctl enable mariadb
systemctl start mariadb
Launch MariaDB
mysql -u root
If you doesn't have set password for root you can set it up by the following
command:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
Configure database server in only one server
This part is only if you want to install database server, communication server and
administration console in only one server.
First step create database:
CREATE DATABASE ocsweb;
OCS need a user to use the database "ocsweb":
CREATE USER 'ocs'@'localhost' IDENTIFIED BY 'ocs';
This user need all privileges on the database "ocsweb"
GRANT ALL PRIVILEGES ON ocsweb.* TO 'ocs'@'localhost' WITH GRANT OPTION;
Don't forget to apply parameters:
FLUSH PRIVILEGES;
Note: This user will be used by Administration server and Communication server to
connect to the database.
If you do not wish to use default MySQL user ocs with ocs password, you must update
in the file
/etc/apache2/conf-avaible/z-ocsinventory-server.conf.
Don’t forget to also enable your conf and restart apache.
Refer toSecure your OCS Inventory NG Serverfor all information about modifications
of configuration files.
Configuring database server for separated OCS Server
This part is only if you want to install database server, communication server and
administration console in separated server
First step create database:
CREATE DATABASE ocsweb;
For separated server you need to have two user if you use different server for
database, communication server and administration console
CREATE USER 'ocs'@'CommunicationServerIP' IDENTIFIED BY 'ocs';
CREATE USER 'ocs'@'AdministrationConsoleIP' IDENTIFIED BY 'ocs';
Note : If you want to deploy OCS in only two server you only need to create one
user with the communication server / admin console IP if you install a database
server and another server for communication server / administration console
Then user need all privileges on the database "ocsweb"
GRANT ALL PRIVILEGES ON ocsweb.* TO 'ocs'@'CommunicationServerIP' WITH GRANT
OPTION;
GRANT ALL PRIVILEGES ON ocsweb.* TO 'ocs'@'AdministrationConsoleIP' WITH GRANT
OPTION;
Don't forget to apply parameters:
FLUSH PRIVILEGES;
On your Communication server/Administration console server : You need to change the
host of the database in the file /etc/apache2/conf-avaible/z-ocsinventory-
server.conf
PerlSetEnv OCS_DB_HOST YourDatabaseServerIP
Don't forget to activate your conf with the following command
a2enmod z-ocsinventory-server.conf
Restart your apache service to activate the conf
systemctl restart apache2
On your Communication server/Administration console server : You need to change the
host of the database in the file
/usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php
$_SESSION["SERVEUR_SQL"]="YourDatabaseServerIP";
Note: This user will be used by Administration server and Communication server to
connect to the database.
If you do not wish to use default MySQL user ocs with ocs password, you must update
in the file
/etc/apache2/conf-avaible/z-ocsinventory-server.conf.
Don’t forget to also enable your conf and restart apache.
Refer toSecure your OCS Inventory NG Serverfor all information about modifications
of configuration files.
Docs » 03.Basic documentation » Setting up OCS Inventory Server with RPM
Setting up OCS Inventory Server with RPM
We provide RPM for Fedora, RHEL and Centos system. It may work on derivate
distribution like Amazon Linux or Scientific Linux but it has been not tested
Note on SELinux
There is no need to disable SELinux : All needed right are set in the rpm. For more
information about using selinux, please read this documentation.
Setting up the repo
Other repositories required:
Fedora: Remi
RHEL: EPEL, Remi
CentOS: EPEL, Remi
YUM/DNF automatic configuration
The simplest way is to install the ocsinventory-release package which provides the
repository configuration for YUM/DNF and the GPG key used to sign the RPM.
Enterprise Linux 7 (with EPEL and Remi) x86_64
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm
wget https://rpm.ocsinventory-ng.org/ocsinventory-release-latest.el7.ocs.noarch.rpm
yum install ocsinventory-release-latest.el7.ocs.noarch.rpm epel-release-latest-
7.noarch.rpm remi-release-7.rpm
Enterprise Linux 8 (with EPEL and Remi) x86_64
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
wget https://rpms.remirepo.net/enterprise/remi-release-8.rpm
wget https://rpm.ocsinventory-ng.org/ocsinventory-release-latest.el8.ocs.noarch.rpm
dnf install ocsinventory-release-latest.el8.ocs.noarch.rpm epel-release-latest-
8.noarch.rpm remi-release-8.rpm
Enterprise Linux 9 (with EPEL and Remi) x86_64 (Rocky, Alma and RHEL)
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
wget https://rpms.remirepo.net/enterprise/remi-release-9.rpm
wget https://rpm.ocsinventory-ng.org/ocsinventory-release-latest.el9.ocs.noarch.rpm
dnf install ocsinventory-release-latest.el9.ocs.noarch.rpm epel-release-latest-
9.noarch.rpm remi-release-9.rpm
Fedora 29 (with Remi) x86_64
dnf install https://rpm.ocsinventory-ng.org/ocsinventory-release-
latest.fc29.ocs.noarch.rpm https://rpms.remirepo.net/fedora/remi-release-29.rpm
Fedora 30 x86_64
dnf install https://rpm.ocsinventory-ng.org/ocsinventory-release-
latest.fc30.ocs.noarch.rpm
Fedora 31 x86_64
dnf install https://rpm.ocsinventory-ng.org/ocsinventory-release-
latest.fc31.ocs.noarch.rpm
Fedora 32 x86_64
dnf install https://rpm.ocsinventory-ng.org/ocsinventory-release-
latest.fc32.ocs.noarch.rpm
Fedora 33 x86_64
dnf install https://rpm.ocsinventory-ng.org/ocsinventory-release-
latest.fc33.ocs.noarch.rpm
Fedora 34 x86_64
dnf install https://rpm.ocsinventory-ng.org/ocsinventory-release-
latest.fc34.ocs.noarch.rpm
Fedora 35 x86_64
dnf install https://rpm.ocsinventory-ng.org/ocsinventory-release-
latest.fc35.ocs.noarch.rpm
Fedora 36 x86_64
dnf install https://rpm.ocsinventory-ng.org/ocsinventory-release-
latest.fc36.ocs.noarch.rpm
Fedora 37 x86_64
dnf install https://rpm.ocsinventory-ng.org/ocsinventory-release-
latest.fc37.ocs.noarch.rpm
Fedora 38 x86_64
dnf install https://rpm.ocsinventory-ng.org/ocsinventory-release-
latest.fc38.ocs.noarch.rpm
Install OCS Inventory server with APT
On Debian-based distributions you can install the server with APT
You need to add our repository using the following command
$ curl -sS https://deb.ocsinventory-ng.org/pubkey.gpg | sudo apt-key add -
$ echo "deb http://deb.ocsinventory-ng.org/debian/ <distribution_codename> main" |
sudo tee /etc/apt/sources.list.d/ocsinventory.list
$ sudo apt update
You will have to replace by one of the following term depending on the installation
context :
bookworm | stable
bullseye | oldstable
buster | oldoldstable
sid | unstable
Then install the server using :
$ sudo apt install ocsinventory
You can install only the web console with
$ sudo apt install ocsinventory-ocsreports
Or only the communication server with :
$ sudo apt install ocsinventory-server
On Ubuntu-based distributions you can install the server with APT
You need to add our repository using the following command
$ curl -sS https://deb.ocsinventory-ng.org/pubkey.gpg | sudo apt-key add -
$ echo "deb http://deb.ocsinventory-ng.org/ubuntu/ <distribution_codename> main" |
sudo tee /etc/apt/sources.list.d/ocsinventory.list
$ sudo apt update
You will have to replace by one of the following term depending on the installation
context :
noble | stable
jammy | oldstable
focal | backport
Then install the server using :
$ sudo apt install ocsinventory
You can install only the web console with
$ sudo apt install ocsinventory-ocsreports
Or only the communication server with :
$ sudo apt install ocsinventory-server
Install OCS Inventory server
The repo provide the following packages:
ocsinventory: Meta package for ocsinventory-server and ocsinventory-reports
ocsinventory-server: Contain the server
ocsinventory-reports: Contain ocsreports, the Admin GUI
ocsinventory-agent: Meta package for ocsinventory-agent-core and full dependancies
ocsinventory-agent-core: Contain the agent with the minimal depandancies
Here will be the instructions for installing the server with the Admin GUI.
Enterprise Linux 7
yum install yum-utils
yum-config-manager --enable remi
yum-config-manager --enable remi-php73
yum install ocsinventory
Enterprise Linux 8
dnf install yum-utils
yum-config-manager --enable remi
dnf module reset php
dnf module install php:remi-7.3
dnf install --enablerepo=powertools ocsinventory
Enterprise Linux 9
dnf install yum-utils
yum-config-manager --enable remi
yum-config-manager --enable crb
dnf install ocsinventory
Fedora
dnf install ocsinventory
Configure your environment
Mariadb
At first, you need to enable and launch mariadb:
systemctl enable mariadb
systemctl start mariadb
To secure your database, please launch the following command:
mysql_secure_install
On Enterprise Linux 8 use the following command to secure your Database:
mysql_secure_installation
Apache
You need to enable and launch apache:
systemctl enable httpd
systemctl start httpd
PHP
On RHEL 7 or Centos 7, nothing is needed for php.
On Fedora, RHEL 8 and Centos 8, php-fpm is used and must be enable:
systemctl enable php-fpm
systemctl start php-fpm
Firewalld
By default, firewalld block all needed port. To open them:
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --zone=public --add-service=https --permanent
firewall-cmd --reload
Configuring management server
Warning: We recommend you to check your php.ini when you upgrade your server from
1.x to 2.x,
specially these variables :
max_execution_time
max_input_time
memory_limit
Note: You are not obliged to launch install.php, you can use this command too :
mysql -f -hlocalhost -uroot -p DBNAME < ocsbase.sql >log.log
Else, open your favorite web browser and point it on URL
http://administration_console/ocsreports to connect the Administration server.
As database is not yet created, this will begin OCS Inventory setup process.
Otherwise, you can rerun configuration process by browsing
http://administration_console/ocsreports/install.php URL (this must be used when
upgrading OCS Inventory management server).
Note: You will see warning regarding max size of package you will be able to
deploy. Please, seeUploads size for package deploymentto configure your server to
match your need.
Installation's page of ocsreports
Fill in information to connect to MySQL database server with a user who has the
ability to create database, tables, indexes, etc (usually root):
MySQL user name
MySQL user password
MySQL hostname
To secure your server, refer to Secure your OCS Inventory NG Server documentation.
If you don't want to secure your OCS Inventory Server, you have to desactivate
Warning message in user profile. Procedure is in the same documentation page.
Warning: We recommend you to read this documentation and follow the procedure.
Installation of ocsreports
Click on the following link : "Click here to enter OCS-NG GUI"
Just point your browser to the URL http://administration_server/ocsreports and
login in with admin as user and admin as password.
Ocsreports' homsecreen
Docs » 03.Basic documentation » Setting up OCS Inventory Server
Setting up OCS Inventory Server
Management server is made up of 4 main components:
Database server, which stores inventory information.
Communication server, which handles HTTP communications between database server and
agents.
Administration console, which allows administrators to query the database server
using their favorite browser.
Deployment server, which stores all package deployment configuration (requires
HTTPS!).
These 4 components can be hosted on a single computer or on different computers to
allow load balancing. Above 10000 inventoried computers, we recommend using at
least 2 physical servers, one hosting database server + Communication server and
the other one hosting a database replica + Administration server + Deployement
server.
Ocs Inventory NG communication architecture
Figure 1 : OCS Inventory NG communication architecture.
Database server currently can only be MySQL 8.0 or MariaDB with InnoDB engine
active. Communication server needs Apache Web Server 2.2.X / 2.4.X and is written
in PERL as an Apache module. Why? Because PERL scripts are compiled when Apache
starts, and not at each request. This is better performance-wise. Communication
server may require some additional PERL modules, according to your distribution.
Deployment server needs any Web Server with SSL enabled. Administration console is
written in PHP 7 (or higher) and runs under Apache Web Server 2.2.X /2.4.X.
Administration console requires ZIP and GD support enabled in PHP in order to use
package deployment.
Under Fedora/RHEL/Centos
We provide RPM for RedHat Linux and derivate. Instructions can be find here:
Install with RPM
Install from Source
We assume that you have:
MySQL or MariaDB database server running somewhere and listening on default port
3306 with TCP/IP communication enabled.
Apache Web server installed and running for Communication server and Administration
server.
PHP and Perl installed and usable by Apache Web server for the Administration
console.
Perl and mod_perl installed and usable by Apache Web server for the Communication
server.
Requirements
For the requirements, please follow the dedicated page :
Prerequisites
Note: OCS Inventory NG Server Setup will check for all these components and will
exit
if any are missing.
Installing Communication server required PERL modules.
The web communication server requires Apache web server and Perl 5 scripting
language and some additional modules for Perl 5 (see Requirements). It acts as an
Apache module which handles HTTP OCS Inventory agents' requests to a virtual
directory /ocsinventory. Already the web communication server requires mysql
dependencies if you choose to install the database server alone, you can reffer to
this page : Deploying Database Server
On Fedora/Redhat/Centos 7 like Linux
yum install httpd
yum install mariadb
On Debian 9 Stretch like Linux
apt install apache2
apt install mariadb-client
Warning: You must have root privileges to set required perl modules up.
It is better for system integrity to use your distribution's precompiled packages
when they are available.
Some of these packages are only available inEPEL.
Note: On Fedore/Redhat/Centos 7 the package " Apache DBI " wasn't in the repo EPEL
you can find the rpmhere.
On Fedora/Redhat/Centos 7 like Linux, you can use “yum” to set required modules up:
yum install perl-XML-Simple perl-Compress-Zlib perl-DBI perl-DBD-MySQL perl-Net-IP
perl-SOAP-Lite perl-Archive-Zip perl-Mojolicious perl-Plack perl-XML-Entities perl-
Switch
On Debian 9 Stretch like Linux, you can use “apt” to set required modules up:
apt install libxml-simple-perl libdbi-perl libdbd-mysql-perl libapache-dbi-perl
libnet-ip-perl libsoap-lite-perl libarchive-zip-perl make build-essential
cpan install XML::Entities
On Gentoo like Linux, you can use "emerge" to get required modules set up:
emerge dev-perl/XML-Simple perl-core/IO-Compress dev-perl/Apache-DBI dev-perl/Net-
IP dev-perl/SOAP-Lite app-portage/g-cpan
g-cpan -i XML::Entities
Installing Administration console required PHP modules
The Web Administration console requires Apache web server and PHP 7 scripting
language and some additional modules for PHP (see Requirements). Already the web
communication server requires mysql dependencies if you choose to install the
database server alone, you can refers to this page : Deploying Database Server
On Fedora/Redhat/Centos 7 like Linux
yum install httpd
yum install mariadb-client
On Debian 9 Stretch like Linux
apt install apache2
apt install mariadb-client
install PHP Zip support and dependacies
On Fedora/Redhat/Centos 7 like Linux, you can use “yum” to set it up:
yum install php-pecl-zip
yum install perl-XML-Simple perl-DBI perl-DBD-MySQL perl-Net-IP php-mbstring
For later Fedora installations 7.x+ :
yum install php-common
On Debian 9 Stretch like Linux, you can use “apt” to set it up:
apt install php-pclzip make build-essential libdbd-mysql-perl libnet-ip-perl
libxml-simple-perl php php-mbstring php-soap php-mysql php-curl php-xml php-zip
You also need to install GD support for PHP.
On Fedora/Redhat/Centos 7 like Linux
yum install php-gd
On Debian 9 Stretch like Linux, you can use “apt” to set it up:
apt install php-gd
Installing management server
You must have root privileges to set OCS Inventory Server up.
Note: Ensure MySQL InnoDB engine is activated on your database server.
Open my.cnf and ensure there is no line “skip-innodb” or this line is commented
(begins with ‘#’).
Download latest version of server tarball “OCSNG_UNIX_SERVER-2.12.x.tar.gz” from
OCS Inventory Web Site.
Unpack it.
tar –xvzf OCSNG_UNIX_SERVER-2.12.x.tar.gz
cd OCSNG_UNIX_SERVER-2.12.x
Since 2.12.x, it is possible to provide a setup.answers file with default
configuration.
You will find a default setup.answers file at the root of the OCSNG_UNIX_SERVER-
2.12.x folder.
You can also create your own setup.answers file like this:
echo 'OCS_DB_HOST=localhost' > setup.answers
The responses from the file will override the default choices in the setup.sh file.
Run “setup.sh” installer. During the installer, default choice is presented between
[]. For example, [y]/n means that “y” (yes) is the default choice, and “n” (no) is
the other choice.
sh setup.sh
Note: Installer writes a log file “ocs_server_setup.log” in the same directory.
If you encounter any error, please refer to this log for detailed error message.
Warning: If you’re upgrading from OCS Inventory NG 1.01 RC2 and previous,
you must first remove any Apache configuration file for Communication server.
Do you wish to continue ([y]/n)?
Type "y" or "enter" to continue the installation
Which host is running database server [localhost] ?
Type “y” or “enter” to validate and, then enter MySQL server host address, in most
cases localhost.
Then, setup checks for MySQL client binary files version 4.1 or higher. If not
present, you will be prompted to continue or abort setup.
On which port is running database server [3306] ?
If all is OK, enter MySQL server port, generally 3306.
Where is Apache daemon binary [/usr/sbin/apache2ctl] ?
Enter or validate path to Apache daemon binary, generally “/usr/sbin/apache2ctl”.
It will be used to find Apache configuration files.
Note: If you’re not using system Apache daemon, but another one like XAMPP/LAMPP
Apache server,
you must enter full path to your Apache daemon, not the system one.
Where is Apache main configuration file [/etc/apache2/apache2.conf] ?
Enter or validate Apache main configuration file path, generally
“/etc/apache2/conf/apache2.conf” or “/etc/httpd/conf/httpd.conf”.
Which user account is running Apache web server [www-data] ?
Enter or validate Apache daemon running user account, generally “apache” or “www”
(under Debian/Ubuntu is “www-data”).
Which user group is running Apache web server [www-data] ?
Enter or validate Apache daemon user group, generally “apache” or “www” (under
Debian/Ubuntu is “www-data”).
Where is PERL interpreter binary [/usr/bin/perl] ?
Next, setup checks for PERL interpreter binaries. Enter or validate path to PERL
interpreter.
Note: If you’re not using system perl interpreter, but another one like XAMPP/LAMPP
perl interpreter,
you must specify full path to this perl interpreter, not the default system one
(/opt/lampp/bin/perl generally used in XAMPP/LAMPP).
Do you wish to setup Communication server on this computer ([y]/n)?
Common information for setting up Communication server or Administration console is
now collected. Setup prompts you if you wish to set Communication server up on this
computer. Enter “y” or validate to set Communication server up, “n” to skip
Communication server installation.
Setup will then try to find make utility. If it fails, setup will stop.
Setup will next try to determine your Apache mod_perl version. If it is not able to
determine mod_perl version, it will ask you to enter it.
Note: You can check which version of mod_perl you are using by querying your
server's software database.
Under RPM enabled Linux distribution (RedHat/Fedora, Mandriva…),run rpm –q
mod_perl.
Under DPKG enabled Linux distribution (Debian, Ubuntu…), run dpkg –llibapache*-mod-
perl*.
Communication server can create detailed logs. This logs can be enabled by setting
integer value of LOGLEVEL to 1 in Administration console menu Configuration.
Where to put Communication server log directory [/var/log/ocsinventory-server] ?
Communication server need a directory for plugins configuration files.
Where to put Communication server plugins configuration files [/etc/ocsinventory-
server/plugins] ?
Communication server need a directory for plugins Perl modules files.
Where to put Communication server plugins Perl modules files [/etc/ocsinventory-
server/perl] ?
Next, setup will check for required PERL modules (cf Requirements.):
XML::Simple version 2.12 or higher
Compress::Zlib version 1.33 or higher
DBI version 1.40 or higher
DBD::mysql version 2.9004 or higher
Apache::DBI version 0.93 or higher
Net::IP version 1.21 or higher
SOAP::Lite version 0.66 or higher
Warning: If any of these modules is missing, setup will abort.
the setup will ask you if you want to install the rest API
Do you wish to setup Rest API server on this computer ([y]/n)?
asking you for where you want store API code
Where do you want the API code to be store [/usr/local/share/perl/5.24.1] ?
If all is OK, setup will install Communication server:
Configure Communication server PERL module.
Build Communication server PERL module.
Install Communication server PERL module into PERL standard library directories.
Create Communication server log directory (/var/log/ocsinventory-server by
default).
Configure daily log rotation for Communication server (file
/etc/logrotate.d/ocsinventory-server by default)
Creating Communication server plugins configuration directory (/etc/ocsinventory-
server/plugins).
Creating Communication server plugins Perl directory
(/etc/ocsinventory-server/perl).
Create Apache configuration file (ocsinventory-server.conf). If you are using
Apache configuration directory, this file will be copied under this directory.
Otherwise, you will be prompted to add content of this file to the end of Apache
main configuration file.
To ensure Apache loads mod_perl before OCS Inventory NG Communication Server, Setup
can name Communication Server Apache configuration file 'z-ocsinventory-
server.conf' instead of 'ocsinventory-server.conf'.
```Do you allow Setup renaming Communication Server Apache configuration file to
'z-ocsinventory-server.conf' ([y]/n) ?
**`Warning: Do not add content to apache main configuration file if it is not a
fresh install!
You must manually copy content of the ocsinventory.conf.local file created by setup
into apache
main configuration file, replacing existing configuration.`**
################################################################################ #
# OCS Inventory NG Communication Server Perl Module Setup # # Copyleft 2006 Pascal
DANEK # Web: http://www.ocsinventory-ng.org # # This code is open source and may be
copied and modified as long as the source # code is always made freely available. #
Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
################################################################################
# Which version of mod_perl we are using # For mod_perl <= 1.999_21, replace 2 by 1
# For mod_perl > 1.999_21, replace 2 by 2 PerlSetEnv OCS_MODPERL_VERSION 2
# Master Database settings # Replace localhost by hostname or ip of MySQL server
for WRITE PerlSetEnv OCS_DB_HOST localhost # Replace 3306 by port where running
MySQL server, generally 3306 PerlSetEnv OCS_DB_PORT 3306 # Name of database
PerlSetEnv OCS_DB_NAME ocsweb PerlSetEnv OCS_DB_LOCAL ocsweb # User allowed to
connect to database PerlSetEnv OCS_DB_USER user # Password for user PerlSetVar
OCS_DB_PWD user
# Slave Database settings # Replace localhost by hostname or ip of MySQL server for
READ # Useful if you handle mysql slave databases # PerlSetEnv OCS_DB_SL_HOST
localhost # Replace 3306 by port where running MySQL server, generally 3306 #
PerlSetEnv OCS_DB_SL_PORT_SLAVE 3306 # User allowed to connect to database #
PerlSetEnv OCS_DB_SL_USER ocs # Name of the database # PerlSetEnv OCS_DB_SL_NAME
ocsweb # Password for user # PerlSetVar OCS_DB_SL_PWD ocs
# Path to log directory (must be writeable) PerlSetEnv OCS_OPT_LOGPATH
"/var/log/ocsinventory-server"
# If you need to specify a mysql socket that the client's built-in #PerlSetEnv
OCS_OPT_DBI_MYSQL_SOCKET "path/to/mysql/unix/socket" # DBI verbosity PerlSetEnv
OCS_OPT_DBI_PRINT_ERROR 0
# Unicode support PerlSetEnv OCS_OPT_UNICODE_SUPPORT 1
# If you are using a multi server architecture, # Put the ip addresses of the
slaves on the master # (This is read as perl regular expressions) PerlAddVar
OCS_OPT_TRUSTED_IP 127.0.0.1 #PerlAddVar OCS_OPT_TRUSTED_IP XXX.XXX.XXX.XXX
# ===== WEB SERVICE (SOAP) SETTINGS =====
PerlSetEnv OCS_OPT_WEB_SERVICE_ENABLED 0 PerlSetEnv
OCS_OPT_WEB_SERVICE_RESULTS_LIMIT 100 # PerlSetEnv
OCS_OPT_WEB_SERVICE_PRIV_MODS_CONF "WEBSERV_PRIV_MOD_CONF_FILE"
# Be careful: you must restart apache to make settings taking effects
# Configure engine to use the settings from this file PerlSetEnv
OCS_OPT_OPTIONS_NOT_OVERLOADED 0
# Try to use other compress algorithm than raw zlib # GUNZIP and clear XML are
supported PerlSetEnv OCS_OPT_COMPRESS_TRY_OTHERS 1
############################################################## # ===== OPTIONS
BELOW ARE OVERLOADED IF YOU USE OCS GUI =====#
##############################################################
# NOTE: IF YOU WANT TO USE THIS CONFIG FILE INSTEAD, set
OCS_OPT_OPTIONS_NOT_OVERLOADED to '1'
# ===== MAIN SETTINGS =====
# Enable engine logs (see LOGPATH setting) PerlSetEnv OCS_OPT_LOGLEVEL 0 # Specify
agent's prolog frequency PerlSetEnv OCS_OPT_PROLOG_FREQ 12 # Specify if agent take
contact on service startup PerlSetEnv OCS_OPT_INVENTORY_ON_STARTUP 0 # Configure
the duplicates detection system PerlSetEnv OCS_OPT_AUTO_DUPLICATE_LVL 15 # Futur
security improvements PerlSetEnv OCS_OPT_SECURITY_LEVEL 0 # Validity of a
computer's lock PerlSetEnv OCS_OPT_LOCK_REUSE_TIME 600 # Enable the history
tracking system (useful for external data synchronisation PerlSetEnv
OCS_OPT_TRACE_DELETED 0
# ===== INVENTORY SETTINGS =====
# Specify the validity of inventory data PerlSetEnv OCS_OPT_FREQUENCY 0 # Configure
engine to update inventory regarding to CHECKSUM agent value (lower DB backend
load) PerlSetEnv OCS_OPT_INVENTORY_DIFF 1 # Make engine consider an inventory as a
transaction (lower concurency, better disk usage) PerlSetEnv
OCS_OPT_INVENTORY_TRANSACTION 1 # Configure engine to make a differential update of
inventory sections (row level). Lower DB backend load, higher frontend load
PerlSetEnv OCS_OPT_INVENTORY_WRITE_DIFF 1 # Enable some stuff to improve DB
queries, especially for GUI multicriteria searching system PerlSetEnv
OCS_OPT_INVENTORY_CACHE_ENABLED 1 # Specify when the engine will clean the
inventory cache structures PerlSetEnv OCS_OPT_INVENTORY_CACHE_REVALIDATE 7 # Enable
you to keep trace of every elements encountered in db life PerlSetEnv
OCS_OPT_INVENTORY_CACHE_KEEP 1
# ===== SOFTWARES DEPLOYMENT SETTINGS =====
# Enable this feature PerlSetEnv OCS_OPT_DOWNLOAD 0 # Package which have a priority
superior than this value will not be downloaded PerlSetEnv
OCS_OPT_DOWNLOAD_PERIOD_LENGTH 10 # Time between two download cycles (bandwidth
control) PerlSetEnv OCS_OPT_DOWNLOAD_CYCLE_LATENCY 60 # Time between two fragment
downloads (bandwidth control) PerlSetEnv OCS_OPT_DOWNLOAD_FRAG_LATENCY 60 # Specify
if you want to track packages affected to a group on computer's level PerlSetEnv
OCS_OPT_DOWNLOAD_GROUPS_TRACE_EVENTS 1 # Time between two download periods
(bandwidth control) PerlSetEnv OCS_OPT_DOWNLOAD_PERIOD_LATENCY 60 # Agents will
send ERR_TIMEOUT event and clean the package it is older than this setting
PerlSetEnv OCS_OPT_DOWNLOAD_TIMEOUT 7 # Agents will send an error event and clean
the package if package command does not respond during this setting PerlSetEnv
OCS_OPT_DOWNLOAD_EXECUTION_TIMEOUT 120
# Enable ocs engine to deliver agent's files (deprecated) PerlSetEnv OCS_OPT_DEPLOY
0 # Enable the softwares deployment capacity (bandwidth control)
# ===== GROUPS SETTINGS =====
# Enable the computer\s groups feature PerlSetEnv OCS_OPT_ENABLE_GROUPS 1 # Random
number computed in the defined range. Designed to avoid computing many groups in
the same process PerlSetEnv OCS_OPT_GROUPS_CACHE_OFFSET 43200 # Specify the
validity of computer's groups (default: compute it once a day - see offset)
PerlSetEnv OCS_OPT_GROUPS_CACHE_REVALIDATE 43200
# ===== IPDISCOVER SETTINGS =====
# Specify how much agent per LAN will discovered connected peripherals (0 to
disable) PerlSetEnv OCS_OPT_IPDISCOVER 2 # Specify the minimal difference to
replace an ipdiscover agent PerlSetEnv OCS_OPT_IPDISCOVER_BETTER_THRESHOLD 1 # Time
between 2 arp requests (mini: 10 ms) PerlSetEnv OCS_OPT_IPDISCOVER_LATENCY 100 #
Specify when to remove a computer when it has not come until this period PerlSetEnv
OCS_OPT_IPDISCOVER_MAX_ALIVE 14 # Disable the time before a first election (not
recommended) PerlSetEnv OCS_OPT_IPDISCOVER_NO_POSTPONE 0 # Enable groups for
ipdiscover (for example, you might want to prevent some groups to be ipdiscover
agents) PerlSetEnv OCS_OPT_IPDISCOVER_USE_GROUPS 1
# ===== INVENTORY FILES MAPPING SETTINGS =====
# Use with ocsinventory-injector, enable the multi entities feature PerlSetEnv
OCS_OPT_GENERATE_OCS_FILES 0 # Generate either compressed file or clear XML text
PerlSetEnv OCS_OPT_OCS_FILES_FORMAT OCS # Specify if you want to keep trace of all
inventory between to synchronisation with the higher level server PerlSetEnv
OCS_OPT_OCS_FILES_OVERWRITE 0 # Path to ocs files directory (must be writeable)
PerlSetEnv OCS_OPT_OCS_FILES_PATH /tmp
# ===== FILTER SETTINGS =====
# Enable prolog filter stack PerlSetEnv OCS_OPT_PROLOG_FILTER_ON 0 # Enable core
filter system to modify some things "on the fly" PerlSetEnv
OCS_OPT_INVENTORY_FILTER_ENABLED 0 # Enable inventory flooding filter. A dedicated
ipaddress ia allowed to send a new computer only once in this period PerlSetEnv
OCS_OPT_INVENTORY_FILTER_FLOOD_IP 0 # Period definition for
INVENTORY_FILTER_FLOOD_IP PerlSetEnv OCS_OPT_INVENTORY_FILTER_FLOOD_IP_CACHE_TIME
300 # Enable inventory filter stack PerlSetEnv OCS_OPT_INVENTORY_FILTER_ON 0
# ===== DATA FILTER =====
#Enable the dat filtering capacity PerlSetEnv OCS_OPT_DATA_FILTER 0
# Set the table names and the field associated you want to filter #PerlAddVar
OCS_OPT_DATA_TO_FILTER HARDWARE #PerlAddVar OCS_OPT_DATA_TO_FILTER USERID
# ===== REGISTRY SETTINGS =====
# Enable the registry capacity PerlSetEnv OCS_OPT_REGISTRY 1
# ===== SNMP SETTINGS =====
# Enable the SNMP capacity PerlSetEnv OCS_OPT_SNMP 0 # Configure engine to update
snmp inventory regarding to snmp_laststate table (lower DB backend load) PerlSetEnv
OCS_OPT_SNMP_INVENTORY_DIFF 1 # Display error message about agent https
communication in logfile PerlSetEnv OCS_OPT_SNMP_PRINT_HTTPS_ERROR 1
# ===== SESSION SETTINGS ===== # Not yet in GUI
# Validity of a session (prolog=>postinventory) PerlSetEnv
OCS_OPT_SESSION_VALIDITY_TIME 600 # Consider a session obsolete if it is older
thant this value PerlSetEnv OCS_OPT_SESSION_CLEAN_TIME 86400 # Accept an inventory
only if required by server #( Refuse "forced" inventory) PerlSetEnv
OCS_OPT_INVENTORY_SESSION_ONLY 0
# ===== TAG =====
# The default behavior of the server is to ignore TAG changes from the # agent.
PerlSetEnv OCS_OPT_ACCEPT_TAG_UPDATE_FROM_CLIENT 0
# ===== EXTERNAL USERAGENTS =====
#Path for external useragents reference file #!! WARNING !! : external agents may
not be supported by OCS NG Community ! #PerlSetEnv OCS_OPT_EXT_USERAGENTS_FILE_PATH
/tmp/yourfile.txt
# ===== PLUGINS =====
PerlSetEnv OCS_PLUGINS_PERL_DIR "/etc/ocsinventory-server/perl" PerlSetEnv
OCS_PLUGINS_CONF_DIR "/etc/ocsinventory-server/plugins"
# ===== DEPRECATED =====
# Set the proxy cache validity in http headers when sending a file PerlSetEnv
OCS_OPT_PROXY_REVALIDATE_DELAY 3600 # Deprecated PerlSetEnv OCS_OPT_UPDATE 0
############ DO NOT MODIFY BELOW ! #######################
# External modules PerlModule Apache::DBI PerlModule Compress::Zlib PerlModule
XML::Simple
# Ocs plugins PerlModule Apache::Ocsinventory::Plugins::Apache PerlModule
Apache::Ocsinventory::Plugins
# Ocs PerlModule Apache::Ocsinventory PerlModule
Apache::Ocsinventory::Server::Constants PerlModule
Apache::Ocsinventory::Server::System PerlModule
Apache::Ocsinventory::Server::Communication PerlModule
Apache::Ocsinventory::Server::Inventory PerlModule
Apache::Ocsinventory::Server::Duplicate
# Capacities PerlModule Apache::Ocsinventory::Server::Capacities::Registry
PerlModule Apache::Ocsinventory::Server::Capacities::Update PerlModule
Apache::Ocsinventory::Server::Capacities::Ipdiscover PerlModule
Apache::Ocsinventory::Server::Capacities::Download PerlModule
Apache::Ocsinventory::Server::Capacities::Notify PerlModule
Apache::Ocsinventory::Server::Capacities::Snmp # This module guides you through the
module creation # PerlModule Apache::Ocsinventory::Server::Capacities::Example #
This module adds some rules to filter some request sent to ocs server in the prolog
and inventory stages # PerlModule Apache::Ocsinventory::Server::Capacities::Filter
# This module add availibity to filter data from HARDWARE section (data filtered
won't be stored in database) # PerlModule
Apache::Ocsinventory::Server::Capacities::Datafilter
# PerlTaintCheck On
# SSL apache settings #SSLEngine "SSL_ENABLE" #SSLCertificateFile
"SSL_CERTIFICATE_FILE" #SSLCertificateKeyFile "SSL_CERTIFICATE_KEY_FILE"
#SSLCACertificateFile "SSL_CERTIFICATE_FILE" #SSLCACertificatePath
"SSL_CERTIFICATE_PATH" #SSLVerifyClient "SSL_VALIDATE_CLIENT"
# Engine apache settings # "Virtual" directory for handling OCS Inventory NG agents
communications # Be careful, do not create such directory into your web server root
document ! # Apache 2.4 Require all granted # Apache 2.2 order deny,allow allow
from all # If you protect this area you have to deal with http_auth_* agent's
parameters # AuthType Basic # AuthName "OCS Inventory agent area" # AuthUserFile
"APACHE_AUTH_USER_FILE" # require valid-user SetHandler perl-script PerlHandler
Apache::Ocsinventory
Web Service for plugin engine
# Apache 2.4 Require local # Apache 2.2 order deny,allow allow from 127.0.0.1
SetHandler perl-script PerlHandler Apache::Ocsinventory::Plugins::Apache
# Web service apache settings PerlModule Apache::Ocsinventory::SOAP
SetHandler perl-script PerlHandler "Apache::Ocsinventory::SOAP"
# By default, you can query web service from everywhere with a valid user
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Allow from all
</IfModule>
AuthType Basic
AuthName "OCS Inventory SOAP Area"
# Use htpasswd to create/update soap-user (or another granted user)
AuthUserFile "APACHE_AUTH_USER_FILE"
<IfModule mod_authz_core.c>
# Apache 2.4
Require user "SOAP_USER"
</IfModule>
<IfModule !mod_authz_core.c>
require "SOAP_USER"
</IfModule>
**Figure 2: Apache configuration sample file**
Communication server installation is now finished. You will be prompted to set
Administration console up.
Enter “y” or validate to set Administration console up, enter “n” to skip
Administration console installation.
```Do you wish to setup Administration Server (Web Administration Console)
on this computer ([y]/n)?
CAUTION: Setup now install files in accordance with Filesystem Hierarchy
Standard. So, no file is installed under Apache root document directory
(Refer to Apache configuration files to locate it).
If you're upgrading from OCS Inventory NG Server 1.01 and previous, YOU
MUST REMOVE (or move) directories 'ocsreports' and 'download' from Apache
root document directory.
If you choose to move directory, YOU MUST MOVE 'download' directory to
Administration Server writable/cache directory (by default
/var/lib/ocsinventory-reports), especially if you use deployment feature.
Setup asking you to copy Administration Server static files for PHP Web Console
```Where to copy Administration Server static files for PHP Web Console
[/usr/share/ocsinventory-reports] ?
Setup asking you to create writable/cache directories for deployment packages,
administration console logs, IPDiscover and SNMP
```Where to create writable/cache directories for deployment packages,
administration console logs, IPDiscover and SNMP [/var/lib/ocsinventory-reports] ?
Next, setup will check for required PERL modules (cf Requirements.):
XML::Simple version 2.12 or higher
DBI version 1.40 or higher
DBD::Mysql version 2.9004 or higher
Net::IP version 1.21 or higher
Apache::DBI
Compress::Zlib
SOAP::Lite
Archive::Zip
Warning: If any of these modules is missing, setup will abort.
If everything is OK, setup will install Administration console into the
“ocsreports” subdirectory:
Creating PHP directory /usr/share/ocsinventory-reports/ocsreports.
Creating database configuration file
/usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php.
Creating IPDiscover directory /var/lib/ocsinventory-reports/ipd.
Creating packages directory /var/lib/ocsinventory-reports/download.
Creating snmp mibs directory /var/lib/ocsinventory-reports/snmp.
Creating Administration server log files directory
/var/lib/ocsinventory-reports/logs.
Creating Administration server scripts log files directory /var/lib/ocsinventory-
reports/scripts.
Configuring / Installing IPDISCOVER-UTIL Perl script.
Writing Administration server configuration to file
/etc/apache2/conf-available/ocsinventory-reports.conf
Fix directories and files permissions to allow Apache daemon reading and writing to
required directories (write access is required in /ocsreports, /ocsreports/ipd
and /download, cf § 11.4 Files and directories permissions under Linux.).
Configure PERL script ipdiscover-util.pl to access database and install it.
Now, you can restart Apache web server for changes to take effect.
systemctl restart apache2
Configuring management server
Warning: We recommend you to check your php.ini when you upgrade your server from
1.x to 2.x,
specially these variables :
max_execution_time
max_input_time
memory_limit
Note: You are not obliged to launch install.php, you can use this command too :
mysql -f -hlocalhost -uroot -p DBNAME < ocsbase.sql >log.log
Else, open your favorite web browser and point it on URL
http://administration_console/ocsreports to connect the Administration server.
As database is not yet created, this will begin OCS Inventory setup process.
Otherwise, you can rerun configuration process by browsing
http://administration_console/ocsreports/install.php URL (this must be used when
upgrading OCS Inventory management server).
Note: You will see warning regarding max size of package you will be able to
deploy. Please, seeUploads size for package deploymentto configure your server to
match your need.
Installation's page of ocsreports
Fill in information to connect to MySQL database server with a user who has the
ability to create database, tables, indexes, etc (usually root):
MySQL user name
MySQL user password
MySQL hostname
Setup actions : refer to Deploying Database Server
To secure your server, refer to Secure your OCS Inventory NG Server documentation.
If you don't want to secure your OCS Inventory Server, you have to desactivate
Warning message in user profile. Procedure is in the same documentation page.
Warning: We recommend you to read this documentation and follow the procedure.
Installation of ocsreports
Click on the following link : "Click here to enter OCS-NG GUI"
Just point your browser to the URL http://administration_server/ocsreports and
login in with admin as user and admin as password.
Ocsreports' homsecreen
Android Agent Documentation
Operating principe
OCS Inventory NG Agent for Android can run as a service automatically at boot time.
It can also work as a stand alone application launched manually.
Which version: Service or Standalone ?
The Windows service version will automatically communicate with the OCS-NG system
and perform inventories based on parameters set on the server (Inventory
Frequency). The standalone client is used for computers that cannot communicate
with the server, or where the service version is not wanted or allowed.
When an inventory is done, agent uses and writes in files stored in directory
"SDCARD/ocs". This directory is /mnt/sdcard/ocs.
Prerequisites
Have a device under Android 4.0 or higher.
Installation of Android Agent
2 solutions to install Android agent.
From OCS repository on Github : Download and decompress the lastestversion of
Android Agent from download page of our website.
Place this file on SDCARD and launch it.
From PlayStore : Download application and launch installation.
Download of android agent
At the end of installation, icon is created on desktop, and a message prevents your
application was installed correctly. Click on Open to quit the playstore and launch
application.
Windows agent installed
Note: On android v6.0 and more when you launch the app you can authorize the
application to access to the different information and data on your device
Authorize appli to acces Authorize appli to acces Authorize appli to acces
Now you see the main screen of the application, which allows you to:
send an inventory (you will have to fix the configuration before)
display inventory (section by section)
store inventory on your SDCARD (/mnt/sdcard/ocs/inventory.xml)
edit the configuration, using configuration standard menu of Android
Homescreen of android agent
Configuration of Agent
By clicking on configuration standard button of Android (different depending on the
device), 4 menus are available:
Configuration : Access to agent configuration
About : About OCS Inventory NG agent installed
Import configuration : Import a configuration file if present in directory ocs
Export configuration : Export the configuration to backup or using on others
devices
Options of android agent
General Configuration of agent
General configuration of android agent
TAG : Cathegory TAG in OCS
DEBUG : possible to generate a trace file in the ocslog.txt agent directory
AUTOMATIC : define if agent works as a service or a standalone application
DEPENDING ON NETWORK STATUS : Define using mobile internet connection or Wifi
INVENTORY FREQUENCY : define frequency between 2 inventories (in hours)
WAKE FREQUENCY : define time between 2 verifications of time since last inventory
CACHE : possible to recordd inventory cache on device
CACHE LIFETIME : define cache timelife (in minutes)
SYSTEM SOFTWARE : Exclude or include software like clock
USERAGENT COMPATIBILITY : Active this option for old OCS Inventory Server under 2.X
HIDE NOTIFICATION : Show off or on the notification from OCS android agent
Configuration concerning server
Server's configuration of android agent
SERVER URL : define URL address of OCS Inventory NG server(By default:
http://ocsinventory-ng/ocsinventory).
`Note: If your OCS Inventory NG server listens on an other port than classic port,
you have to define it in serveur URL. Example :
https://ocsinventory-ng:443/ocsinventory
SSL CONTROL : possible to active and desactive SSL control.
BASIC AUTHENTIFICATION : define if server needs authentification. If yes, you have
to define Login and Password.
HTTP PROXY : define if agent use a proxy. If yes, you have to define Address and
port of proxy server.
Warning: To work with SSL control, you have to import CA in Android. To do this,
use menu Localisation
and security/Import certificate from SDCARD. Certificates MUST BE in the root of
SDCARD. Extensions .crt and .cer are detected. Extension
.pem isn't always.
Feature of import/export configuration
This feature allows to export agent configuration when defined, to import in other
devices. org.ocsinventory.android.agent_preferences.xml file containing
configuration parameters to import/export is stored in directory "ocs".
Note: To import/export configuration, the device (phone/tablet) should not be
connected
via USB to a computer.
It's possible to edit the file manually as you want.
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
<boolean name="k_strictssl" value="false" />
<boolean name="k_debug" value="false" />
<string name="k_freqmaj">24</string>
<long name="k_lastupdt" value="1361266849907" />
<boolean name="k_automode" value="true" />
<boolean name="k_cache" value="true" />
<string name="k_devicetag">SONY ERICSSON</string>
<string name="k_cachelen">900000</string>
<string name="k_freqwake">30</string>
<string name="k_serverurl">https://ocsinventory-ng/ocsinventory</string>
</map>
OCS MacOSX agent 2.X documentation
Installing OCS MacOSX agent 2.X
Note: OCS MacOSX agent 2.3 and newer agent are fully compatible under MacOSX 10.11
El captain and more.
For older macos system you will have to user older versions of our agent. We don't
support Mac OS versions that are not maintained by Apple
Download OCS MacOSX agent from OCS Inventory NG website download page ( Download
page ), unzip the file and double click "Ocsinventory_Agent_MacOSX.pkg".
Mac OSX Icon
Click "Continue".
Ocs agent installation on Mac OSX
Validate license agreement by clicking "Continue" and "Agree".
Accept licence
If you already made an OCS MacOSX agent installation, you may be asked if you want
to launch OCS MacOSX configuration. Click on "Yes" to launch configuration panel or
"No" to skip this step.
Warning: message=If you click on "Yes", /etc/ocsinventory-agent/ocsinventory-
agent.cfg
file content will be erased !
Ocs agent already exist
Set your OCS MacOSX agent configuration by choosing several options: Http or https
for MacOSX agent communication to OCS server ("http" by default). OCS server server
name ("ocsinventory-ng" by default). MacOSX agent TAG value (optional). Log file
path for OCS MacOSX agent ("/var/log/ocsng.log" by default). Activate or Unactivate
OCS MacOSX agent debug mode for logs (activated by default). Activate or Unactivate
OCS MacOSX agent packages download feature (activated by default). Activate or
Unactivate OCS MacOSX agent SSL certificate feature (activated by default).
Certificate file path (mandatory if you activate OCS MacOSX agent packages download
feature). Certificate file must be named as "cacert.pem".
Click on "Continue" to validate configuration.
Ocs agent configuration
If you activate OCS MacOSX agent packages download feature and SSL feature without
specifying a certificate file path, you may have this warning.
Warning: message=If you activate OCS MacOSX agent packages download feature without
specifying a
certificate file path, OCS MacOSX agent packages download feature won't work !!!
No folder specify
Since version 2.10 of the MacOS agent, a new module has been added to the
installer, allowing you to specify authentication settings.
Fill in the Username, Password and Realm fields to use this feature, or leave them
blank if you do not wish to use authentication.
These fields will be written in the agent configuration file, username et password
being encoded using base64 encoding.
Hit "Continue" to validate authentication settings.
Ocs agent configuration
Set how OCS MacOSX agent will be launched by MacOSX Launchd daemon by choosing
several options: Periodicity for OCS MacOSX agent to be launched by Launchd daemon
(5 hours by default). Activate or Unactivate OCS MacOSX agent launch at Launchd
daemon start (activated by default). * Activate or Unactivate OCS MacOSX agent
launch, using Launchd daemon, after installation (inactivated by default)
Daemon Option
Select hard drive where you want to install OCS MacOSX agent and click "Continue".
Select Destination
Click "Install".
Installation Type
Click "Close" to end installation.
End of the installation
Launch MacOSX agent
To launch MacOSX agent, open a new Finder window, go to Applications and then
double click on OCSNG.app.
Agent OCS's icon
A new window appears and click Yes to launch agent or No to cancel.
Launch window
During agent launch you will see an icon in your Dock and this will disappear when
agent launch will be ended.
OCS Inventory NG Agent 2.x on Unix Operating Systems
OCS Inventory NG agent for Linux can only be set up locally. You cannot deploy the
agent through the network currently as this is possible for Windows agent. However,
you can choose during setup to activate auto-update of the agent if you’ve chosen
HTTP inventory method.
An automated deployment is now possible.
You can use the Packager for unix to create a standalone package
Automated deployment is possible using our ansible role
Warning: You must have root privileges to set Ocsinventory-agent up.
Requirements
Required modules and commands:
PERL 5.8 and higher
Perl module XML::Simple
Perl module Compress::Zlib
Perl module Net::IP
Perl module LWP::UserAgent
Perl module Digest::MD5
Perl module Net::SSLeay
Perl module Data::UUID
Perl Module Mac::SysProfile is needed on MacOSX
dmidecode
lspci on Linux and *BSD (pciutils package)
Make utility
C/C++ compiler like GNU GCC
Recommended modules:
Perl module IO::Socket::SSL
Perl module Crypt::SSLeay
Perl module LWP::Protocol::https
Perl module Proc::Daemon
Perl module Proc::PID::File if Proc::Daemon is installed
Perl module Net::SNMP
Perl module Net::Netmask
Perl module Nmap::Parser
Perl module Module::Install
Perl module Net::CUPS
Perl module Parse::EDID
Nmap (v3.90 or superior)
Note: it’s better for system integrity to use the precompiled packages for your
distribution
if they are available.
On Fedora/Redhat/Centos7 like Linux, you can use “yum” tool to set required modules
up like following:
$ sudo yum install perl-XML-Simple perl-devel perl-Compress-Zlib perl-Net-IP perl-
LWP perl-Digest-MD5 perl-Net-SSLeay perl-Data-UUID
Optional modules: these modules are available on EPEL repository. Don't forget to
add this repository to your system or download each package individually from the
repository
$ sudo yum install perl-Crypt-SSLeay perl-Net-SNMP perl-Proc-Daemon perl-Proc-PID-
File perl-Sys-Syslog pciutils smartmontools monitor-edid
On Debian Stretch like Linux, you can use “apt” tool to set required modules up:
$ sudo apt install libmodule-install-perl dmidecode libxml-simple-perl libcompress-
zlib-perl libnet-ip-perl libwww-perl libdigest-md5-perl libdata-uuid-perl
Optional modules: but highly recommended
$ sudo apt install libcrypt-ssleay-perl libnet-snmp-perl libproc-pid-file-perl
libproc-daemon-perl net-tools libsys-syslog-perl pciutils smartmontools read-edid
nmap libnet-netmask-perl
Unix agent 2.x is now installed without script “setup.sh”. During compilation,
information about configuration and dependencies are returned. However, it will
never upgrade an installed module. If one module has version lower than required
once, you must upgrade it yourself.
Warning: The installer does not install ancestor dependencies. For example,
Net::SSLeay requires
openssl to be installed. If not installed, setup of Net::SSLeay will fail and OCS
Inventory NG agent
setup will also fail.
Also, a log file is generated. If you encounter any error while installing OCS
Inventory NG agent, please refer to this file to have detailed error messages.
Installing the agent non-interactively
Download “Ocsinventory-Agent-2.x.y.tar.gz” from OCS Inventory Web Site.
Unpack it.
$ sudo tar –xvzf Ocsinventory-Agent-2.x.y.tar.gz
$ sudo cd Ocsinventory-Agent-2.x.y
Check perl configuration with the script Makefile.PL. Its looks at the
configuration of Perl, machine, libraries ... and it generates the Makefile. During
this step, a temporary environment variable is created to install agent non-
interactively.
$ sudo env PERL_AUTOINSTALL=1 perl Makefile.PL
Exemple:
Please install Crypt::SSLeay if you want to use SSL. Please install nmap or
ipdiscover if you want to use the network discover feature. Please install
Proc::Daemon and Proc::PID::File if you want to use the daemon mode.
Compilation
$ sudo make
$ sudo make install
Note: Installer writes a log file “ocs_agent_setup.log” in the same directory. If
you encounter any errors,
please refer to this log for the detailed error message.
A check for PERL interpreter binary, C/C++ compiler and make utility is made during
installation. If one of these components is not found, setup will stop.
Setup will check for:
dmidecode binary.
Compress::Zlib PERL module
XML::Simple PERL module
Net::IP PERL module
LWP::UserAgent PERL module
Digest::MD5 PERL module
Net::SSLeay PERL module
If not found, it will ask you if you wish to install it. Enter “y” or validate to
enable install of required component. You need to have access to Internet or local
repositories. If you enter “n”, setup will stop here.
Installing the agent interactively
Download “Ocsinventory-Unix-Agent-2.x.y.tar.gz” from OCS Inventory Download page.
Unpack it.
$ sudo tar –xvzf Ocsinventory-Unix-Agent-2.x.y.tar.gz
$ sudo cd Ocsinventory-Unix-Agent-2.x.y
Check perl configuration with the script Makefile.PL. Its looks at the
configuration of Perl, machine, libraries ... and it generates the Makefile.
$sudo perl Makefile.PL
Exemple:
Please install Crypt::SSLeay if you want to use SSL. Please install nmap or
ipdiscover if you want to use the network discover feature. Please install
Proc::Daemon and Proc::PID::File if you want to use the daemon monde.
Compilation
$ sudo make
$ sudo make install
Note: Installer writes a log file “ocs_agent_setup.log” in the same directory. If
you encounter any errors,
please refer to this log for the detailed error message.
A check for PERL interpreter binary, C/C++ compiler and make utility is made during
installation. If one of these components is not found, setup will stop.
Setup will check for:
dmidecode binary.
Compress::Zlib PERL module
XML::Simple PERL module
Net::IP PERL module
LWP::UserAgent PERL module
Digest::MD5 PERL module
Net::SSLeay PERL module
If not found, it will ask you if you wish to install it. Enter “y” or validate to
enable install of required component. You need to have access to Internet or local
repositories. If you enter “n”, setup will stop here.
Configuration begins. You answer with y for yes n for no or specify link or
location. Letter in brackets [] is chosen if you press enter.
Do you want to configure the agent
Please enter 'y' or 'n'?> [y] y
Where do you want to write the configuration file?
0 -> /etc/ocsinventory
1 -> /usr/local/etc/ocsinventory
2 -> /etc/ocsinventory-agent
?> 2
Do you want to create the directory /etc/ocsinventory-agent?
Please enter 'y' or 'n'?> [y] y
Should the old unix_agent settings be imported ?
Please enter 'y' or 'n'?> [y] y
[info] The config file will be written in /etc/ocsinventory-agent/ocsinventory-
agent.cfg,
What is the address of your ocs server?> https://ocs/ocsinventory
Do you need credential for the server? (You probably don't)
Please enter 'y' or 'n'?> [n]
Do you want to apply an administrative tag on this machine
Please enter 'y' or 'n'?> [y]
tag?> Server
Do yo want to install the cron task in /etc/cron.d
Please enter 'y' or 'n'?> [y]
Where do you want the agent to store its files? (You probably don't need to change
it)?> [/var/lib/ocsinventory-agent]
Should I remove the old unix_agent
Please enter 'y' or 'n'?> [n]
Do you want to activate debug configuration option ?
Please enter 'y' or 'n'?> [y] n
Do you want to use OCS Inventory NG UNix Unified agent log file ?
Please enter 'y' or 'n'?> [y]
Specify log file path you want to use?> /var/log/ocs_agent.log
Do you want disable SSL CA verification configuration option (not recommended) ?
Please enter 'y' or 'n'?> [n]
Do you want to set CA certificate chain file path ?
Please enter 'y' or 'n'?> [y] y
Specify CA certificate chain file path?> /etc/ocsinventory-agent/cacert.pem
Do you want to use OCS-Inventory software deployment feature?
Please enter 'y' or 'n'?> [y]
Do you want to use OCS-Inventory SNMP scans feature?
Please enter 'y' or 'n'?> [y]
Do you want to send an inventory of this machine?
Please enter 'y' or 'n'?> [y]
Here is a sample configuration file for OCS Inventory NG Linux agent.
<CONF>
<DEVICEID>computer.domain.tld-2006-02-27-13-59-47</DEVICEID>
<DMIVERSION>2.2</DMIVERSION>
<IPDISCOVER_VERSION>3</IPDISCOVER_VERSION>
<OCSFSERVER>my_ocs_com_server.domain.tld:80</OCSFSERVER>
</CONF>
You can choose between 3 methods for sending inventory:
http: computer is connected to the network and is able to reach the Communication
server with HTTP protocol USED BY DEFAULT.
https: computer is connected to the network and is able to reach the Communication
server with HTTPS protocol. You have to configure SSL on your OCS Server and copy
the SSL certificate on the agent directory to use this method.
local: computer is not connected to the network and inventory will be generated in
a file manually sent to OCS Inventory NG by the operator. This option must be set
manually in ocsinventory-agent.conf like this:
local=/tmp
For two others methods:
Syntax : http[s]://ocsinventory-ng-server[:port]/ocsinventory
Examples:
ocsserver.domains.local
https://w.x.y.z
ocsserver.domains.local:1234
https://ocsserver.domains.local
Figure 5 : Sample agent’s configuration file ocsinv.conf for a network connected
computer.
Deploying agent through scripted installation without user interaction
Actually not possible in version 2.0. This feature will be integrated in 2.1.
Warning: This feature will be only available in OCS 2.1. Don't try this options
using OCS 2.0
Unix agent...it won't work !!
Since OCS Unix Unified agent 2.1, you are able to launch postinst.pl script in non-
interactive mode. A set of launch arguments has been added to this script to allow
to set all configuration options as you can do in interactive mode. This is a list
of all available postinst.pl script arguments:
--nowizard : launch this script without interaction
--server : set OCS Inventory NG server address (e.g:
http://ocsinventory-ng/ocsinventory)
--basevardir : set OCS Inventory NG Unix Unified agent variables directory (e.g:
/var/lib/ocsinventory-agent)
--configdir : set OCS Inventory NG Unix Unified configuration directory (e.g:
/etc/ocsinventory-agent)
--user : set username for OCS Inventory server Apache authentication (if needed).
User must be encoded base64.
--password : set password for OCS Inventory NG server Apache authentication (if
needed). Password must be encoded base64;
--realm: set realm name for OCS Inventory NG server Apache authentication (if
needed)
--crontab : set a crontab while installing OCS Inventory NG Unix Unified agent
--get-old-linux-agent-config : retrieve old OCS Inventory NG Linux agent
configuration (if needed)
--remove-old-linux-agent : remove old OCS Inventory NG Linux agent from system (if
needed)
--debug : activate debug mode configuration option while installing OCS Inventory
NG Unix Unified agent
--logfile : set OCS Inventory NG Unix Unified agent log file path (if needed)
--nossl : disable SSL CA verification configuration option while installing OCS
Inventory NG Unix Unified agent (not recommended)
--ca : set OCS Inventory NG Unix Unified agent CA certificate chain file path
--download : activate package deployment feature while installing OCS Inventory NG
Unix Unified agent
--snmp : activate SNMP scans feature while installing OCS Inventory NG Unix Unified
agent
--now : launch OCS Inventory NG Unix Unified agent after installation
-h or --help : display help menu
For example, if you want to install OCS Unix Unified agent in non-interactive mode
and set server address, create a crontab, set a custom tag, enable debug mode, set
a log file path and activate download feature, you have to run this command:
$ sudo env PERL_AUTOINSTALL=1 perl Makefile.PL && make && make install && perl
postinstl.pl --nowizard --server=http://yourserver/ocsinventory --crontab
Agent’s command line switches
If you encounter errors, agent's produce a log file in directory
“/var/log/ocsinventory-agent”.
However, agent also supports some command line switches. You can use them while
launching the agent manually using “ocsinventory-agent” command:
Agent’s command line switch Meaning
--local Runs the agent in local mode, without any connection to communication
server. You will be prompted for a target directory where agent will put inventory
results in XML compressed file with “.ocs” extension.
--xml Agent will create a non-compressed XML file with “.ocs” extension, containing
inventory results. You will be prompted for a target directory where agent will put
the file. If not used in conjunction with -local, agent tries to connect to
communication server.
--tag=”my tag value” Set agent setting TAG value to “my TAG value”.
--force Force agent to always send inventory results, independently of the
FREQUENCY parameter.
--debug Force agent to produce a more detailed log file, showing XML exchange
with communication server.
--nosoftware Do not search for installed software.
--info Show a detailed output of agent runs.
--proxy=”url_proxy:[port]” Specify the url of a proxy.
--lazy Do not contact the server more than one time during the PROLOG_FREQ and
do an exit if there is nothing to do.
--daemon Launch ocsinventory-agent in background. Proc::Daemon is needed.
--basevardir=”PATH” Used to specify the place where the agent should store its
files.
--logfile=”PATH” Used to record log message in FILE and turn off STDERR.
--user=”USER” Used to specify a user for server authentification. USER stored
in base64 format
--password=”PASSWORD” Used to specify a password for server authentification.
PASSWORD stored in base64 format.
For more informations, use
$ man ocsinventory-agent
Compatibility
FreeBSD
OS Version Compatibility Works with agent Comments
5.x YES Unix Unified Agent 1.01 32 & 64 bits
6.x YES Unix Unified Agent 1.01 32 & 64 bits
7.x YES Unix Unified Agent 1.01 32 & 64 bits
8.x to be tested
9.x to be tested
10.x to be tested
11.x YES Unix Unified Agent 2.4 32 & 64 bits
OpenBSD
OS Version Compatibility Works with agent Comments
4.5 YES Unix Unified Agent 1.01 32 & 64 bits
4.6 YES Unix Unified Agent 1.01 32 & 64 bits
5.1 YES Unix Unified Agent 2.4 32 & 64 bits
6.3 YES Unix Unified Agent 2.4 32 & 64 bits
Installation Procedure
export PKG_PATH="http://ftp.arcane-networks.com/pub/OpenBSD/4.5/packages/i386/"
export OCS_VERSION="1.1.2"
mkdir /var/lib
pkg_add nmap
pkg_add dmidecode
pkg_add pciutils
pkg_add p5-libwww
pkg_add p5-XML-Simple
pkg_add p5-Net-IP
pkg_add p5-Proc-Daemon
cd
mkdir ocs
wget http://launchpad.net/ocsinventory-unix-agent/1.1.x/ocsinventory-unix-agent-
$OCS_VERSION/+download/Ocsinventory-Agent-$OCS_VERSION.tar.gz
tar xvzf Ocsinventory-Agent-$OCS_VERSION.tar.gz
cd Ocsinventory-Agent-$OCS_VERSION
perl Makefile.PL
make
make install
AIX
OS Version Compatibility Works with agent Comments
4.x seems to work Unix Unified Agent 1.1.2
5.x YES Unix Unified Agent 2.4
6 YES Unix Unified Agent 2.4
7 YES Unix Unified Agent 2.4
Solaris
OS Version Compatibility Works with agent Comments
>9 YES Unix Unified Agent 2.4
03.Basic documentation » Setting up the UNIX agent using repository on client
computers
Introduction
OCS Inventory has now his own repository for Debian based and Redhat based
distributions. You will find below how to install OCS Inventory agent unix using
our repository
Installing UNIX Agent with APT
On Debian-based distributions you can install the agent with APT
You need to add our repository using the following command
$ curl -sS https://deb.ocsinventory-ng.org/pubkey.gpg | sudo apt-key add -
$ echo "deb http://deb.ocsinventory-ng.org/debian/ <distribution_codename> main" |
sudo tee /etc/apt/sources.list.d/ocsinventory.list
$ sudo apt update
You will have to replace by one of the following term depending on the installation
context :
bullseye | stable
buster | oldstable
stretch | oldoldstable
sid | unstable
Then install the agent using :
$ sudo apt install ocsinventory-agent
On Ubuntu-based distributions you can install the agent with APT
You need to add our repository using the following commands :
$ curl -sS https://deb.ocsinventory-ng.org/pubkey.gpg | sudo apt-key add -
Note : apt-key is now deprecated as of Ubuntu 22.04, and will issue a warning. We
recommend using the below gpg alternative :
$ curl -fsSL https://deb.ocsinventory-ng.org/pubkey.gpg | sudo gpg --dearmor -o
/etc/apt/trusted.gpg.d/ocs-archive-keyring.gpg
Then :
$ echo "deb http://deb.ocsinventory-ng.org/ubuntu/ <distribution_codename> main" |
sudo tee /etc/apt/sources.list.d/ocsinventory.list
$ sudo apt update
You will have to replace by one of the following term depending on the installation
context :
noble | stable
jammy | oldstable
focal | backport
Then install the agent using :
$ sudo apt install ocsinventory-agent
Installing UNIX Agent with RPM
On Redhat/Centos 7 you can install the unix agent with RPM
You need to have "wget" to download the repo of EPEL and OCS
$ sudo wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ sudo wget https://rpm.ocsinventory-ng.org/ocsinventory-release-
latest.el7.ocs.noarch.rpm
You can install the repo with "yum"
$ sudo yum install ocsinventory-release-latest.el7.ocs.noarch.rpm epel-release-
latest-7.noarch.rpm
To install the unix agent and requirement use this command:
$ sudo yum install ocsinventory-agent
On Redhat/Centos 8 you can install the unix agent with RPM
You need to have "wget" to download the repo of EPEL and OCS
$ sudo wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
$ sudo wget https://rpm.ocsinventory-ng.org/ocsinventory-release-
latest.el8.ocs.noarch.rpm
You can install the repo with "dnf"
$ sudo dnf install ocsinventory-release-latest.el8.ocs.noarch.rpm epel-release-
latest-8.noarch.rpm
To install the unix agent and requirement use this command:
$ sudo dnf --enablerepo=PowerTools --enablerepo=epel-playground install
ocsinventory-agent
On Oracle Linux 8 and superior, you'll have to enable the CodeReady Builder
repository instead of Powertools to install the agent, e.g. for Oracle Linux 8 :
$ sudo dnf --enablerepo=ol8_codeready_builder install ocsinventory-agent
On Rocky/Alma and RHEL 9 you can install the unix agent with RPM
You need to have "wget" to download the repo of EPEL and OCS
$ sudo wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
$ sudo wget https://rpm.ocsinventory-ng.org/ocsinventory-release-
latest.el9.ocs.noarch.rpm
You can install the repo with "dnf"
$ sudo dnf install ocsinventory-release-latest.el9.ocs.noarch.rpm epel-release-
latest-9.noarch.rpm
To install the unix agent and requirement use this command:
$ sudo dnf install yum-utils
$ sudo yum-config-manager --enable crb
$ sudo dnf install ocsinventory-agent
On Fedora you can install the unix agent with RPM
You need to have "wget" to download the OCS's repo
$ export FEDORA_VERSION=$(awk '{print $3}' /etc/fedora-release)
$ sudo wget https://rpm.ocsinventory-ng.org/ocsinventory-release-
latest.fc$FEDORA_VERSION.ocs.noarch.rpm
You can install the repo with "dnf"
$ sudo dnf install ocsinventory-release-latest.fc$FEDORA_VERSION.ocs.noarch.rpm
To install the unix agent and requirement use this command:
$ sudo dnf install ocsinventory-agent
Note : The unix agent gonna be installed with default settings.
Docs » 03.Basic documentation » OCS Inventory NG Agent 2.X on Windows Operating
Systems
OCS Inventory NG Agent 2.X on Windows Operating Systems
Agent Version Compatibility Note
2 . X Does not work on Windows 9X, Windows Millennium Edition or Windows NT4. You
need to use old 1.X agent 4061-1.
2 . 1 . 1 . 1 On Windows XP and 2003R2 you can only use this Windows agent
version.
2 . 6 Agent is only installable on 64-bit machines.
2.6.0.1 Agent is only installable on 64-bit machines.
2.7.X.X and newer Agent is installable on 64-bit and 32-bit machines.
OCS Inventory NG Agent for Windows can run as a Windows service automatically at
computer startup.
It can also work as a stand alone application which can be launched through a login
script, an Active Directory GPO, a scheduled task or a shortcut in the Start menu.
Note: We recommend using the service version of the Agent, especially if you plan
to use the package
deployment feature.
Download and unzip the latest Windows agent from the Downloads section. This
package contains 1 file:
OCS-NG-Windows-Agent-Setup.exe: installs the Windows Agent, either as a Windows
Service or as a Standalone tool.
Which version: Service or Standalone ?
The Windows service version will automatically communicate with the OCS-NG system
and perform inventories and package deployment based on parameters set on the
server. The standalone client is used for computers that cannot communicate with
the server, or where the service version is not wanted or allowed.
How does Windows Agent work ?
When the OCS Inventory NG Agent is launched, it queries the Communication server
using the HTTP or HTTPS protocol. The server can answer “nothing” (not time for an
inventory and no package to deploy), and the agent stops. Otherwise, the server may
answer that Agent has to:
Send an inventory: the agent retrieves all computer properties and sends them using
HTTP or HTTPS protocol to the server. The server ask this only if the last
inventory date in the database is older than the general option “FREQUENCY”,
specified in days (see Managing OCS Inventory NG general options.)
Discover the network: Agent scans his IP subnet for active devices listening on the
network, then sends these data using HTTP or HTTPS protocol to the server. The
server ask this only if the computer is elected to run IPDISCOVERY (see Using IP
discovery feature.)
Deploy a package: Agent contacts the deployment server using the HTTPS protocol to
get the information file (file INFO which describes the package), downloads package
fragments from the deployment server, rebuilds the package and launches it.
Since OCS Inventory Agent 2.6, it's possible to deploy package greater than 4GB
(only on 64-bit versions). However, the deployment of such package may cause
latency in machines on which it's deployed.
Note: The OCS Inventory NG Agent does not listen on the network. It only initiates
communications to the server, so you do not have to open inbound port on a personal
firewall. However, you must allow outbound connections from OCS Inventory NG agent
files "OCSInventory.exe" and "Download.exe" to the Communication Server or
Deployment Server using either HTTP or HTTPS.
Each time an inventory is done, the Agent uses and writes configuration files
stored into folder “%ProgramData%\OCS Inventory NG\Agent”. This directory is
usually
C:\Documents and Settings\All Users\Application Data\OCS Inventory NG\Agent under
Windows 2000, XP and 2003.
C:\ProgramData\OCS Inventory NG\Agent under Windows Vista, 2008, Seven and 2008 R2.
It uses at least the following files:
ocsinventory.ini: all configuration parameters for the agent (server address and
credentials, proxy address and credentials, service properties...),
ocsinventory.dat: computer unique identity file, based on MAC address and hostname,
last_state: last inventory state, to detect changes between 2 inventory,
history: package deployment history,
All log files created by OCS Inventory NG Agent.
Note: YOU MUST STOP "OCS Inventory Service" to make changes on these files, because
they are write protected while service is running. As is, only user having
Administrator privileges can modify these files.
When launched for the first time, OCS Inventory NG agent will prompt user for the
TAG value (if this feature is enabled). Help text displayed in the dialog-box is
the one you have entered in Configuring management server. User may enter this
value, or leave it blank (you will be able to update this value through the
Administration server).
Then (or otherwise if TAG feature is not enabled), it will do the inventory and
send inventory results to Communication server using HTTP or HTTPS.
Note: When the agent is first launched, it will only generate and send an
inventory.
How does Windows service work?
Note: You must have Administrator privileges to set up OCS Inventory NG Agent as a
service, or you may use OCS Inventory NG Packager to create an installer able to
run even if user do not
have Administrator privileges. Refer to Uploading Agent for deployment through
launcher “OcsLogon.exe” or OCS Inventory NG Packager documentation.
OCS Inventory NG Agent “OCSInventory.exe” is launched by service “OcsService.exe”
every PROLOG_FREQ hours. It keeps trace of the countdown in seconds in file
“ocsinventory.ini” (value TTO_WAIT), so it is the time of EFFECTIVE run.
The number of hours to wait is randomized at install time and each time PROLOG_FREQ
is changed in Administration Console.
It allows not having all agents contacting Communication Server at the same time.
The randomization is between 0 and PROLOG_FREQ (10 hours by default). You can
adjust these parameters considering your server load using Administration Console.
When service launch agent, it call without parameter, so agent uses parameters
specified in file “ocsinventory.ini”.
As you can see, Service is only a launcher which will run Agent regularly, even if
nobody logs in the computer.
Do I have to use service or standalone agent ?
You want to have computers inventoried, even if nobody log in ? Use Service
version.
You want to use package deployment feature ? Use service version. As is, package
will be downloaded in background, and logged in user can continue to work.
You do not want to set service up or have anything appears in the registry ? Use
standalone version. However, deployment of package may take a long time when users
log in.
In other words, we recommend using service version.
Manually installing OCS Inventory NG Agent for Windows.
Run “OCS-NG-Windows-Agent-Setup.exe” on client computer..
Icone installer Windows Agent
..and click “Next” button
Start Installation
Validate license agreement by clicking “I agree” button.
Accept Licence
Select the installation type you want:
Network inventory: Computer can reach OCS Inventory NG Server through the network,
and so, Agent will be launched using either a Windows Service, or a Logon/GPO
script.
Local inventory: Computer is not connected to a network, or will never be able to
reach OCS Inventory NG Server. You can generate an inventory of this computer and
save to file to be imported later on server (see chapter Generating inventory of a
non network connected Windows computer below).
Choose components
Fill in OCS Inventory NG Communication server URL, like
http://your_ocs_server_address:your_server_port/ocsinventory . You can also specify
https if your server is SSL enabled to secure communication. If you've protected
your Communication Server access with credentials, you must specify credentials
agent will use to authenticate (these credentials will be encrypted to be stored
into configuration file). If you're aware of server certificate validation when
using HTTPS protocol, either for sending inventory or deploying package, you can
disable it. However, this is a security flaw! We do not recommend disabling
certificate validation because Agent does not authenticate server. With certificate
validation enabled, you must specify path to Certificate Authority root certificate
(default uses "%ProgramData%\OCS Inventory NG\Agent\cacert.pem"). Then click “Next”
button.
Note: You can use self-signed certificate, but certificate CN must equal to server
address used by agents
for communications. Also, if full path to certificate is not provided, agent will
try to load the specified
file from its data folder "%ProgramData%\OCS Inventory NG\Agent".
Change properties
If needed, select proxy type to use to connect to Communication Server, proxy
address and port, and proxy credentials if required (these credentials will be
encrypted to be stored into configuration file). Agent support HTTP, SOCKS 4 and
SOCKS 5 proxies.
Proxy Properties
By default, OCS Inventory Agent write only few information in log files. You may
increase this enabling “Verbose log”. You may also disable TAG question, or specify
the TAG value. Last, indicate which level of system integration you need:
Do not register service using LocalSystem account (i.e, use standalone agent, which
must be launched manually or using login script).
Do not configure OCS Inventory NG Systray Applet to start automatically when user
log in. This applet allows user to manually run agent, or to display inventory
information. Disabling this option does not create shortcut link in "All users"
startup menu.
Launch inventory just at the end of setup.
Windows Properties
By default, OCS Inventory agent use the WBEM_FLAG_RETURN_WBEM_COMPLETE flag WMI to
retrieve its data. However in some cases, this can trigger additional queries to
the domain controller.
With the 2.9.1.0 agent, there is the possibility to set the flag to two different
mode :
WBEM_FLAG_RETURN_WBEM_COMPLETE
WBEM_FLAG_DIRECT_READ
The WBEM_FLAG_DIRECT_READ flag will only read WMI information present directly on
the system and won't trigger any query to the domain controller.
Please note the use of this flag will most likely result in information loss.
Possible agent configuration :
COMPLETE (default) : Allow full WMI query
READ : Read only WMI queries (might lead to inventory data loss)
The READ mode of the agent also comes with a DEFAULT_USER_DOMAIN configuration.
Using the read flag will in most of the case make the agent unable to retrieve the
current active directory domain user.
Setting DEFAULT_USER_DOMAIN will allow to set a default connected user.
Windows Properties
Choose destination folder, “C:\Program Files\OCS Inventory Agent” by default (“C:\
Program Files (x86)\OCS Inventory Agent” under Windows 64 bits), and click
“Install” button.
Install Location
Click “Finish” button to close OCS inventory NG Agent Setup.
End of the installation
This is the interactive installation setup. However, this process requires that you
launch it under all your computers. Hopefully, this installation can be scripted.
OCS Inventory NG Agent for Windows Setup command line options
Service Agent setup "OCS-NG-Windows-Agent-Setup.exe" may be called with some
command line parameters:
/S to run the installer in silent mode, no interaction with user
/NOSPLASH disable splash screen when installer starts
/NO_SERVICE to not register OCS Inventory NG Agent into Windows Service Manager.
Agent can only be launched manually or through a script/GPO.
/NO_SYSTRAY to not create a shortcut into "All Users" startup folder to start
systray applet when user log in.
/NOW to launch inventory just after setup
/NOSOFTWARE to ignore software installed
/D to install ocsinventory agent in an another directory (default %PROGRAMFILES%\
ocs inventory agent)
Note: Please, don't use OCSPackager to upgrade OCS Inventory Windows Agent. Create
deployement package with "OCS-NG-Windows-Agent-Setup.exe" on zip file and launch
with command example : OCS-NG-Windows-Agent-Setup.exe /S /SERVER=ocs_server_address
Also, you can pass to the installer the following agent's command line parameters
(see agent's options below for more detail):
/SERVER=
/USER=
/PWD=
/SSL=
/CA=
/PROXY_TYPE=
/PROXY=
/PROXY_PORT=
/PROXY_USER=
/PROXY_PWD=
/DEBUG=
/NOTAG
/TAG=
/D=
/WMI_FLAG_MODE=
/DEFAULT_USER_DOMAIN=
Deploying or running Agent through Active Directory GPO
Note: We recommend using service version of Agent if you plan to use package
deployment feature.
To deploy the agent using GPO we recommand you to create a standalone packager with
all your configuration already provisionned. See using OCS Packager to create an
all-in-one installer to setup agent and server certificate
After creating a packager, you will need to store it at a place where all your
users have access to.
Then create a GPO that trigger on user login. You will have a create a script that
call the packager executable and trigger the installation on the computer.
Here is a sample script:
@echo off
rem Script that call the packager executable on shared file system
rem Installing our packager
"myfileserver/my/path/packager.exe"
Using PSEXEC or "OCS Inventory NG Agent Deployment Tool" to push OCS Inventory NG
Agent
PSEXEC from Microsoft ( https://technet.microsoft.com/fr-fr/sysinternals/psexec )
is a great and fast way to install the OCS agents on all Windows computers, you can
literally setup most of your computers in a few hours (assuming they are all
connected to the network, that is).
Note: We've created a graphical tool for Windows, OCS Inventory NG Agent Deployment
Tool, which allows
you to use PSEXEC more easily. It is able to push agent's installation on up to 10
computers simultaneously,
and also to copy the certificate used to authenticate deployment server in OCS
Inventory NG data folder.
Some tips:
PSEXEC is best used together with Domain Logon scripts or Active Directory GPO:
Use the PSEXEC to install on all computers that are currently connected to the
network (best used during business hours).
Then add a logon script/GPO as described above to install on computers that were
offline the next time they connect to the network.
If you really don't want to use logon script/GPO, you can create and monitor a
response file to get a list of computers that were not deployed for any reason, and
then rerun PSEXEC just for these computers.
PSEXEC Usage examples:
We assume that the agent setup file is called agentsetup.exe and it was placed on a
shared folder accessible to all users.
Install silently on all computers currently logged in your domain:
psexec \\* -s \\Server\NetLogon\OCS-NG-Windows-Agent-Setup.exe /S /NOSPLASH
/SERVER=http://my_ocs_server/ocsinventory
Install silently on a single computer:
psexec \\COMPUTER_NAME -s \\Server\NetLogon\OCS-NG-Windows-Agent-Setup.exe /S
/NOSPLASH /SERVER=http://my_ocs_server/ocsinventory
Install silently on all computers using the domain administrator credentials:
psexec \\* -s -u Domain\Administrator -p Password \\Server\NetLogon\OCS-NG-Windows-
Agent-Setup.exe /S /NOSPLASH /SERVER=http://my_ocs_server/ocsinventory
Install silently on specific computers (ALL.TXT is a text file that lists target
computer names, one per line), using domain administrator credentials:
psexec @ALL.TXT -s -u Domain\Administrator -p Password \\Server\NetLogon\OCS-NG-
Windows-Agent-Setup.exe /S /NOSPLASH /SERVER=http://my_ocs_server/ocsinventory
Generating inventory of a non network connected Windows computer
Run “OCS-NG-Windows-Agent-Setup.exe” on client computer, from an USB stick for
example...
Icone installer Windows Agent
..and click “Next” button.
Start Installation
Validate license agreement by clicking “I agree” button.
Accept Licence
Select Local inventory installation type.
Choose components
By default, OCS Inventory Agent writes only few lines in the log files. You may
increase this enabling “Verbose log”. You may also specify the TAG value. Last,
indicate the folder where you want to store generated inventory file, your usb
stick for example:
Choose folder
In local inventory mode, Agent will be installed into a temporary folder (we
recommend not changing this folder, it will be automatically deleted at the end of
process), Click “Install” button to start process. Agent is installed into
temporary folder, launched to generate a ".ocs" inventory file stored in the folder
you've specified, and then removed from computer.
Install location
Click “Finish” button to close OCS inventory NG Agent Setup.
End of the installation
This is the interactive process, but it can be scripted using
/LOCAL=path_to_folder_where_to_store_ocs_file command line switch.
For example, you can use OCS-NG-Windows-Agent-Setup.exe /S /LOCAL=C:\ to silently
generate ".ocs" inventory file into folder c:.
Once you've transfered generated inventory file, you will be able to import it into
the inventory database of OCS Inventory NG Server, through the Administration
Console.
OCS Inventory NG Agent for Windows command line options
OCS Inventory NG Agent version 2.0 or higher includes some command line switches to
allow detecting errors.
Once agent is installed, you can run it manually to diagnose problems. Use “C:\
Program Files\OCS Inventory Agent\OCSInventory.exe [options]” command line where
[options] may be in the following command line switches.
Command Line Options Meaning
/work_dir="path to directory" Agent must use "path to directory" as working dir
(this directory may included configuration file). Default is "%ALLUSERSPROFILE%\
Application Data\OCS Inventory NG\Agent" or "%PROGRAMDATA%\OCS Inventory NG\Agent"
/local[="path to folder"] Agent do not contact communication server, and store
inventory in xml compressed .ocs file into folder "path to folder". If no "path to
folder" provided, agent assume folder as data folder
/debug[=level] Generate a very verbose log file "ocsinventory.log" into agent's
install folder.
0 => disable verbose logs (default)
1 => enable default verbose logs (default when no level provided provided)
2 => enable debuging logs
/notag Agent must NOT prompt user for TAG in any case
/tag="my value" Agent must set "my value" as TAG value
/xml=["path to folder"] Agent must store inventory in uncompressed xml format into
folder "path to folder". If no "path to folder" provided, agent assume folder as
data folder
/force Always send inventory, even if server do not ask for it (use only for
debugging purpose !)
/ipdisc="network number" Agent must launch IP discovery on network "network
number" (use only for debugging purpose !)
/ipdisc_lat="number of milliseconds" Set latency between 2 IP Discover
requests to "number of milliseconds"
/fastip Never wait for latency between 2 IP Discover requests (use only for
debugging purpose !)
/hkcu Search also for software under HKEY_CURRENT_USER registry hive (do not work
with service as LocalSystem !)
/uid Agent must generate a new unique device ID
/server=http[s]://server.domain.tld[:port]/ocsinventory Agent try to connect to
Communication Server address and port Listening on
http[s]://server.domain.tld[:port]/ocsinventory
/ssl=0/1 When usng SSL connections:
0 => SSL without certificate validation
1 => SSL with server certificate validation required (needs CA certificate)
/ca="path_to_cabundle.pem" Path to CA certificate chain file in PEM format, for
server certificate validation
/user=username /pwd=password Communication Server authentication credentials
/proxy_type=0/1/2/3 Agent proxy
use 0 => no
1 => HTTP proxy
2 => Socks 4 proxy
3 => Socks 5 proxy
/proxy=proxy_address Proxy server address (without protocol !)
/proxy_port=port Proxy server port
/proxy_user=username Proxy authentication credentials
/proxy_pwd=password Proxy authentication credentials
/D=/ specify the directory where your want to install ocsinventory agent (default
%PROGRAMFILES%\ocs inventory agent)
/wmi_flag_mode=[COMPLETE/READ] WMI flag mode used by the agent
/default_user_domain=default.user Read only WMI queries (might lead to inventory
data loss)
Sample configuration file "ocsinventory.ini"
[OCS Inventory Agent]
; OCS Inventory NG Agent features
; Enable debugging mode (0 => disabled, 1 => enabled, 2=> trace all)
Debug=1
; Enable local inventory mode (path to folder to store .ocs file => enabled,
; empty => disabled)
Local=
; Enable agent scanning HKEY_CURRENT_USER hive for printers and sofware
; (0 => disabled, 1 => enabled)
HKCU=0
; Disable prompting user for TAG value (0 => prompt allowed, 1 => disabled)
NoTAG=0
; Force agent launching IpDiscover on specified network (network address =>
enabled,
; empty disabled)
IpDisc=
; Which communication provider to use
; Name of communication DLL and configuration section to use
; DLL must be in "com" sub directory
ComProvider=ComHTTP.dll
; Behavior of WMI calls
; COMPLETE => Allow WMI full WMI queries
; READ => Not allow
WMI_FLAG_MODE=COMPLETE
; Read only WMI queries (might lead to inventory data loss)
DEFAULT_USER_DOMAIN=
[HTTP]
; OCS Inventory NG Communication Server address and port
; Listening on http[s]://server[:port]/ocsinventory
Server=http://localhost/ocsinventory
; Using SSL connections (0 => SSL without certificate validation,
; 1 => SSL with server certificate validation required)
SSL=0
; Path to CA certificate chain file in PEM format, for server certificate
; validation
CaBundle=D:\Developp\OCS Inventory NG\cacert.pem
; Using authentication on Communication Server (0 => no, 1 => yes)
AuthRequired=0
; Communication Server authentication credentials (encrypted)
User=
Pwd=
; Using proxy (0 => no, 1 => HTTP proxy, 2 => Socks 4 proxy, 3 => Socks 5 proxy)
ProxyType=0
; Proxy address and port
Proxy=
ProxyPort=
; Using proxy authentication (0 => no, 1 => yes)
ProxyAuthRequired=
; Proxy authentication credentials (encrypted)
ProxyUser=
ProxyPwd=
[OCS Inventory Service]
; Time to wait in minutes before next agent start
TTO_WAIT=1020
; Number of hour between 2 agent runs
PROLOG_FREQ=5
; Old value of PROLOG_FREQ
OLD_PROLOG_FREQ=10
Uninstalling the agent
Starting the 2.10.0.0, the Windows agent add some housecleaning option on the
uninstaller.
Note : The uninstaller is present in the installation directory of the agent
(uninst.exe)
If you uninstall the agent manually, you'll see a new window ask you if you desire
to clean remaining agent files : End of the installation
The agent provide three differents options in order to clean the configuration
files and data files present on the %ProgramData% directory : NONE (Doesn't remove
anything) ONLY CONFIGURATION (Remove the ocsinventory.ini and the Download folder)
* ALL FILES (Completely remove the OCS Inventory NG folder in %ProgramData%)
Note : If you choose the last option and reinstall the agent later, it'll most
likely lead to a duplicate in the webconsole since the agent will have to
regenerate a deviceid (ocsinventory.dat)
You can also run the uninstaller programmatically with the /CLEAN option. It can be
useful if you plan a mass uninstallation of the agent.
By default, if you run .\uninst.exe /S it won't clean the files in the %ProgramData
% directory.
In order to only clean the files (ONLY CONFIGURATION), you can use : .\
uninst.exe /S /CLEAN=FILES
To clean everything in the %ProgramData% directory (ALL FILES) : .\uninst.exe /S
/CLEAN=ALL
Using the portable agent
The portable agent can be used if you are looking for a way to run the agent as a
one time thing, without any installation.
The "RunPortableAgent.bat" script needs to be modified : edit OCS_SERVER_URL and
OCS_CLIENT_TAG if needed.
Execute this same script to launch an inventory. Once this is done, run the
"CleanPortableAgent.bat" script to clear the system from any agent related files.
Command line options for the Windows agent are also available for the portable
agent.
When using them, you won't have to modify the script mentionned above, just
navigate to the directory, edit the "ocsinventory.ini" file to configure the agent
and launch "OCSInventory.exe" with any useful options.
Alternatively, you can provide configuration through the command line as well, and
leave the .ini file as is.
Docs » 03.Basic documentation » Understanding OCS Crontab
Understanding OCS Crontab
You can find a list of available crontab on OCS Inventory and their explainations
below :
cron_all_software.php : populate and update All software page.
cron_cve.php : clean and populate CVE reporting according to OCS Inventory
softwares. See the CVE Reporting documentation for more informations.
cron_ipdiscover.php : purge IpDiscover data. See Using Ip Discovery feature
documentation for more informations.
cron_wol.php : execute scheduled Wake On Lan. See Using Wake on Lan feature
documentation for more informations.
cron_mailer.php : send reporting mail from OCS Inventory. See Mail notifications
documentation for more informations.
Docs » 03.Basic documentation » Update an existing OCS Server installation
Update an existing OCS Server installation
The process is mainly backup your configuration download the new version of OCS-
Server use the setup.sh and restore the backed up configuration.
Note : Since 2.9.2 version, some LDAP configuration fields has been changed.
Please, read the documentation Manage authentification with LDAP
Delete existing plugins
If you have plugins installed delete this plugins prior the update otherwise you
might have problems with or after re-install them.
Go to the plugin manager and delete them you may also need delete the configuration
in :
/etc/ocsinventory-server/plugins
Backup existing configuration
Before you start it´s better to stop the web server that nobody could do changes
after you backed up the files.
service apache2 stop
You need to backup the following configuration files:
Apache files:
~/apache2/conf-available/z-ocsinventory-server.conf
~/apache2/conf-available/zz-ocsinventory-restapi.conf
~/apache2/conf-available/ocsinventory-reports.conf
OCS configuration:
/usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php
It´s recommended to create a folder where you store all backed up files :
mkdir /home/backup_ocs
Then copy the files to the backup folder :
cp /etc/apache2/conf-available/z-ocsinventory-server.conf
/etc/apache2/conf-available/zz-ocsinventory-restapi.conf /etc/apache2/conf-
available/ocsinventory-reports.conf /home/backup_ocs/ && cp
/usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php /home/backup_ocs/
If your scared about losing data then better backup your database, but theoretical
this is not necessary.
mysqldump -u ocs -p --all-databases > /home/backup_ocs/ocsdbbackup.sql
Take note of the AUTH_TYPE value in the
/usr/share/ocsinventory-reports/ocsreports/var.php file. If different from 'LOCAL',
you will have to edit the file after the update to restore the value.
Update the existing installation
Download the last release of OCS from the Website or here from github.
Unpack it :
tar –xvzf OCSNG_UNIX_SERVER-2.x.x.tar.gz
cd OCSNG_UNIX_SERVER-2.x.x
Run “setup.sh” installer. During the installer, default choice is presented between
[]. For example, [y]/n means that “y” (yes) is the default choice, and “n” (no) is
the other choice.
sh setup.sh
Note: Installer writes a log file “ocs_server_setup.log” in the same directory. If
you encounter any error, please refer to this log for detailed error message.
Restore backed up configuration and start
Restore the backed up files from above
cd /home/backup_ocs
cp ocsinventory-reports.conf z-ocsinventory-server.conf zz-ocsinventory-
restapi.conf /etc/apache2/conf-available/ && cp dbconfig.inc.php
/usr/share/ocsinventory-reports/ocsreports/
Don´t forget to delete the install.php in the install dir
rm /usr/share/ocsinventory-reports/ocsreports/install.php
Start apache webserver
service apache2 start
Sometimes it's required to update the database via the webconsole, simply click
update on the webconsole.