SNMP OIDs?

Discussion in 'Networking' started by ElPatron, Aug 4, 2011.

  1. Offline

    ElPatron Guest

    Member Since:
    ElPatron, Aug 4, 2011

    Hi all,

    is there a list of the OIDs supported by freenas? I walked thru and I only got a handful of values like system description (.1.3.6.1.2.1.1.1.0), uptime (.1.3.6.1.2.1.1.3.0).

    Perhaps there is a MIB file? Didn´t find much information about it...

    Background: We have to monitor our customers devices concerning various aspects as free disk space, load, network et. al. We use Nagios for these purposes and all I got out of my FN box is some basic data:

    [​IMG]

    Thanks for any hints, if anyone´s interested I will post the corresponding Nagios Check-Commands.

    Markus
  2. Offline

    Durkatlon FreeNAS Aware

    Member Since:
    Aug 19, 2011
    Messages:
    322
    Message Count:
    322
    Likes Received:
    3
    Trophy Points:
    18
    Location:
    San Diego, CA
    Durkatlon, Aug 19, 2011

    OK, I had to heavily edit this reply because my initial solution did not persist across reboots.

    Basically you should first try editing /etc/snmpd.config and restarting the daemon until you see all the MIBs that you are interested in. In this example I'll add the MIB-II module which is not loaded by default into the bsnmpd daemon.

    First we'll just try getting it to work (this will not be persistent yet). Add the following line to the configuration file /etc/snmpd.config:

    Code (text):
    1.  
    2. begemotSnmpdModulePath."mibII" = "/usr/lib/snmp_mibII.so"
    3.  
    Then restart the service:

    Code (text):
    1.  
    2. # /etc/rc.d/bsnmpd restart
    3.  
    If all is well you should now be able to see all the usual network statistics entries when you snmpwalk from a remote machine. For ideas on additional helper modules you can load, take a look at the /conf/base/etc/snmpd.config file. This has all kinds of modules loading into the daemon. Note that this file is not used by FreeNAS at all!

    OK, so now to make it persistent. The way the snmpd.config is created during system boot, is from the /etc/rc.d/ix-bsnmpd script. Now, if we were to modify this script directly this would not survive a reboot either, so we will modify /conf/base/etc/rc.d/ix-bsnmpd.

    First, make the root file system mount read-write:

    Code (text):
    1.  
    2. # mount -uw /
    3. # vi /conf/base/etc/rc.d/ix-bsnmpd
    4.  
    Look for the section that reads:

    Code (text):
    1.  
    2. ...
    3. sysDescr = \$(description)
    4.  
    5. E*O*F
    6.           done
    7. ...
    8.  
    and add your own configuration lines before the EOF part, like for instance:

    Code (text):
    1.  
    2. sysDescr = \$(description)
    3.  
    4. begemotSnmpdModulePath."mibII" = "/usr/lib/snmp_mibII.so"
    5.  
    6. E*O*F
    7.           done
    8. ...
    9.  
    Now try rebooting the system. If everything was done right, you should see the new /etc/snmpd.config created with the extra configuration lines that load your modules.
  3. Offline

    ElPatron Guest

    Member Since:
    ElPatron, Aug 22, 2011

    Hi Durkatlon,

    I just read your reply, great thanks! I will try it out tomorrow and report my experiences.

    Markus
  4. Offline

    William Grzybowski FreeNAS Guru

    Member Since:
    May 27, 2011
    Messages:
    1,662
    Message Count:
    1,662
    Likes Received:
    23
    Trophy Points:
    38
    Location:
    Curitiba, Brazil
    William Grzybowski, Aug 23, 2011

    FWIW you should be able to use "Auxiliary parameters" field within the GUI SNMP settings intead of this black magic voodoo...
  5. Offline

    Durkatlon FreeNAS Aware

    Member Since:
    Aug 19, 2011
    Messages:
    322
    Message Count:
    322
    Likes Received:
    3
    Trophy Points:
    18
    Location:
    San Diego, CA
    Durkatlon, Aug 23, 2011

    Oh snap, I had figured that was for command-line options or somesuch. Never even noticed the SQLite command after the "E*O*F done" part that reads the extra parameters.

    You are absolutely correct. You can put extra options you want in the "Auxiliary parameters" field of the SNMP configuration dialog. This will stick the values into the configuration database, which means the changes will also persist if you upgrade FreeNAS to a newer version. My solution would have to be re-applied after each update.

    The problem I have right now is that if I try to stick my particular option in there, it will not take it because it deems the slashes in my parameter to be illegal characters. This may just be a bug that needs to be addressed separately. I tried escaping the characters with backslashes, but those are also deemed illegal characters:

    Code (text):
    1.  
    2. bad character '\'
    3.   in file /etc/snmpd.config line 32
    4. error in config file
    5.  
    For now I'll keep using my solution until I can figure out how to properly get the UI to accept the "illegal" characters.
  6. Offline

    William Grzybowski FreeNAS Guru

    Member Since:
    May 27, 2011
    Messages:
    1,662
    Message Count:
    1,662
    Likes Received:
    23
    Trophy Points:
    38
    Location:
    Curitiba, Brazil
    William Grzybowski, Aug 23, 2011

    What are you trying to use in auxiliary parameters? Can you paste the whole thing?
  7. Offline

    Durkatlon FreeNAS Aware

    Member Since:
    Aug 19, 2011
    Messages:
    322
    Message Count:
    322
    Likes Received:
    3
    Trophy Points:
    18
    Location:
    San Diego, CA
    Durkatlon, Aug 23, 2011

    Just this one line that adds MIB-II to bsnmpd:
    Code (text):
    1.  
    2. begemotSnmpdModulePath."mibII" = "/usr/lib/snmp_mibII.so"
    3.  
    The errors show on the console although from the GUI side everything appears to go normal.
  8. Offline

    William Grzybowski FreeNAS Guru

    Member Since:
    May 27, 2011
    Messages:
    1,662
    Message Count:
    1,662
    Likes Received:
    23
    Trophy Points:
    38
    Location:
    Curitiba, Brazil
    William Grzybowski, Aug 23, 2011

    Ok, hopefully this is fixed in a recent changeset and will be available in 8.0.1-RC1
  9. Offline

    ElPatron Guest

    Member Since:
    ElPatron, Aug 26, 2011

    Okay, first of all, thanks Durkatlon and William for your very helpful replies! Adding the 'mibII' module to the tree helped a lot. I can now gather at least some more information than before.

    Unfortunately, FN still doesn´t report anything about the status of any storage devices (disk(s), volume(s), zpool status) and memory allocation. I think, this question goes a little bit deeper into FNs system so I don´t expect an answer, but if you have any idea how to gather more information I´d be really glad.

    Here is a paste of the snmp-walk (FreeNAS-8r7350-amd64).


    Regards,
    Markus
  10. Offline

    snowmirage

    Member Since:
    Sep 20, 2011
    Messages:
    27
    Message Count:
    27
    Likes Received:
    0
    Trophy Points:
    1
    snowmirage, Oct 10, 2011

    Thanks for the info this is just what I had been searching for.

    I do seem to be having an issue with this though.

    I added

    "begemotSnmpdModulePath."mibII" = "/usr/lib/snmp_mibII.so"

    to the Auxiliary parameters of the SNMP config window

    and it saved the changes. However when I try to start the SNMP service it errors.

    Checking my log server I find

    freenas8 snmpd[19756]: error in config file

    I'm not sure why, maybe something changed between versions?

    I am currently running FreeNAS-8.0.1-RC2-amd64 (7813)

    *EDIT*

    Hmmm maybe I am hitting the same problem Durkatlon was having in post #5
  11. Offline

    Durkatlon FreeNAS Aware

    Member Since:
    Aug 19, 2011
    Messages:
    322
    Message Count:
    322
    Likes Received:
    3
    Trophy Points:
    18
    Location:
    San Diego, CA
    Durkatlon, Oct 10, 2011

    The newer builds already have snmp_mibII.so in the default configuration. When you added it to the Aux Params the system detected a duplicate entry and refused to start the SNMP daemon. Just blank out the Aux Params field again and you should be fine. There's some other libraries that are not included by default that you could still enable through this field though.
  12. Offline

    snowmirage

    Member Since:
    Sep 20, 2011
    Messages:
    27
    Message Count:
    27
    Likes Received:
    0
    Trophy Points:
    1
    snowmirage, Oct 10, 2011

    Ahh that explains it thank you.
  13. Offline

    wussy Newbie

    Member Since:
    Jan 11, 2012
    Messages:
    50
    Message Count:
    50
    Likes Received:
    0
    Trophy Points:
    6
    Occupation:
    IT-Junior Manager
    Location:
    Vienna
    Home page:
    wussy, Apr 11, 2012

    Hi,

    I really wan´t to check the system with nagios by snmp. I have the mib2 already linked into the system and it is working. But for what i can see MIB2 only uses Network and some minior things like uptime. Is there a way to expand the possibilities of checks?!
  14. Offline

    bsdasym

    Member Since:
    Jun 6, 2012
    Messages:
    1
    Message Count:
    1
    Likes Received:
    0
    Trophy Points:
    0
    bsdasym, Jun 6, 2012

    Old thread, but what you (probably) want if you're trying to monitor disk usage is this:
    Code (text):
    1.  
    2. begemotSnmpdModulePath."hostres" = "/usr/lib/snmp_hostres.so"
    3.  
    Which will expose the HOST-RESOURCES MIB, which itself has information on filesystems and other stuff.

Share This Page