SNMP Walk without specifying oid in Polycom device - snmp

I would like to do an snmp walk on a Polycom device.But I don't know the oid of the root node from where the walk must be started.By walking without specifying an oid i am getting no result.How can I get the oid of the root node for starting the snmp walk.
The root oid for the Polycom device is .1.3.6.1.4.1.2684. Is there any way to dynamically identify the root oid of an snmp device, so that we can start walk from that oid

Simply use .1.3 as starting point. This is the root element of 99.9% MIB files.

You can use . or 0.0 as starting point, at least if you using snmpwalk command from net-snmp utils. Also you can use sysObjectID (1.3.6.1.2.1.1.2) to get system oid for specific device, but only if your device supports system branch.

Related

How to find out physical slot number of a PCI(E) device with system calls?

I'd like to find a way to figure out physical slot of a PCI-E device from the bus address. I would like to use to modify a driver/kernel module, so it would enumerate the devices (with the same ID) and disambiguate the device files according to physical slot. Like /dev/device_physslot . The driver will run on Ubuntu 18
lspci is capable to show physical slot number in the verbose presentation
However, as I found out, it accomplishes it over sysfs, which cannot be accessed from kernel module.
So I need to do it somehow with system calls.
Or perhaps it is possible to figure out, where sysfs gets /sys/bus/pci/slots/slot_num/address property?

Format of snmpwalk instruction

I'm working with SNMP and was given a command to use. However, I'm trying to break it down into its components so I can understand if I need to change anything. I've found documentation on pretty much everything except for the last part.
The command has this structure:
snmpwalk -v 2c -c communityname address.com .1
From my understanding the meaning of this structure is:
snmpwalk - command
-v 2c - specifies that the version is 2c, options are 1, 2c, 3
-c communityname - specifies the community name, which is like a password to an extent
address.com - the address of the computer in question
.1 - What is this ? I can't seem to find much documentation on it.
man snmpwalk and snmpwalk -h should give you the info you need on the various parameters.
The .1 is the OID and it is an optional parameter to that command, and it pinpoints a point in the hierarchical SNMP MIB on the SNMP agent host. The walk will retrieve all OIDs "below" that point.
Have a read at http://www.net-snmp.org and get a SNMP book to learn about SNMP and MIBs and OIDs; but quoting from SNMP wikipedia article:
SNMP itself does not define which information (which variables) a
managed system should offer. Rather, SNMP uses an extensible design,
where the available information is defined by management information
bases (MIBs). MIBs describe the structure of the management data of a
device subsystem; they use a hierarchical namespace containing object
identifiers (OID). Each OID identifies a variable that can be read or
set via SNMP.
EDIT: Here is image to show the OID tree with ".1" i.e. ISO just below the root.

Getting USB data for OS X /dev/tty.* entry

I am trying to (programatically in Java, though running external scripts is a possibility) get the USB idProduct, idVendor and ideally the string descriptors for the manufacturer and product for a USB device.
The device has (and it is all I am provided with in the beginning) a /dev/tty.usbmodem entry, and I need some way to reliably map that back to the USB information, but I can't find anything that relates one to the other (or rather I don't know where to look).
The device in question has the /dev entry of:
crw-rw-rw- 1 root wheel 10, 2 18 Jul 15:08 /dev/tty.usbmodem9f31
system_profiler gives me the following USB information for the device:
<dict>
<key>_name</key>
<string>Stk500v2</string>
<key>a_product_id</key>
<string>0xa662</string>
<key>b_vendor_id</key>
<string>0x0403 (Future Technology Devices International Limited)</string>
<key>c_bcd_device</key>
<string> 1.80</string>
<key>e_device_speed</key>
<string>full_speed</string>
<key>f_manufacturer</key>
<string>www.cpustick.com</string>
<key>g_location_id</key>
<string>0x9f300000</string>
<key>h_bus_power</key>
<string>500</string>
<key>j_bus_power_used</key>
<string>500</string>
</dict>
I can see the prefix of 0x9f3 for the g_location_id matching the start of the dev entry's suffix of 9f31, but I don't know a) how reliable that would be, and b) what the "1" would represent at the end, and how that would be affected by having multiple of the same device on the same bus, and how you would differentiate between them.
I have other devices I need to do this with as well, and they don't all follow the same naming rules. One of them uses the USB serial number field for the suffix. Other potential ones (that I don't have control over at all) could do it differently again I guess.
So basically I need some way of mapping the textual device name /dev/tty.whatever to a physical USB device entry that I can then pull the data I need from. On Linux I do it by traversing the /sys tree from /sys/class/tty through to /sys/devices/pci...blahblah/usb[x]/wherever but I can find no similar facility on OS X.
You can use IOKit to get the USB vendor ID and product ID of a serial port on Mac OS X.
Also, there is a library called libserialport that you could use:
http://sigrok.org/wiki/Libserialport

What are the sysLocation and sysContact objects in snmpd.conf?

I am trying to configure SNMP on Ubuntu 14.04. There is a step where I have to edit the community string along with sysLocation and sysContact but I am not sure what goes there. What are the sysLocation and sysContact objects in the snmpd.conf file and how I can get those values for my machine?
All SNMP devices share the following common configurable parameters:
sysLocation
sysContact
sysName
Read-write and read-only access
community strings (and frequently, a trap community string)
Trap destination
sysLocation is the physical location for the device being monitored. Its definition in RFC 1213 is:
sysLocation OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..255))
ACCESS read-write
STATUS mandatory
DESCRIPTION
"The physical location of this node (e.g., 'telephone closet,
3rd floor')."
::= { system 6 }
RFC 1213's definition of sysContact is similar to that of sysLocation:
sysContact OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..255))
ACCESS read-write
STATUS mandatory
DESCRIPTION
"The textual identification of the contact person for this managed
node, together with information on how to contact this person."
::= { system 4 }
sysContact is a DisplayString. It's fairly obvious what it's used for: it identifies the primary contact for the device in question. It is important to set this object with an appropriate value, as it can help your operations staff determine who needs to be contacted in the event of some catastrophic failure. You can also use it to make sure you're notified, if you're responsible for a given device, when someone needs to take your device down for maintenance or repairs. As with sysLocation, make sure to keep this information up to date as your staff changes. It's not uncommon to find devices for which the sysContact is someone who left the company several years ago.
source: http://docstore.mik.ua/orelly/networking_2ndEd/snmp/ch07_01.htm
SysLocation and SysContact are simply arbitrary SNMP string variables that are part of SNMPV2-MIB and can be fetched with SNMP get.
OID 1.3.6.1.2.1.1.4 == SysContact
OID 1.3.6.1.2.1.1.6 == SysLocation
Most sites I have been involved with use SysLocation as a decription of the location of the SNMP managed network device, and SysContact as the contact details of somebody who is in some way responsible for the device.
Warning: SysContact also has a habit of becoming out of date without being modified when staff changes.
To get sysContact using snmpget command line:
snmpget -v1 -c public localhost system.sysContact.0
where "public" is your community string, and "localhost" is the ip address of the machine you want to send the SNMP query to.
These values are defined by the administrator. Common formats include:
syslocation Rack, Room, Building, City, Country [GPSX,Y]
syscontact Your Name <your#email.address>
If all the equipment you monitor is in the same country you can use the format google maps uses: "street, city, state zip". For example searching google maps for the white house returns:
1600 Pennsylvania Ave NW, Washington, DC 20500
syslocation is often used my monitoring applications to generate visual maps.

SNMP OID for getting manufacturer serial number with SNMP version 1

I'm unable to get the manufacturer serial number when I do an SNMP get on an OID .2.47.1.1.1.1.11.1.0. If I do an snmpget with the below command on the OID with the command:
snmpget -v1 -c public 192.168.4.99 .2.47.1.1.1.1.11.1.0
I get the message:
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: joint-iso-ccitt.47.1.1.1.1.11.1.0
I did search on google for the possible cause of error by going to this SO thread as it is caused by missing the instance subidentifier.
I performed an SNMPtranslate for the OID and I got the below string joint-iso-ccitt.47.1.1.1.1.11.1.0.
And when I performed an snmpwalk on the OID by the below command i get the message as END OF MIB.
snmpwalk -v1 -c public 192.168.4.1 .2.47.1.1.1.1.11.1.0
Please let me know where I'm going wrong and let me know the exact generic OID to get the manufacturers serial number.
Who tells you the OID is .2.47.1.1.1.1.11.1.0?
Seriously speaking, a normal OID starts with .1, except .0.0 which is very special.
If you start with walking the top of the MIB tree, you'll soon find out which variables your equipment supports:
snmpwalk -v1 -c public -Ont 192.168.4.1 .1
Remove the "-Ont" to get translated names, where possible, instead of the fully numeric OIDs.
If you're looking for vendor-independent data, you could look into a MIB that most equipment supports, SNMPV2-MIB:
http://www.ietf.org/rfc/rfc3418.txt
However, you'll find it does not contain any serial number variable. Most vendors provide a vendor-specific (or product-specific) MIB which will define, among other things, serial number. However, like most things in SNMP, it's entirely up to each vendor which MIBs they choose to implement.

Resources