how to use SNMP - snmp

I have some linux servers which will work as SNMP agents. I need to use Java and SNMP4J to monitor these servers (agents), and also the SNMP manager must be able to check upon these servers.
How to implement SNMP in the SNMP agent to respond to the queries from SNMP manager?
What is the usage of MIB file? If I hardcode the values in the MIB file, does it mean that I don't need to parse the MIB file?
String product = "1.2.3.1.2.3.6421"
String productmgr = "1.2.3.1.2.3.6421.4"

There are some SO questions that should help.
For #1 look at Getting started with SNMP4J
For #2 you can indeed hardcode OIDs; but that would only work for a trivial scenario, there are many questions regarding MIBs e.g. question about SNMP MIB file

In order to implement SNMP agent on client side, after installing snmp , just execute snmp commands to communicate with the manager.
The Management Information Base (MIB) is a virtual information storage area for network management information, which consists of collections of managed objects. Within the MIB there are collections of related objects, defined in MIB modules. MIB modules are written in the SNMP MIB module language, as defined in STD 58, RFC 2578, RFC 2579, and RFC 2580.
Of course you can hardcode some OIDs in SNMP MIB. But in most of the cases it will not be stable. Even if you hardcode the values in the MIB file, then again you need to reparse the same.

Related

How to add SNMP masks through an MIB Browser?

Do all MIB browsers have a provision to add SNMP masks? Specifically, does the ManageEngine MIB Browser Free Tool allow for adding SNMP masks?
If you were referring to the family mask, part of SNMP VACM, then you should check the specification of the MIB Browser you are using.
As long as the product claims to fully support RFC 3415, then it should support family mask feature.
But this really depends on the vendors.

Reading, interpreting and exporting SNMP messages

I'm trying to wrap my head around how to use SNMP in my networks. It's for industrial applications, networks with 200-800 IPs, but many quirks and security layers.
What I'd like to do is catch any traps, and periodically read parameters, over SNMP for all my network equipment. It will be sent to an external system for storage and viewing.
I understand now that even though my equipment uses the SNMP standards, the same OIDs can sometimes mean different things, and I then have to get all the MIB files from the vendors.
I find many parsers that can give me information from within the MIBs, but what I need is a whole system for importing MIBs, adding them to some kind of library, and for me to know which devices are currently supported by my library. Then, when I receive a message, I need the system to figure out what equipment has sent that, look up the correct info from the MIB and construct an alarm message based on that.
Is there any solution today that can take a list of IPs and send SNMP-get messages to all of those?
Do I need any setup just to receive SNMP traps, or will they just be
attempted delivered at the specified IP address, and I need only to
listen at the correct port?
Is there any way to parse all those MIBs and turn them into a manageable library?
How do I associate the devices with the info from the MIBs, so I interpret the information correctly?
I want to make a general solution for this, so I can expand it to more devices and vendors easily later. Below is a sketch of how a typical network would look like, but of course with a lot more components in real life. Hope someone has some good input.

SNMP in context of SDN

SNMP is generally used to monitor the health of components in network.
For SDN [Software Defined network], is it desirable to use SNMP . I am having doubt like is it better to use some other protocol like NETCONFIG
In general SNMP can be used for configuration of a device, however personally I will not stretch it too far specifically when network configuration operation potentially spans across multiple devices and as a result will have higher order transaction requirements.
RFC3512 provides good perspective around configuration using SNMP. Reading through the RFC it will become apparent that within a device transaction relies on how well the MIBs (the objects used via SNMP for performing configuration changes) are designed and implemented. For configuration spanning across multiple devices the device transaction alone will not suffice, if rolling back the configuration is a requirement (this depending on the nature of service/use-case being addressed by your SDN controller). I would recommend reading the Transaction Control in MIB Objects further to understand the requirements on the protocol and eventually the capabilities of the MIB modules that one will be using for configuration.
Netconf was created with configuration of devices in mind and it offers various capabilities that are of use in this regard. These are covered in detail in the IETF standard for Netconf Protocol RFC under Capabilities section. The capabilities such as Candidate Configuration, Validate Configuration, Confirmed Commit, Rollback on Error and other such are specified in the standard which shall further aid in orchestration of a transaction across multiple device.

If I include a mib in snmp view ? Only that included mib will be available for polling,?

I am new to SNMP.
I am having a doubt in snmp view configuration in router.
What all the mibs will be included by default for polling in snmp v3 ?
If I include a mib in snmp view ? Only that included mib will be available for polling? All the other mibs will not be able to poll ?
The SNMP VACM subsystem of SNMPv3 is designed to restrict access to certain MIB tree branches. So yes your assumptions are correct.

How to monitor Windows CPU and fan temperature by SNMP or other ways

I want to monitor 3 kinds of data for windows machines:
cpu temperature,
fan temperature
and fan speed, retrieving these data every 5 minutes. If these data can be retrieved by SNMP, that's my first choice.
I am wondering whether these data's root data source comes from Microsoft or the vendor of the motherboard. If they come from Microsoft, their OID should starts with 1.3.6.1.4.1.311, if they come from motherboard vendor, their OID should starts with 1.3.6.1.4.1.[motherboard vendor private snmp vendor OID], for example 1.3.6.1.4.1.11 for a HP server machine, 11 represents HP's private snmp vendor OID.
If you simply want to know how to query a Windows machine for the relevant SNMP data, this is possibly not the right site to ask this question on as it is a site for Q&A specific to software development. You may have better success asking at Server-Fault - here is a similar question to yours on there.
The OIDs for hardware specific SNMP monitoring are usually vendor specific. Typically you would need the Management Information Base (MIB) files that apply to your specific hardware in order to extract the information about which OIDs pertain to the data you require - as far as I know, CPU and Fan temperature are not generic SNMP properties.
If you cannot find the MIBs for your hardware sets (or there is no SNMP agent for your specific hardware), there is a piece of Windows software called SpeedFan that has an SNMP plugin that allows you to monitor the CPU and fan temperatures via SNMP. However this would require the Speedfan software to run in the background on all machines you wish to monitor. The OIDs for the SpeedFan software SNMP plugin are:
Temperature: .1.3.6.1.4.1.30503.1.5.x
Fans: .1.3.6.1.4.1.30503.1.6.x
Voltages: .1.3.6.1.4.1.30503.1.7.x
To get started monitoring this SNMP data on a Windows client machine you typically would need to:
install SNMP agent service
configure the SNMP service
Install speedfan
Install the Speedfan SNMP plugin
determine which OIDs are pertinent to your hardware (either using SpeedFan or vendor specific MIBs)
use an SNMP tool to perform an SNMP walk or an SNMP get to fetch the relevant SNMP data.
Using the command-line tool netsnmp you can walk the SNMP tree like so:
snmpwalk -v 2c -c public 127.0.0.1 .1.3.6.1.4.1.30503.1.5
(Assuming that your community string is "public" and you want to walk the "SpeedFan termperatures" sub-tree of your machine in this example).
A handy client tool with a gui for viewing snmp data is mibbrowser
The linked to Server-Fault Q&A has other useful information and links to various SNMP monitoring software solutions such as nagios, opennms etc.

Resources