[Hampshire] Deciding SNMP MIB files in Linux
Hi, I'm trying to write some software to remote control some SNMP-driven gear at work. The manufacturer has sent me the MIBs for the gear concerned but instead of one file, there is a whole folder of interdependent MIBs. I want to make a list of every OID in the device so I can write a driver. I found the following example command which I thought would list the OIDs snmptranslate -M . -m ALL -Of -Tl This produces a stream of correct-looking OIDs but they only seem to belong to the first file in the folder. Is there anyone that can help me work out how to get a complete listing of every OID described in the folder please? Thanks, Paul. -- Sent from my Android phone with K-9 Mail. Please excuse my brevity.-- Please post to: Hampshire@mailman.lug.org.uk Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire LUG URL: http://www.hantslug.org.uk --
Re: [Hampshire] Deciding SNMP MIB files in Linux
Are you certain that every UID in the folder exists on the device? -- We're looking for smart Linux people: http://www.tiger-computing.co.uk/jobs -- Please post to: Hampshire@mailman.lug.org.uk Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire LUG URL: http://www.hantslug.org.uk --
Re: [Hampshire] Deciding SNMP MIB files in Linux
On Sep 12, 2012 8:33 PM, "Paul Stimpson" wrote: > > Hi, > > I'm trying to write some software to remote control some SNMP-driven > gear at work. The manufacturer has sent me the MIBs for the gear > concerned but instead of one file, there is a whole folder of > interdependent MIBs. > > I want to make a list of every OID in the device so I can write a > driver. I found the following example command which I thought would list > the OIDs > > snmptranslate -M . -m ALL -Of -Tl > > This produces a stream of correct-looking OIDs but they only seem to > belong to the first file in the folder. > > Is there anyone that can help me work out how to get a complete listing > of every OID described in the folder please? > I think it would be easier if you posted a tar file of all the mib files somewhere. Mibs are hierarchical so all the files should link to the first one. Think of them as leaves on a tree. -- Please post to: Hampshire@mailman.lug.org.uk Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire LUG URL: http://www.hantslug.org.uk --
Re: [Hampshire] Deciding SNMP MIB files in Linux
On 12/09/2012 20:33, Paul Stimpson wrote: > > I want to make a list of every OID in the device so I can write a > driver. I found the following example command which I thought would list > the OIDs If you want to list every object that the device supports, then you can simply use snmpwalk to query the device, which will walk through the entire structure. If the MIB files are where the SNMP tools can find them, snmpwalk will automatically convert the numerical OIDs into the correct named format. Chris -- Chris Smith signature.asc Description: OpenPGP digital signature -- Please post to: Hampshire@mailman.lug.org.uk Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire LUG URL: http://www.hantslug.org.uk --
Re: [Hampshire] Deciding SNMP MIB files in Linux
Hi Keith, Keith Edmunds wrote: >Are you certain that every UID in the folder exists on the device? The device is a multimedia receiver (primarily a satellite receiver but there are options such as an IP input for decoding streamed media over a network). There are also software options that can be activated after purchase with license codes but I've never seen a device with all of them purchased. I don't know if every UID in the tree exists on the device but some of them certainly will have no valid meaning as all the options can't be present because some of them are mutually exclusive (such as the satellite and network inputs as these are hardware options and occupy the same physical module slot in the unit). However, I don't know whether the unit will respond with an error or with an dummy value such as zeros if you ask for the satellite tuner frequency for a device with the IP input installed. I've not got to the stage of interacting with a device yet so I don't think the existence of the UIDs is relevant at this stage. The only documentation I can find is the text in the MIB files so my first task is to try to parse the files and print out the names, numbers and text for each UID so I can find the relevant entries. Thanks, Paul. -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. -- Please post to: Hampshire@mailman.lug.org.uk Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire LUG URL: http://www.hantslug.org.uk --
Re: [Hampshire] Deciding SNMP MIB files in Linux
James Courtier-Dutton wrote: >I think it would be easier if you posted a tar file of all the mib files >somewhere. Unfortunately, these files were obtained from the device manufacturer under my customer's service agreement. I will check but I believe they are redistribution-restricted. >Mibs are hierarchical so all the files should link to the first one. >Think >of them as leaves on a tree. > one of the devices is called an "RX1290" so I'm guessing then that the file in the package called "rx1290.mib" (or maybe the one called "base.mib") might be a good place to start. I'm not finding the snmptranslate man page very easy going. it looks like I need to find out how to indicate to it which file is the first I want it to parse. Thanks, Paul. -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. -- Please post to: Hampshire@mailman.lug.org.uk Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire LUG URL: http://www.hantslug.org.uk --
Re: [Hampshire] Deciding SNMP MIB files in Linux
> Unfortunately, these files were obtained from the device manufacturer > under my customer's service agreement. I will check but I believe they are > redistribution-restricted. They are. > one of the devices is called an "RX1290" so I'm guessing then that the > file in the package called "rx1290.mib" (or maybe the one called > "base.mib") might be a good place to start. I'm currently working on SNMP on the RX8200, which is the successor to the RX1290. There's a limit to what I can tell you (customer confidentiality), but I might be able to help at some point. > I'm not finding the snmptranslate man page very easy going. it looks like > I need to find out how to indicate to it which file is the first I want it > to parse. My immediate recommendation would be to get hold of snmpb - it's available on sf.net. I know going to a GUI browser is something of a cop-out, but it's made my ilfe a whole lot easier. Probably best to stay away from pysnmp too - it has "interesting" features when you try to fetch OIDs that aren't in its current set of MIBs (and requires a translation to get "standard" MIB files into it). Vic. -- Please post to: Hampshire@mailman.lug.org.uk Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire LUG URL: http://www.hantslug.org.uk --
Re: [Hampshire] Deciding SNMP MIB files in Linux
On 13 September 2012 08:23, Paul Stimpson wrote: > > > James Courtier-Dutton wrote: > > >>I think it would be easier if you posted a tar file of all the mib files >>somewhere. > > Unfortunately, these files were obtained from the device manufacturer under > my customer's service agreement. I will check but I believe they are > redistribution-restricted. Well, I can't really help much then. SNMP is quite a complex set of standards, and without seeing the .mib files, it is difficult to see what is missing. > > >>Mibs are hierarchical so all the files should link to the first one. >>Think >>of them as leaves on a tree. >> > You might be missing all the RFC mibs. Think of these as the trunk of the tree, and without them you cannot put any leaves on it. > one of the devices is called an "RX1290" so I'm guessing then that the file > in the package called "rx1290.mib" (or maybe the one called "base.mib") might > be a good place to start. > > I'm not finding the snmptranslate man page very easy going. it looks like I > need to find out how to indicate to it which file is the first I want it to > parse. > You should normally just be able to give the tool the directory name where all the mibs are. It should then compile them, and work out which leaf goes where, so long as the trunk (rfc mibs) are there. For example, this is what wireshark does so that it can decode snmp packet captures. Kind Regards James -- Please post to: Hampshire@mailman.lug.org.uk Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire LUG URL: http://www.hantslug.org.uk --
Re: [Hampshire] Deciding SNMP MIB files in Linux
Ah, someone facing the same issues as I am. SNMP is as far as I'm concerned a dogs breakfast. If you have multiple Mibs in a file just watchout as the MIB standard allows you to put the trap definitions anywhere in the mib (AFAIK). Thus you could have no idea about what traps relate to what MIB. Some devices don't emit traps. You have to Poll them and that opens up another huge can of worms. After a few days of banging my head against the QAIA Airport brick wall, I gave up trying to decipher some of the Mibs and traps using Linux and have installed a trial version of TrapVision on a Windows machine. Now I can see a lot of what is supposed to happen. You can also use it to generate traps that can be sent into your Linux system for processing. I'd rather be interpreting IATA Type-B messages any day. Stephen Davies -- Please post to: Hampshire@mailman.lug.org.uk Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire LUG URL: http://www.hantslug.org.uk --
Re: [Hampshire] Deciding SNMP MIB files in Linux
On 13/09/2012 08:06, Paul Stimpson wrote: > > Keith Edmunds wrote: > >> Are you certain that every UID in the folder exists on the device? > > The device is a multimedia receiver (primarily a satellite receiver > but there are options such as an IP input for decoding streamed media > over a network). There are also software options that can be > activated after purchase with license codes but I've never seen a > device with all of them purchased. > > I don't know if every UID in the tree exists on the device but some > of them certainly will have no valid meaning as all the options can't > be present because some of them are mutually exclusive (such as the > satellite and network inputs as these are hardware options and occupy > the same physical module slot in the unit). However, I don't know > whether the unit will respond with an error or with an dummy value > such as zeros if you ask for the satellite tuner frequency for a > device with the IP input installed. If the device doesn't support a particular OID, you will get a meaningful error to that effect. What happens if the device does support an OID but has no meaningful data to pass back is largely implementation dependent, but should at least follow the data semantics given in the MIB. Regards, Chris -- Chris Smith signature.asc Description: OpenPGP digital signature -- Please post to: Hampshire@mailman.lug.org.uk Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire LUG URL: http://www.hantslug.org.uk --
Re: [Hampshire] Deciding SNMP MIB files in Linux
On 13/09/2012 08:23, Paul Stimpson wrote: > > I'm not finding the snmptranslate man page very easy going. it looks > like I need to find out how to indicate to it which file is the first > I want it to parse. No, not at all. The purpose of snmptranslate is simply to translate a numeric OID into a textual name -- effectively doing a reverse lookup. It is useful because it uses the same core library as the rest of the snmp tools, so can be used to verify that your MIB is valid and is being used. The snmp tools need to know: a) where to look for MIB files; and b) which MIBs you specifically want to load. You can give this information on the commandline using the -M and -m options, respectively, but I prefer to do it using the environment using the MIBDIRS and MIBS variables, respectively. Bear in mind that MIBDIRS overrides the compiled-in default location, so if you use it you need to specify the full path list. As an example, using a Debian distribution: $ export MIBDIRS=/usr/share/snmp/mibs:/home/cjs94/MIBS $ export MIBS=+ALL $ snmptranslate 1.3.6.1.4.1 SNMPv2-SMI::enterprises The above will load all MIB files found in the path list and use them to map numeric OIDs to names and vice-versa. Once snmptranslate works for you, the other tools will work too. Also bear in mind that the MIB files usually specify more than just OID mappings. They also specify data formats and the semantics of the data, and snmptranslate will translate those too. If an integer value of 1 for a given OID means 'Online' and that has been specified in the MIB, snmptranslate will translate that back and forth too. I recommend looking at net-snmp.org (the home of the snmp* tools) and the associated mailing list. There's a wealth of information there. Regards, Chris -- Chris Smith signature.asc Description: OpenPGP digital signature -- Please post to: Hampshire@mailman.lug.org.uk Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire LUG URL: http://www.hantslug.org.uk --
Re: [Hampshire] Deciding SNMP MIB files in Linux
On 13/09/2012 13:23, Stephen Davies wrote: > Ah, someone facing the same issues as I am. SNMP is as far as I'm > concerned a dogs breakfast. If you have multiple Mibs in a file just > watchout as the MIB standard allows you to put the trap definitions > anywhere in the mib (AFAIK). Thus you could have no idea about what > traps relate to what MIB. Traps are supposed to be extensible. The OID of the trap essentially tells you what event has happened, but the supporting data contained in the varbind can come from anywhere in the MIB tree -- for example you might want to include system.sysUpTime.0. It wouldn't make sense to have to implement sysUpTime for each different trap. > Some devices don't emit traps. You have to Poll them and that opens up > another huge can of worms. Such as? > After a few days of banging my head against the QAIA Airport brick wall, > I gave up trying to decipher some of the Mibs and traps using Linux and > have installed a trial version of TrapVision on a Windows machine. Now I > can see a lot of what is supposed to happen. You can also use it to > generate traps that can be sent into your Linux system for processing. > > I'd rather be interpreting IATA Type-B messages any day. I think you're being a little harsh, but then perhaps I've just had a better experience with it! :) Regards, Chris -- Chris Smith signature.asc Description: OpenPGP digital signature -- Please post to: Hampshire@mailman.lug.org.uk Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire LUG URL: http://www.hantslug.org.uk --
Re: [Hampshire] Deciding SNMP MIB files in Linux
Chris, I think you have had a better experience with SNMP than I am currently having. You asked about the 'can of worms' relating to Polling for SNMP Traps. The IPTV devices we are polling sometimes don't even respond within 30 seconds. Nasty. The 5 servers are supposed to respond with the same data. They don't. Why? They are running different firmware and the supplier is very very very reluctant to make them identical. Another SNMP emitter has been configured incorrectly. To get it fixed, a guy will have to come from Bahrain. He will remove the unit and then ship it to India where sometime in the next month they might possibly correct the problem, ship it back and we can try again. Not a happy bunny especially as it is the weekend here and I'm stuck in the basement of the airport wearing ear defenders trying to keep the incessant fire alarms from slowly driving me mad. And so it goes on. Stephen Davies -- Please post to: Hampshire@mailman.lug.org.uk Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire LUG URL: http://www.hantslug.org.uk --
Re: [Hampshire] Deciding SNMP MIB files in Linux
On 14/09/2012 10:57, Stephen Davies wrote: > Chris, > I think you have had a better experience with SNMP than I am currently > having. > You asked about the 'can of worms' relating to Polling for SNMP Traps. I don't mean to pick nits, but you don't poll for traps. Traps are sent by the device without being requested; you poll for data by sending 'get' requests to the device with the OIDs you want it to return. The communications channel is different for the two mechanisms: get/set requests are sent to the device usually on port 161, traps are sent from the device to the configured recipient usually on port 162. > The IPTV devices we are polling sometimes don't even respond within 30 > seconds. Nasty. Are you sure the network is reliable, bearing in mind SNMP usually uses UDP, which is unreliable? > The 5 servers are supposed to respond with the same data. They don't. > Why? They are running different firmware and the supplier is very very > very reluctant to make them identical. > Another SNMP emitter has been configured incorrectly. To get it fixed, a > guy will have to come from Bahrain. He will remove the unit and then > ship it to India where sometime in the next month they might possibly > correct the problem, ship it back and we can try again. > > > Not a happy bunny especially as it is the weekend here and I'm stuck in > the basement of the airport wearing ear defenders trying to keep the > incessant fire alarms from slowly driving me mad. It certainly doesn't sound pleasant and I sympathise, but to be fair the issues you raise seem to be with the devices and the suppliers. Nothing you've said so far is really the fault of SNMP. Regards, Chris -- Chris Smith signature.asc Description: OpenPGP digital signature -- Please post to: Hampshire@mailman.lug.org.uk Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire LUG URL: http://www.hantslug.org.uk --
Re: [Hampshire] Deciding SNMP MIB files in Linux
Hi, I'd like to start by saying "Thank you" to everyone for your valuable contributions so far :) On 13/09/12 08:44, Vic wrote: My immediate recommendation would be to get hold of snmpb - it's available on sf.net. I know going to a GUI browser is something of a cop-out, but it's made my ilfe a whole lot easier. Probably best to stay away from pysnmp too - it has "interesting" features when you try to fetch OIDs that aren't in its current set of MIBs (and requires a translation to get "standard" MIB files into it). Vic. Thanks. I will give that a try this evening. All the best, Paul. -- Please post to: Hampshire@mailman.lug.org.uk Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire LUG URL: http://www.hantslug.org.uk --
Re: [Hampshire] Deciding SNMP MIB files in Linux
On 13/09/12 09:56, James Courtier-Dutton wrote: Mibs are hierarchical so all the files should link to the first one. Think of them as leaves on a tree. You might be missing all the RFC mibs. Think of these as the trunk of the tree, and without them you cannot put any leaves on it. snmptranslate did pop some errors to stderr about not being able to find SNMPv2-SMI.mib and SNMPv2-TC.mib. I found dumps of those on a random website and the output is better but there are still a couple of errors (missing brackets and "can't adopt" errors mainly) but I can't see anything obviously broken with the files. Where would be the "proper" place to get real copies of all the RFC MIBs please? one of the devices is called an "RX1290" so I'm guessing then that the file in the package called "rx1290.mib" (or maybe the one called "base.mib") might be a good place to start. I'm not finding the snmptranslate man page very easy going. it looks like I need to find out how to indicate to it which file is the first I want it to parse. You should normally just be able to give the tool the directory name where all the mibs are. It should then compile them, and work out which leaf goes where, so long as the trunk (rfc mibs) are there. For example, this is what wireshark does so that it can decode snmp packet captures. The files are (usefully) named after which functional category of the device's control they describe. All the OIDs listed by snmptranslate seem to be relevant to the category described by the first file in the directory. I'm guessing I'm either not using snmptranslate right or that one of these errors is causing it to abort and not go on to the rest of the files. Thanks, Paul. -- Please post to: Hampshire@mailman.lug.org.uk Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire LUG URL: http://www.hantslug.org.uk --
Re: [Hampshire] Deciding SNMP MIB files in Linux
On 14/09/12 09:12, Chris Smith wrote: If the device doesn't support a particular OID, you will get a meaningful error to that effect. What happens if the device does support an OID but has no meaningful data to pass back is largely implementation dependent, but should at least follow the data semantics given in the MIB. Thank you. Once I get to talk to a real device I'll try some tests. All the best, Paul. -- Please post to: Hampshire@mailman.lug.org.uk Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire LUG URL: http://www.hantslug.org.uk --