Topic: ocs agent linux remontée de conf

Bonjour,

Après avoir cherché et parcourru tous les forums je n'arrive pas à corriger un problème sur la remontée des configurations des agents linux.

Je m'explique j'ai installé les derniers paquets d'ocs (ocsinventory-server-2.0.5-1.el6.remi.noarch - ocsinventory-2.0.5-1.el6.remi.noarch - ocsinventory-reports-2.0.5-1.el6.remi.noarch -ocsinventory-agent-2.0.5-1.el6.remi.noarch) sur un serveur centos 6.3.

Mes remontées de configuration Windows fonctionnent sans problème via une GPO dans l'active directory.

Mes différents tests sur linux ne donnent rien, sur la papier il n'y a pourtant pas grand chose à configurer !!!

Voilà le fichier de conf de l'agent (qui est sur le serveur lui-même) : /etc/ocsinventory/ocsinventory-agent.cfg

-----------------
# OCS Inventory "Unix Unified Agent" Configuration File
#
# options used by cron job overides this (see /etc/sysconfig/ocsinventory-agent)
#

# Server URL, unconmment if needed
server = htttp://172.16.0.17/ocsinventory  ----------> (nb j'ai ajouté volontairement un troisième 't'ici et par la suite pour pouvoir envoyer ce message ---> Too more links in message. Allowed 1 links. Reduce number of links and post it again !!!)
local = /var/lib/ocsinventory-agent

# Administrative TAG (optional, must be filed before first inventory)
# tag = your_tag

# How to log, can be File,Stderr,Syslog
logger = Stderr
logfile = /var/log/ocsinventory-agent/ocsinventory-agent.log
---------
La commande lancée sans argument : ocsinventory-agent --debug ou avec argument ocsinventory-agent --debug --server=htttp//172.16.0.17/ocsinventory  créé correctement mon fichier d'inventaire mais celui-ci n'est pas remonté dans la base SQL....



Voilà le log de l'agent... il semble qu'il ne prenne pas en compte le serveur ----> Voilà le fichier de conf de l'agent : /etc/ocsinventory/ocsinventory-agent.cfg

-----------------
# OCS Inventory "Unix Unified Agent" Configuration File
#
# options used by cron job overides this (see /etc/sysconfig/ocsinventory-agent)
# Server URL, unconmment if needed
server = htttp://172.16.0.17/ocsinventory
local = /var/lib/ocsinventory-agent

# Administrative TAG (optional, must be filed before first inventory)
# tag = your_tag

# How to log, can be File,Stderr,Syslog
logger = Stderr
logfile = /var/log/ocsinventory-agent/ocsinventory-agent.log
---------

La commande lancée sans argument : ocsinventory-agent --debug

Et le log en retour... il semble qu'il ne prenne pas en compte le serveur 172.16.0.17 ---> [info] [download] Agent is running in local mode...disabling module


[Thu Sep  6 14:46:43 2012][debug] Ocsinventory unified agent for UNIX, Linux and MacOSX 2.0.5
[Thu Sep  6 14:46:43 2012][debug] Log system initialised (File)
[Thu Sep  6 14:46:43 2012][debug] --scan-homedirs missing. Don't scan user directories
[Thu Sep  6 14:46:43 2012][debug] --server ignored since you also use --local
[Thu Sep  6 14:46:43 2012][debug] Accountinfo file: /var/lib/ocsinventory-agent/http:__172.16.0.17_ocsinventory/ocsinv.adm
[Thu Sep  6 14:46:43 2012][debug] OCS Agent initialised
[Thu Sep  6 14:46:43 2012][debug] Turns hooks on for /etc/ocsinventory/modules.conf
[Thu Sep  6 14:46:43 2012][debug] Ocsinventory unified agent for UNIX, Linux and MacOSX 2.0.5
[Thu Sep  6 14:46:43 2012][debug] Log system initialised (File)
[Thu Sep  6 14:46:43 2012][debug] Calling handlers : `start_handler'
[Thu Sep  6 14:46:43 2012][debug] [download] Calling download_start_handler
[Thu Sep  6 14:46:43 2012][info] [download] Agent is running in local mode...disabling module
...

Je n'ai rien dans les logs apache ou les logs d'ocs serveur !!!

Vous avez déjà eu un problème similaire ?

Merci.

Philippe

Re: ocs agent linux remontée de conf

Déjà, faut lire les commentaires

see /etc/sysconfig/ocsinventory-agent

Et clairement, je pense qu'il y a conflit entre les options "server" et "local"

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: ocs agent linux remontée de conf

Oui il est clair que par defaut ocs semble paramétrer quelque part sur 'local'

Mais mon fichier /etc/sysconfig/ocsinventory-agent a pour moi été modifié en conséquence ... à moins d'avoir fait une fausse interprétation ...

-----------------------------------

# OCS Inventory "Unix Unified Agent" Configuration File
# used by hourly cron job
#

# Add tools directory if needed (tw_cli, hpacucli, ipssend, ...)
PATH=/sbin:/bin:/usr/sbin:/usr/bin

# Mode, change to "cron" to activate
OCSMODE[0]=none


# can be used to override the ocsinventory-agent.cfg setup.
OCSSERVER[0]=http://172.16.0.17/ocsinventory
#
# corresponds with --local=/var/lib/ocsinventory-agent
# OCSSERVER[0]=local

# Wait before inventory
OCSPAUSE[0]=100

# Administrative TAG (optional, must be filed before first inventory)
OCSTAG[0]=

Re: ocs agent linux remontée de conf

Nouvel essai en modifiant le fichier de conf de l'agent, j'ai mis un commentaire sur la ligne local :

# Server URL, unconmment if needed
server =hxxp://172.16.0.17/ocsinventory
#local = /var/lib/ocsinventory-agent


Puis je relance mon agent : ocsinventory-agent --debug --server=hxxp://172.16.0.17/ocsinventory

Le message  [info] [download] Agent is running in local mode...disabling module n'apparait plus mais j'ai maintenant une erreur 503...


[Fri Sep  7 13:53:08 2012][debug] Ocsinventory unified agent for UNIX, Linux and MacOSX 2.0.5
[Fri Sep  7 13:53:08 2012][debug] Log system initialised (File)
[Fri Sep  7 13:53:08 2012][debug] --scan-homedirs missing. Don't scan user directories
[Fri Sep  7 13:53:09 2012][debug] Accountinfo file: /var/lib/ocsinventory-agent/http:__172.16.0.17_ocsinventory/ocsinv.adm
[Fri Sep  7 13:53:09 2012][debug] OCS Agent initialised
[Fri Sep  7 13:53:09 2012][debug] Turns hooks on for /etc/ocsinventory/modules.conf
[Fri Sep  7 13:53:09 2012][debug] Ocsinventory unified agent for UNIX, Linux and MacOSX 2.0.5
[Fri Sep  7 13:53:09 2012][debug] Log system initialised (File)
[Fri Sep  7 13:53:09 2012][debug] Calling handlers : `start_handler'
[Fri Sep  7 13:53:09 2012][debug] [download] Calling download_start_handler
[Fri Sep  7 13:53:09 2012][debug]  - Net::SSLeay qw(die_now die_if_ssl_error) loaded
[Fri Sep  7 13:53:09 2012][debug] Compress::Zlib is available.
[Fri Sep  7 13:53:09 2012][debug] Calling handlers : `prolog_writer'
[Fri Sep  7 13:53:09 2012][debug] sending XML
[Fri Sep  7 13:53:09 2012][debug] sending: <?xml version="1.0" encoding="UTF-8"?>
<REQUEST>
  <DEVICEID>ocs-2012-09-06-11-42-17</DEVICEID>
  <QUERY>PROLOG</QUERY>
</REQUEST>
[Fri Sep  7 13:53:30 2012][error] Cannot establish communication : 503 Service Unavailable

C'est exactement la même erreur que j'ai eu avec les paquets ocs avec le repository epel (version d'OCS 1.1.3 de mémoire) avant que je ne charge la dernière version via le repository de remi... !!!

Re: ocs agent linux remontée de conf

503, c'est une erreur côté serveur, voir les logs du serveur.

Voir aussi la liste des paquets perl installés (rpm -qa perl\* | sort)

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: ocs agent linux remontée de conf

Pour les paquets perl à priori ils ont correctement été installés

perl-5.10.1-127.el6.x86_64
perl-Apache2-SOAP-0.73-3.el6.noarch
perl-Apache-DBI-1.11-1.el6.remi.noarch
perl-BSD-Resource-1.29.03-3.el6.x86_64
perl-Compress-Raw-Zlib-2.020-127.el6.x86_64
perl-Compress-Zlib-2.020-127.el6.x86_64
perl-Crypt-SSLeay-0.57-16.el6.x86_64
perl-DBD-MySQL-4.013-3.el6.x86_64
perl-DBI-1.609-4.el6.x86_64
perl-devel-5.10.1-127.el6.x86_64
perl-Digest-SHA1-2.12-2.el6.x86_64
perl-Email-Date-Format-1.002-5.el6.noarch
perl-ExtUtils-MakeMaker-6.55-127.el6.x86_64
perl-ExtUtils-ParseXS-2.2003.0-127.el6.x86_64
perl-HTML-Parser-3.64-2.el6.x86_64
perl-HTML-Tagset-3.20-4.el6.noarch
perl-IO-Compress-Base-2.020-127.el6.x86_64
perl-IO-Compress-Zlib-2.020-127.el6.x86_64
perl-libs-5.10.1-127.el6.x86_64
perl-libwww-perl-5.833-2.el6.noarch
perl-MailTools-2.04-4.el6.noarch
perl-MIME-Lite-3.027-2.el6.noarch
perl-MIME-Types-1.28-2.el6.noarch
perl-Module-Pluggable-3.90-127.el6.x86_64
perl-Net-IP-1.25-13.el6.noarch
perl-Net-SSLeay-1.35-9.el6.x86_64
perl-Pod-Escapes-1.04-127.el6.x86_64
perl-Pod-Simple-3.13-127.el6.x86_64
perl-Proc-Daemon-0.14-1.el6.remi.noarch
perl-Proc-ProcessTable-0.44-4.el6.x86_64
perl-SOAP-Lite-0.710.10-2.el6.noarch
perl-Test-Harness-3.17-127.el6.x86_64
perl-TimeDate-1.16-11.1.el6.noarch
perl-URI-1.40-2.el6.noarch
perl-version-0.77-127.el6.x86_64
perl-XML-Entities-1.0000-1.el6.noarch
perl-XML-Parser-2.36-7.el6.x86_64
perl-XML-Simple-2.18-6.el6.noarch

Par contre j'ai effectivement une erreur dans le log d'apache ...

Use of uninitialized value in numeric eq (==) at /usr/share/perl5/vendor_perl/Apache/Ocsinventory/Server/Inventory.pm line 73.
------------

La ligne en question 73:

72   # Call to preinventory handlers
73   if( &_pre_options() == INVENTORY_STOP ){
74     &_log(107,'inventory','stopped_by_module') if $ENV{'OCS_OPT_LOGLEVEL'};
75     return APACHE_FORBIDDEN;
76   }

Je dois avouer que le perl ... j'essaye d'approfondir...

Re: ocs agent linux remontée de conf

Bon je n'ai pas tout compris mais en configurant les remontées d'alerte via le job cron cela fonctionne !!!

Voilà mon fichier : /etc/sysconfig/ocsinventory-agent

---------------------------------------
# Mode, change to "cron" to activate
#OCSMODE[0]=none
OCSMODE[0]=cron

# can be used to override the ocsinventory-agent.cfg setup.
OCSERVER[0]=172.16.0.17
----------------------------------------------------

et le resultat dans le log de l'agent...

------------------------
[Fri Sep  7 16:01:01 2012] Running ocsinventory-agent --wait 100
[Fri Sep  7 16:01:01 2012][info] Going to sleep for 55 second(s)
[Fri Sep  7 16:01:57 2012][info] PROLOG_FREQ has changed since last process(old=,new=24)
[Fri Sep  7 16:01:57 2012][info] No support registered for your installation. Check OCS Inventory NG support packages at url=hxxp://www.ocsinventory-ng.com
[Fri Sep  7 16:01:57 2012][info] [download] Download is off.
[Fri Sep  7 16:02:00 2012][info] [download] Beginning work. I am 19465.
[Fri Sep  7 16:02:00 2012][info] [download] Option turned off. Exiting.
[Fri Sep  7 16:02:00 2012] End of cron job (/sbin:/bin:/usr/sbin:/usr/bin)
--------------------------------------

Merci beaucoup pour l'aide efficace.

Cordialement.
Phil.