Welcome to OCS Inventory NG community support, where you can ask questions and receive answers from other members of the community.

Please ask questions only in English or French.

Release 2.12.3 available

The official documentation can be found on https://wiki.ocsinventory-ng.org. Read it before asking your question.

Erreur 500 sur scan SNMP

Bonjour,
Je suis en train d'installer un serveur OCS et je rencontre une difficulté avec la fonctionnalité de scan snmp de l'agent linux, erreur 500 (détails dans les extraits de logs plus bas)
J'ai vérifier l'ensemble des fichiers de conf pour les liens et connexion a la bdd sans trouver d'erreurs

mon infra est composée de :
1 serveur pour la base de données

     OS : Debian 10.9

     mariadb : 10.3

1 serveur web (glpi/ocs) + agent ocs unix

     OS : Debian 10.11

     version ocs-server : OCSNG_UNIX_SERVER-2.9.1

     version OCS-agent : Ocsinventory-Unix-Agent-2.8.1

####Les informations ci-dessous sont volontairement anonymisées, les données réelles ne présentent pas d'anomalies####

Log de l'agent

[Tue Nov 16 16:02:26 2021][debug] sending XML
[Tue Nov 16 16:02:26 2021][debug] sending: <?xml version="1.0" encoding="UTF-8"?>
<REQUEST>
  <CONTENT>
    <snmp_imprimante_hp>
      <Nom>WWW-XXX-YYYY</Nom>
      <Serial>ZZZZ</Serial>
    </snmp_imprimante_hp>
    <snmp_imprimante_hp>
      <Nom>WWW-XXX-YYYY</Nom>
      <Serial>ZZZZ</Serial>
    </snmp_imprimante_hp>
    <snmp_imprimante_hp>
      <Nom>WWW-XXX-YYYY</Nom>
      <Serial>ZZZZ</Serial>
    </snmp_imprimante_hp>
    <snmp_imprimante_hp>
      <Nom>WWW-XXX-YYYY</Nom>
      <Serial>ZZZZ</Serial>
    </snmp_imprimante_hp>
    <snmp_imprimante_hp>
      <Nom>WWW-XXX-YYYY</Nom>
      <Serial>ZZZZ</Serial>
    </snmp_imprimante_hp>
    <snmp_imprimante_hp>
      <Nom>WWW-XXX-YYYY</Nom>
      <Serial>ZZZZ</Serial>
    </snmp_imprimante_hp>
  </CONTENT>
  <DEVICEID>inventory-2021-11-15-15-42-25</DEVICEID>
  <QUERY>SNMP</QUERY>
</REQUEST>

[Tue Nov 16 16:02:26 2021][error] Cannot establish communication : 500 Internal Server Error
[Tue Nov 16 16:02:26 2021][debug] [snmpscan] End snmp_end_handler :)

Log Apache

[Tue Nov 16 14:02:10.295527 2021] [php7:warn] [pid 28962] [client 430.532.309.21:52708] PHP Warning:  Invalid argument supplied for foreach() in /usr/share/ocsinventory-reports/ocsreports/require/softwares/SoftwareCategory.php on line 233, referer: https://serveur.domaine.fr/ocsreports/index.php?function=computer&head=1&systemid=11&cat=software
[Tue Nov 16 14:02:23.511565 2021] [php7:warn] [pid 28418] [client 430.532.309.21:52731] PHP Warning:  implode(): Invalid arguments passed in /usr/share/ocsinventory-reports/ocsreports/require/softwares/SoftwareCategory.php on line 252, referer: https://serveur.domaine.fr/ocsreports/index.php?function=computer&head=1&systemid=11&cat=software
[Tue Nov 16 14:02:23.511601 2021] [php7:warn] [pid 28418] [client 430.532.309.21:52731] PHP Warning:  Invalid argument supplied for foreach() in /usr/share/ocsinventory-reports/ocsreports/require/softwares/SoftwareCategory.php on line 233, referer: https://serveur.domaine.fr/ocsreports/index.php?function=computer&head=1&systemid=11&cat=software
[Tue Nov 16 15:54:03.256205 2021] [php7:notice] [pid 29061] [client 430.532.309.21:62590] , referer: https://serveur.domaine.fr/ocsreports/index.php?function=visu_computers
[Tue Nov 16 15:54:03.473772 2021] [php7:notice] [pid 29061] [client 430.532.309.21:62590] , referer: https://serveur.domaine.fr/ocsreports/index.php?function=admin_dico
[Tue Nov 16 15:54:09.824059 2021] [php7:notice] [pid 29061] [client 430.532.309.21:62590] , referer: https://serveur.domaine.fr/ocsreports/index.php?function=admin_dico
[Tue Nov 16 15:54:10.009167 2021] [php7:notice] [pid 29061] [client 430.532.309.21:62590] , referer: https://serveur.domaine.fr/ocsreports/index.php?function=admin_dico
[Tue Nov 16 16:02:26.225347 2021] [perl:error] [pid 28416] [client 430.532.309.5:38806] \nnot well-formed (invalid token) at line 6, column 14, byte 131 at /usr/local/lib/x86_64-linux-gnu/perl/5.28.1/XML/Parser.pm line 187.\nXML::Simple called at /usr/local/share/perl/5.28.1/Apache/Ocsinventory.pm line 218.\n

à toutes fins utiles, ci-dessous les détails sur les serveurs et extraits des fichiers remontant des erreurs:

Serveur OCSreports

paquets installés :
    apache2-bin/oldstable,now 2.4.38-3+deb10u6 amd64  [installé, automatique]
    apache2-data/oldstable,now 2.4.38-3+deb10u6 all  [installé, automatique]
    apache2-dev/oldstable,now 2.4.38-3+deb10u6 amd64  [installé]
    apache2-utils/oldstable,now 2.4.38-3+deb10u6 amd64  [installé, automatique]
    apache2/oldstable,now 2.4.38-3+deb10u6 amd64  [installé]
    ....
    libapache-dbi-perl/oldstable,now 1.12-2 all  [installé]
    libapache2-mod-perl2/oldstable,now 2.0.10-3 amd64  [installé, automatique]
    libapache2-mod-php7.3/oldstable,now 7.3.31-1~deb10u1 amd64  [installé, automatique]
    libapache2-reload-perl/oldstable,now 0.13-2 all  [installé, automatique]
    ....
    libnet-http-perl/oldstable,now 6.18-1 all  [installé, automatique]
    libnet-ip-perl/oldstable,now 1.26-2 all  [installé]
    libnet-netmask-perl/oldstable,now 1.9104-1 all  [installé]
    libnet-smtp-ssl-perl/oldstable,now 1.04-1 all  [installé, automatique]
    libnet-snmp-perl/oldstable,now 6.0.1-5 all  [installé]
    libnet-ssleay-perl/oldstable,now 1.85-2+b1 amd64  [installé, automatique]
    ...
    libxml-libxml-perl/oldstable,now 2.0134+dfsg-1 amd64  [installé, automatique]
    libxml-namespacesupport-perl/oldstable,now 1.12-1 all  [installé, automatique]
    libxml-parser-perl/oldstable,now 2.44-4 amd64  [installé, automatique]
    libxml-sax-base-perl/oldstable,now 1.09-1 all  [installé, automatique]
    libxml-sax-expat-perl/oldstable,now 0.51-1 all  [installé, automatique]
    libxml-sax-perl/oldstable,now 1.00+dfsg-1 all  [installé, automatique]
    libxml-simple-perl/oldstable,now 2.25-1 all  [installé]
    libxml2/oldstable,now 2.9.4+dfsg1-7+deb10u2 amd64  [installé, automatique]
    libxmlrpc-epi0/oldstable,now 0.54.2-1.2 amd64  [installé, automatique]
    ....
    mariadb-client-10.3/oldstable,now 1:10.3.31-0+deb10u1 amd64  [installé, automatique]
    mariadb-client-core-10.3/oldstable,now 1:10.3.31-0+deb10u1 amd64  [installé, automatique]
    mariadb-client/oldstable,now 1:10.3.31-0+deb10u1 all  [installé]
    mariadb-common/oldstable,now 1:10.3.31-0+deb10u1 all  [installé, automatique]
    ....
    php-apcu-bc/oldstable,now 1.0.4-4 amd64  [installé, automatique]
    php-apcu/oldstable,now 5.1.17+4.0.11-1 amd64  [installé]
    php-bz2/oldstable,now 2:7.3+69 all  [installé]
    php-cas/oldstable,now 1.3.6-1 all  [installé]
    php-common/oldstable,now 2:69 all  [installé, automatique]
    php-curl/oldstable,now 2:7.3+69 all  [installé]
    php-gd/oldstable,now 2:7.3+69 all  [installé]
    php-imap/oldstable,now 2:7.3+69 all  [installé]
    php-intl/oldstable,now 2:7.3+69 all  [installé]
    php-ldap/oldstable,now 2:7.3+69 all  [installé]
    php-mbstring/oldstable,now 2:7.3+69 all  [installé]
    php-mysql/oldstable,now 2:7.3+69 all  [installé]
    php-pclzip/oldstable,now 2.8.2-4 all  [installé]
    php-soap/oldstable,now 2:7.3+69 all  [installé]
    php-xml/oldstable,now 2:7.3+69 all  [installé]
    php-xmlrpc/oldstable,now 2:7.3+69 all  [installé]
    php-zip/oldstable,now 2:7.3+69 all  [installé]
    php7.3-bz2/oldstable,now 7.3.31-1~deb10u1 amd64  [installé, automatique]
    php7.3-cli/oldstable,now 7.3.31-1~deb10u1 amd64  [installé, automatique]
    php7.3-common/oldstable,now 7.3.31-1~deb10u1 amd64  [installé, automatique]
    php7.3-curl/oldstable,now 7.3.31-1~deb10u1 amd64  [installé, automatique]
    php7.3-gd/oldstable,now 7.3.31-1~deb10u1 amd64  [installé, automatique]
    php7.3-imap/oldstable,now 7.3.31-1~deb10u1 amd64  [installé, automatique]
    php7.3-intl/oldstable,now 7.3.31-1~deb10u1 amd64  [installé, automatique]
    php7.3-json/oldstable,now 7.3.31-1~deb10u1 amd64  [installé, automatique]
    php7.3-ldap/oldstable,now 7.3.31-1~deb10u1 amd64  [installé, automatique]
    php7.3-mbstring/oldstable,now 7.3.31-1~deb10u1 amd64  [installé, automatique]
    php7.3-mysql/oldstable,now 7.3.31-1~deb10u1 amd64  [installé, automatique]
    php7.3-opcache/oldstable,now 7.3.31-1~deb10u1 amd64  [installé, automatique]
    php7.3-readline/oldstable,now 7.3.31-1~deb10u1 amd64  [installé, automatique]
    php7.3-soap/oldstable,now 7.3.31-1~deb10u1 amd64  [installé, automatique]
    php7.3-xml/oldstable,now 7.3.31-1~deb10u1 amd64  [installé, automatique]
    php7.3-xmlrpc/oldstable,now 7.3.31-1~deb10u1 amd64  [installé, automatique]
    php7.3-zip/oldstable,now 7.3.31-1~deb10u1 amd64  [installé, automatique]
    php7.3/oldstable,now 7.3.31-1~deb10u1 all  [installé, automatique]
    php/oldstable,now 2:7.3+69 all  [installé]

Serveur BDD
  
paquets :
    mariadb-client-10.3/stable,now 1:10.3.27-0+deb10u1 amd64  [installé, automatique]
    mariadb-client-core-10.3/stable,now 1:10.3.27-0+deb10u1 amd64  [installé, automatique]
    mariadb-client/stable,now 1:10.3.27-0+deb10u1 all  [installé]
    mariadb-common/stable,now 1:10.3.27-0+deb10u1 all  [installé]
    mariadb-server-10.3/stable,now 1:10.3.27-0+deb10u1 amd64  [installé, automatique]
    mariadb-server-core-10.3/stable,now 1:10.3.27-0+deb10u1 amd64  [installé, automatique]
    mariadb-server/stable,now 1:10.3.27-0+deb10u1 all  [installé]

Fichier /usr/local/lib/x86_64-linux-gnu/perl/5.28.1/XML/Parser.pm

   185      my @result = ();
   186      my $result;
   187      eval { $result = $expat->parse($arg); };
   188      my $err = $@;
   189      if ($err) {
   190          $expat->release;
   191          die $err;
   192      }

Fichier /usr/local/share/perl/5.28.1/Apache/Ocsinventory.pm
  
212      # Parse the XML request
   213      # Retrieving xml parsing options if needed
   214      &_get_xml_parser_opt( \%XML_PARSER_OPT ) unless %XML_PARSER_OPT;
   215      eval {
   216          $query = XML::Simple::XMLin( $inflated, %XML_PARSER_OPT );
   217      } or do {
   218          unless($query = XML::Simple::XMLin( encode('utf8',$inflated), %XML_PARSER_OPT )){
   219            &_log(507,'handler','Xml stage');
   220            return &_end(APACHE_BAD_REQUEST);
   221          }
   222      };
  
Merci de votre aide.

Cordialement,
in OCS Inventory NG agent for Unix by (120 points)

1 Answer

0 votes
Hi,

the error "Cannot establish communication : 500 Internal Server Error" should not be a snmp error but a webserver error. Probably the server can't write on db. You can check z-ocsinventory-server.conf in webserver configuration.

Bye

  Roberto
by (260 points)
 
Powered by Question2Answer
...