PHP SNMP - Cannot find module

前端 未结 8 1093
逝去的感伤
逝去的感伤 2020-12-17 16:50

I\'ve enabled the SNMP module was trying to the functions in the module. I have set the MIBDIRS environment variable to where I have my mibs but I\'m still getting these \"

相关标签:
8条回答
  • 2020-12-17 16:58

    On linux, I was able to fix these by adding this to my /etc/php5/apache2/conf.d/snmp.ini file.

    mibdir=/usr/share/snmp/mibs
    mibs=all

    0 讨论(0)
  • 2020-12-17 17:01

    I've got the same problem in Ubuntu with php7.1 and the solution was installing snmp package

    apt-get install snmp
    
    0 讨论(0)
  • 2020-12-17 17:06

    Stumbled upon this migrating older Cacti to Ubuntu 16.

    In Ubuntu/Debian package php-snmp depends on php7.0-snmp, neither of which come with MIBs or depend on snmp-mibs-downloader, hence SNMP module ends up being defunct with no MIBs available.

    What you should do is install snmp-mibs-downloader (or equivalent) and let it download all available MIBs and see if that helps. If it doesn't, you might need to adjust mibdirs in /etc/php/x.x/mods-available/snmp.ini and/or manually load required MIBs (loading everything via mibs = ALL would work, but I consider it bad practice).

    If no downloader is available, follow @Robin's advice and get MIBs from Net-SNMP

    0 讨论(0)
  • 2020-12-17 17:12

    Open your php.ini and add some magical semicolon at line that look like:

    extension=php_snmp.dll
    

    It should look like:

    ;extension=php_snmp.dll
    
    0 讨论(0)
  • 2020-12-17 17:12

    I just fixed it on my machine here by adding

    mibdirs +/var/lib/mibs/iana:/var/lib/mibs/ietf
    

    to /etc/snmp/snmp.conf.

    0 讨论(0)
  • 2020-12-17 17:12

    Faced a similar problem but in Ubuntu -

    In /etc/snmp/snmp.conf -

    # As the snmp packages come without MIB files due to license reasons, loading
    # of MIBs is disabled by default. If you added the MIBs you can reenable
    # loading them by commenting out the following line.
    #mibs :
    

    So , commenting out the mibs line in this file solved it .

    0 讨论(0)
提交回复
热议问题