Luis Olavarrieta's picture

Hi to everyone:

 

Everytime i run a php command from the console i get this error message:

 

root@visum /opt/observium# php discovery.php -u

MIB search path: /opt/observium/mibs

Cannot find module (SNMPv2-MIB): At line 1 in (none)

Cannot find module (IF-MIB): At line 1 in (none)

Cannot find module (IP-MIB): At line 1 in (none)

Cannot find module (TCP-MIB): At line 1 in (none)

Cannot find module (UDP-MIB): At line 1 in (none)

Cannot find module (HOST-RESOURCES-MIB): At line 1 in (none)

Cannot find module (NOTIFICATION-LOG-MIB): At line 1 in (none)

Cannot find module (DISMAN-EVENT-MIB): At line 1 in (none)

Cannot find module (DISMAN-SCHEDULE-MIB): At line 1 in (none)

Cannot find module (HOST-RESOURCES-TYPES): At line 1 in (none)

Cannot find module (MTA-MIB): At line 1 in (none)

Cannot find module (NETWORK-SERVICES-MIB): At line 1 in (none)

Cannot find module (UCD-DISKIO-MIB): At line 1 in (none)

Cannot find module (UCD-DLMOD-MIB): At line 1 in (none)

Cannot find module (LM-SENSORS-MIB): At line 1 in (none)

Cannot find module (UCD-SNMP-MIB): At line 1 in (none)

Cannot find module (UCD-DEMO-MIB): At line 1 in (none)

Cannot find module (SNMP-TARGET-MIB): At line 1 in (none)

Cannot find module (NET-SNMP-AGENT-MIB): At line 1 in (none)

Cannot find module (SNMP-MPD-MIB): At line 1 in (none)

Cannot find module (SNMP-USER-BASED-SM-MIB): At line 1 in (none)

Cannot find module (SNMP-FRAMEWORK-MIB): At line 1 in (none)

Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 1 in (none)

Cannot find module (SNMP-COMMUNITY-MIB): At line 1 in (none)

Cannot find module (IPV6-ICMP-MIB): At line 1 in (none)

Cannot find module (IPV6-MIB): At line 1 in (none)

Cannot find module (IPV6-TCP-MIB): At line 1 in (none)

Cannot find module (IPV6-UDP-MIB): At line 1 in (none)

Cannot find module (IP-FORWARD-MIB): At line 1 in (none)

Cannot find module (NET-SNMP-PASS-MIB): At line 1 in (none)

Cannot find module (NET-SNMP-EXTEND-MIB): At line 1 in (none)

Cannot find module (SNMP-NOTIFICATION-MIB): At line 1 in (none)

Cannot find module (SNMPv2-TM): At line 1 in (none)

Cannot find module (NET-SNMP-VACM-MIB): At line 1 in (none)

__________________

 

please advice

Forum: 
Tags: 
Jeremy Davis's picture

I was able to reporoduce this straight away, so thanks so much for reporting.

It actually took me ages to work out what the issue was. But it seems that there are a few MIBs pre-compiled into the snmp software. But our default config only uses the Observium provided MIBs. The conf file (/etc/snmp/snmp.conf) we ship be default looks like this:

mibdirs /opt/observium/mibs

The fix is to add the Observium provided MIBs to the default, rather than replace them. To do that, the conf file needs a '+' at the start of the path to add. I.e.:

mibdirs +/opt/observium/mibs

You can manually edit the conf file, or just run the sed command below (run as root):

sed -i "s|mibdirs /opt/observium/mibs|mibdirs +/opt/observium/mibs|" /etc/snmp/snmp.conf

After that:

root@observium /opt/observium# ./discovery.php -u

  ___   _                              _
 / _ \ | |__   ___   ___  _ __ __   __(_) _   _  _ __ ___
| | | || '_ \ / __| / _ \| '__|\ \ / /| || | | || '_ ` _ \
| |_| || |_) |\__ \|  __/| |    \ V / | || |_| || | | | | |
 \___/ |_.__/ |___/ \___||_|     \_/  |_| \__,_||_| |_| |_|
                     Observium Community Edition 19.8.10000
                                   http://www.observium.org

-- Database is up to date.

I've opened an issue and I'll apply the fix to the build code and rebuild soonish.

Please post back and confirm that my fix works for you too.

Luis Olavarrieta's picture

is working!!! thanks!!!

Jeremy Davis's picture

Awesome! :)

Jeremy Davis's picture

Hi Marco, I edited your post before publishing (fixed the mis-spelling of my name, plus posted your output from your pastebin link).

Could you please give me the outout of your SNMP config file. I.e.:

cat /etc/snmp/snmp.conf

Also, it shouldn't matter, but perhaps you need to restart Apache to pick up the changes? (I note that I didn't state that you need to do that, so I suspect that you don't, but it can't hurt).

Luis Olavarrieta's picture

Jeremy, i just found this new error:

 

root@observium /opt/observium# php check-errors.php 

PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 16384 bytes) in /opt/observium/includes/db/mysqli.inc.php on line 397

 

line 397 is   

 

      $rows = mysqli_fetch_all($result, MYSQLI_ASSOC);

 

Please advice!

Jeremy Davis's picture

It looks like when your server was loading all results from it's database, it used too much RAM. As per the message, it tried to allocate another ~16MB but that exceeded the allowed memory usage (of ~530MB).

My assumption is that it hit the limit allowed in the php.ini file. Note that there are 2 files, one for Apache and one for CLI. In this case you'll want to edit the CLI file (because when you hit the error you were running from the commandline) but it may pay to double check the Apache limit too.

In a v16.x appliance, the 2 files should be:

/etc/php/7.3/apache2/php.ini
/etc/php/7.3/cli/php.ini

As per the file path, the one you want to edit is the second one and look for the 'memory_limit' line and bump it up higher. It sounds like it's ~500MB currently, but needs to be higher. I would suggest adding an extra 64MB and see how that goes.

Alternatively, if you just wish to temporarily remove the PHP RAM limit while you run the command you're trying to run, you should be able do it ad hoc like this:

php -d memory_limit=-1 /opt/observium/check-errors.php
Jeremy Davis's picture

Any changes in PHP config require restart (and as in our default config PHP runs as an Apache module, that means restarting Apache).

That should do the trick...

Jeremy Davis's picture

I've had a quick look and I can recreate the issue (again) - even on the latest release. Here's what I did to fix it. Hopefully it works for you.

Enable the 'non-free' repo:

sed -i "\|non-free| s|^#||" /etc/apt/sources.list.d/sources.list
sed -i "\|non-free| s|^#||" /etc/apt/sources.list.d/security.sources.list

Update package lists and install 'snmp-mibs-downloader':

apt update
apt install snmp-mibs-downloader

That patches some of the mibs files on install and that seemed to resolve the issue for me?!:

root@jed-test-observium /opt/observium# ./discovery.php -u

  ___   _                              _
 / _ \ | |__   ___   ___  _ __ __   __(_) _   _  _ __ ___
| | | || '_ \ / __| / _ \| '__|\ \ / /| || | | || '_ ` _ \
| |_| || |_) |\__ \|  __/| |    \ V / | || |_| || | | | | |
 \___/ |_.__/ |___/ \___||_|     \_/  |_| \__,_||_| |_| |_|
                     Observium Community Edition 20.9.10731
                                  https://www.observium.org

-- Database is up to date.

But I also downloaded mibs too:

download-mibs

And all still seems well:

root@jed-test-observium /opt/observium# ./discovery.php -u

  ___   _                              _
 / _ \ | |__   ___   ___  _ __ __   __(_) _   _  _ __ ___
| | | || '_ \ / __| / _ \| '__|\ \ / /| || | | || '_ ` _ \
| |_| || |_) |\__ \|  __/| |    \ V / | || |_| || | | | | |
 \___/ |_.__/ |___/ \___||_|     \_/  |_| \__,_||_| |_| |_|
                     Observium Community Edition 20.9.10731
                                  https://www.observium.org

-- Database is up to date.

I hope that helps.

PS it turns out that restarting Apache isn't/wasn't required anyway... I guess PHP only calls SNMP as a separate process?!

Jeremy Davis's picture

I'm not sure why their default install works and ours didn't? We do a pretty default install. As for the mibs changes, the snmp-mibs-downloader package page says:

This package ships the IETF RFCs containing MIB files and a script which extracts them to be used by Simple Network Management libraries. The script can be used to update some MIBs to the latest version or to download extra vendor MIBs.

I know that Observium includes a whole heap of mibs (in /opt/observium/mibs/) but AFAIK it also relies on system mibs too.

Anyway, glad that's got you going. Please report back if you have any further issues or questions.

Add new comment