Details

    • New Feature
    • Resolution: Fixed
    • Major
    • None
    • None
    • Default
    • None

    Description

      Add support for gentoo linux package systems.

      Attachments

        1. ebuild
          0.7 kB
        2. image-2025-01-21-19-17-01-138.png
          image-2025-01-21-19-17-01-138.png
          142 kB
        3. image-2025-01-21-19-23-55-057.png
          image-2025-01-21-19-23-55-057.png
          182 kB
        4. packages.inc.php
          12 kB

        Activity

          [OBS-4947] Add supports system gentoo packages

          Yes, thanks!
          I wanted to see how the version is detected.

          landy Mike Stupalov added a comment - Yes, thanks! I wanted to see how the version is detected.
          vsc55 Javier Pastor added a comment - - edited

          Hi,

          You mean this:

          # /usr/local/bin/distro
          Linux|6.6.41-gentoo-dist|amd64|Gentoo|2.17|qemu|

           

           # snmpwalk -v2c -c .... localhost .1.3.6.1.4.1.2021.7890.1
          UCD-SNMP-MIB::ucdavis.7890.1.1.0 = INTEGER: 1
          UCD-SNMP-MIB::ucdavis.7890.1.2.1.2.6.100.105.115.116.114.111 = STRING: "/usr/local/bin/distro"
          UCD-SNMP-MIB::ucdavis.7890.1.2.1.3.6.100.105.115.116.114.111 = ""
          UCD-SNMP-MIB::ucdavis.7890.1.2.1.4.6.100.105.115.116.114.111 = ""
          UCD-SNMP-MIB::ucdavis.7890.1.2.1.5.6.100.105.115.116.114.111 = INTEGER: 5
          UCD-SNMP-MIB::ucdavis.7890.1.2.1.6.6.100.105.115.116.114.111 = INTEGER: 1
          UCD-SNMP-MIB::ucdavis.7890.1.2.1.7.6.100.105.115.116.114.111 = INTEGER: 1
          UCD-SNMP-MIB::ucdavis.7890.1.2.1.20.6.100.105.115.116.114.111 = INTEGER: 4
          UCD-SNMP-MIB::ucdavis.7890.1.2.1.21.6.100.105.115.116.114.111 = INTEGER: 1
          UCD-SNMP-MIB::ucdavis.7890.1.3.1.1.6.100.105.115.116.114.111 = STRING: "Linux|6.6.41-gentoo-dist|amd64|Gentoo|2.17|qemu|"
          UCD-SNMP-MIB::ucdavis.7890.1.3.1.2.6.100.105.115.116.114.111 = STRING: "Linux|6.6.41-gentoo-dist|amd64|Gentoo|2.17|qemu|"
          UCD-SNMP-MIB::ucdavis.7890.1.3.1.3.6.100.105.115.116.114.111 = INTEGER: 1
          UCD-SNMP-MIB::ucdavis.7890.1.3.1.4.6.100.105.115.116.114.111 = INTEGER: 0
          UCD-SNMP-MIB::ucdavis.7890.1.4.1.2.6.100.105.115.116.114.111.1 = STRING: "Linux|6.6.41-gentoo-dist|amd64|Gentoo|2.17|qemu|"

          vsc55 Javier Pastor added a comment - - edited Hi, You mean this: # /usr/local/bin/distro Linux| 6.6 . 41 -gentoo-dist|amd64|Gentoo| 2.17 |qemu|    # snmpwalk -v2c -c .... localhost . 1.3 . 6.1 . 4.1 . 2021.7890 . 1 UCD-SNMP-MIB::ucdavis. 7890.1 . 1.0 = INTEGER: 1 UCD-SNMP-MIB::ucdavis. 7890.1 . 2.1 . 2.6 . 100.105 . 115.116 . 114.111 = STRING: "/usr/local/bin/distro" UCD-SNMP-MIB::ucdavis. 7890.1 . 2.1 . 3.6 . 100.105 . 115.116 . 114.111 = "" UCD-SNMP-MIB::ucdavis. 7890.1 . 2.1 . 4.6 . 100.105 . 115.116 . 114.111 = "" UCD-SNMP-MIB::ucdavis. 7890.1 . 2.1 . 5.6 . 100.105 . 115.116 . 114.111 = INTEGER: 5 UCD-SNMP-MIB::ucdavis. 7890.1 . 2.1 . 6.6 . 100.105 . 115.116 . 114.111 = INTEGER: 1 UCD-SNMP-MIB::ucdavis. 7890.1 . 2.1 . 7.6 . 100.105 . 115.116 . 114.111 = INTEGER: 1 UCD-SNMP-MIB::ucdavis. 7890.1 . 2.1 . 20.6 . 100.105 . 115.116 . 114.111 = INTEGER: 4 UCD-SNMP-MIB::ucdavis. 7890.1 . 2.1 . 21.6 . 100.105 . 115.116 . 114.111 = INTEGER: 1 UCD-SNMP-MIB::ucdavis. 7890.1 . 3.1 . 1.6 . 100.105 . 115.116 . 114.111 = STRING: "Linux|6.6.41-gentoo-dist|amd64|Gentoo|2.17|qemu|" UCD-SNMP-MIB::ucdavis. 7890.1 . 3.1 . 2.6 . 100.105 . 115.116 . 114.111 = STRING: "Linux|6.6.41-gentoo-dist|amd64|Gentoo|2.17|qemu|" UCD-SNMP-MIB::ucdavis. 7890.1 . 3.1 . 3.6 . 100.105 . 115.116 . 114.111 = INTEGER: 1 UCD-SNMP-MIB::ucdavis. 7890.1 . 3.1 . 4.6 . 100.105 . 115.116 . 114.111 = INTEGER: 0 UCD-SNMP-MIB::ucdavis. 7890.1 . 4.1 . 2.6 . 100.105 . 115.116 . 114.111 . 1 = STRING: "Linux|6.6.41-gentoo-dist|amd64|Gentoo|2.17|qemu|"

          Added in r13847 and r13848.

          landy Mike Stupalov added a comment - Added in r13847 and r13848.

          Can you show me how distro script detect your system?
          I mean this script:
          https://docs.observium.org/distro_script/

          landy Mike Stupalov added a comment - Can you show me how distro script detect your system? I mean this script: https://docs.observium.org/distro_script/
          vsc55 Javier Pastor added a comment - - edited

          I have it in production and at the moment without problem:

          vsc55 Javier Pastor added a comment - - edited I have it in production and at the moment without problem:

          This is pretty cool, thanks.

          I'll have to try to install a gentoo system to test!

          adama Adam Armstrong added a comment - This is pretty cool, thanks. I'll have to try to install a gentoo system to test!
          vsc55 Javier Pastor added a comment - - edited

          The two files attached are packages.inc.php for the observium server and ebuild for the agent.

           

          Change on server:

          In file /opt/observium/includes/polling/unix-agent/packages.inc.php

          // ebuild
          if (!safe_empty($agent_data['ebuild'])) {
              echo("\nebuild Packages: ");
              // Build array of existing packages
              $manager = "ebuild";    foreach (dbFetchRows("SELECT * FROM `packages` WHERE `device_id` = ?", [$device['device_id']]) as $pkg_db) {
                  $pkgs_db[$pkg_db['manager']][$pkg_db['name']][$pkg_db['arch']][$pkg_db['version']][$pkg_db['build']]['id']     = $pkg_db['pkg_id'];
                  $pkgs_db[$pkg_db['manager']][$pkg_db['name']][$pkg_db['arch']][$pkg_db['version']][$pkg_db['build']]['status'] = $pkg_db['status'];
                  $pkgs_db[$pkg_db['manager']][$pkg_db['name']][$pkg_db['arch']][$pkg_db['version']][$pkg_db['build']]['size']   = $pkg_db['size'];
                  $pkgs_db_id[$pkg_db['pkg_id']]['text']                                                                         = $pkg_db['manager'] . "-" . $pkg_db['name'] . "-" . $pkg_db['arch'] . "-" . $pkg_db['version'] . "-" . $pkg_db['build'];
                  $pkgs_db_id[$pkg_db['pkg_id']]['manager']                                                                      = $pkg_db['manager'];
                  $pkgs_db_id[$pkg_db['pkg_id']]['name']                                                                         = $pkg_db['name'];
                  $pkgs_db_id[$pkg_db['pkg_id']]['arch']                                                                         = $pkg_db['arch'];
                  $pkgs_db_id[$pkg_db['pkg_id']]['version']                                                                      = $pkg_db['version'];
                  $pkgs_db_id[$pkg_db['pkg_id']]['build']                                                                        = $pkg_db['build'];
              }    foreach (explode("\n", $agent_data['ebuild']) as $package) {
                  [$name, $pversion, $arch, $size] = explode(" ", $package);
                  $build                                                      = "";
                  $pkgs[$manager][$name][$arch][$pversion][$build]['manager'] = $manager;
                  $pkgs[$manager][$name][$arch][$pversion][$build]['name']    = $name;
                  $pkgs[$manager][$name][$arch][$pversion][$build]['arch']    = $arch;
                  $pkgs[$manager][$name][$arch][$pversion][$build]['version'] = $pversion;
                  $pkgs[$manager][$name][$arch][$pversion][$build]['build']   = $build;
                  $pkgs[$manager][$name][$arch][$pversion][$build]['size']    = (int)$size * 1024;
                  $pkgs[$manager][$name][$arch][$pversion][$build]['status']  = '1';
                  $text                                                       = $manager . "-" . $name . "-" . $arch . "-" . $pversion . "-" . $build;
                  $pkgs_id[]                                                  = $pkgs[$manager][$name][$arch][$pversion][$build];
              }
          }
          

          vsc55 Javier Pastor added a comment - - edited The two files attached are packages.inc.php for the observium server and ebuild for the agent.   Change on server: In file /opt/observium/includes/polling/unix-agent/packages.inc.php // ebuild if (!safe_empty($agent_data[ 'ebuild' ])) {     echo( "\nebuild Packages: " );     // Build array of existing packages     $manager = "ebuild" ;    foreach (dbFetchRows( "SELECT * FROM `packages` WHERE `device_id` = ?" , [$device[ 'device_id' ]]) as $pkg_db) {         $pkgs_db[$pkg_db[ 'manager' ]][$pkg_db[ 'name' ]][$pkg_db[ 'arch' ]][$pkg_db[ 'version' ]][$pkg_db[ 'build' ]][ 'id' ]     = $pkg_db[ 'pkg_id' ];         $pkgs_db[$pkg_db[ 'manager' ]][$pkg_db[ 'name' ]][$pkg_db[ 'arch' ]][$pkg_db[ 'version' ]][$pkg_db[ 'build' ]][ 'status' ] = $pkg_db[ 'status' ];         $pkgs_db[$pkg_db[ 'manager' ]][$pkg_db[ 'name' ]][$pkg_db[ 'arch' ]][$pkg_db[ 'version' ]][$pkg_db[ 'build' ]][ 'size' ]   = $pkg_db[ 'size' ];         $pkgs_db_id[$pkg_db[ 'pkg_id' ]][ 'text' ]                                                                         = $pkg_db[ 'manager' ] . "-" . $pkg_db[ 'name' ] . "-" . $pkg_db[ 'arch' ] . "-" . $pkg_db[ 'version' ] . "-" . $pkg_db[ 'build' ];         $pkgs_db_id[$pkg_db[ 'pkg_id' ]][ 'manager' ]                                                                      = $pkg_db[ 'manager' ];         $pkgs_db_id[$pkg_db[ 'pkg_id' ]][ 'name' ]                                                                         = $pkg_db[ 'name' ];         $pkgs_db_id[$pkg_db[ 'pkg_id' ]][ 'arch' ]                                                                         = $pkg_db[ 'arch' ];         $pkgs_db_id[$pkg_db[ 'pkg_id' ]][ 'version' ]                                                                      = $pkg_db[ 'version' ];         $pkgs_db_id[$pkg_db[ 'pkg_id' ]][ 'build' ]                                                                        = $pkg_db[ 'build' ];     }    foreach (explode( "\n" , $agent_data[ 'ebuild' ]) as $ package ) {         [$name, $pversion, $arch, $size] = explode( " " , $ package );         $build                                                      = "" ;         $pkgs[$manager][$name][$arch][$pversion][$build][ 'manager' ] = $manager;         $pkgs[$manager][$name][$arch][$pversion][$build][ 'name' ]    = $name;         $pkgs[$manager][$name][$arch][$pversion][$build][ 'arch' ]    = $arch;         $pkgs[$manager][$name][$arch][$pversion][$build][ 'version' ] = $pversion;         $pkgs[$manager][$name][$arch][$pversion][$build][ 'build' ]   = $build;         $pkgs[$manager][$name][$arch][$pversion][$build][ 'size' ]    = ( int )$size * 1024 ;         $pkgs[$manager][$name][$arch][$pversion][$build][ 'status' ]  = '1' ;         $text                                                       = $manager . "-" . $name . "-" . $arch . "-" . $pversion . "-" . $build;         $pkgs_id[]                                                  = $pkgs[$manager][$name][$arch][$pversion][$build];     } }

          General questions and device support can be discussed in our Discord channel, click here to join.


          Please make and attach additional information about the device:

          • full snmp dump from device:

            snmpwalk -v2c -c <community> -t 3 -Cc --hexOutputLength=0 -Ih -ObentxU <hostname> .1 > myagent.snmpwalk
            snmpwalk -v2c -c <community> -t 3 -Cc --hexOutputLength=0 -Ih -ObentxU <hostname> .1.3.6.1.4.1 >> myagent.snmpwalk

            If device not support SNMP version 2c, replace -v2c with -v1.

          • If you have problems with discovery or poller processes, please do and attach these debugs:

            ./discovery.php -d -h <device>
            ./poller.php -d -h <device>

          • additionally attach device and/or vendor specific MIB files

          This comment is added automatically.

          bot Observium Bot added a comment - General questions and device support can be discussed in our Discord channel, click here to join . Please make and attach additional information about the device: full snmp dump from device: snmpwalk -v2c -c <community> -t 3 -Cc --hexOutputLength=0 -Ih -ObentxU <hostname> .1 > myagent.snmpwalk snmpwalk -v2c -c <community> -t 3 -Cc --hexOutputLength=0 -Ih -ObentxU <hostname> .1.3.6.1.4.1 >> myagent.snmpwalk If device not support SNMP version 2c, replace -v2c with -v1. If you have problems with discovery or poller processes, please do and attach these debugs: ./discovery.php -d -h <device> ./poller.php -d -h <device> additionally attach device and/or vendor specific MIB files This comment is added automatically.

          People

            landy Mike Stupalov
            vsc55 Javier Pastor
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: