How to fix GET requests for "usmUserSecurity" in netsnmp? - snmp

snmpget -v 2c -c public myDevice usmUserSecurity
Returns:
SNMP-USER-BASED-SM-MIB::usmUserSecurityName.".q...s...."."__internal__" = STRING: __internal__
instead of NoSuchObject/Instance.
The same behaviour happens for all the other columns in usmUserTable.
Looks like the get requests act as getNext in this case. I am trying to fix this, but I can't seem to find the relevant part of code ( in the net-snmp code base ) which deals with these requests. Can someone assist?

You'd better capture the network packets and then see if the captured packets are special. As Net-SNMP is so "old" and stable, it is least likely that you discover a new bug.

Related

53C94 SCSI IC as target - Cannot handle WRITE(10) command from Initiator

I am building a SD card/SCSI adapter using NCR 53CF94 IC and STM32.
All goes pretty well, even manged to make my device work to some degree, i.e. accepting all basic commands and even booting from it to DOS. BUT i have a problem, when asking initiator (PC) to write something to my device , all goes well i get the block address and the data. Then i write the data to SD card and finally responding with status=0 and message=0 to complete the write command, but the initiaor never increasing the secoor number to continue to write proccess and always tries to write the first one, then after few attempts it gives error on the PC (Error writing to drive...). I can't figure it out why the initiaor is not satisfied with the GOOD status and message. Do i need to send some specific data back to the initiator ? Linke CRC ? Or there is some specific command i need to issue for 53C94 ?
Banging my head for few days now.
Need your assistance please.
Thanks !
Artiom.
I figured it out. I was writing 512 byte blocks to a 256 byte array. I'm not sure how this is related to the issue, but after fixing the size everything started to work.

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.

Siemens MC35 + ATcommand

I would like to do 2 things.
Recognize when someone is calling - In terminal will appear RING and to answer I have to send command ATA. But How can I recognize it when I am doing something else. Should I use new thread and read port until send RING? Is there any beter solution?
What is a symbol of end of response? I'm reading char using for(), but I do not know number of signs. Example below doesn't work properly
while(readCharUART()!=10) {};
while(readCharUART()!=13)
{
getchar() = ..
}
You are on the right track.
For RING then yes, the correct way to do it is to have one thread just read modem responses until you get the Unsolicited result code RING. If you from time to time want to run AT commands (say ATA), then you should let this thread do that as well, e.g. you have one thread that takes care of both issuing AT commands and monitor for UR codes.
Regarding formatting of responses from the modem, this is well described in chapter 5.7.1 Responses in the ITU V.250 standard. Short summary (reading the spec is highly recommended!):
<header>RING<trailer>
where header and trailer is both "\r\n" (unless the modem is configured strangely).

What snmp OID should I watch to see if my printers and switches is up an running

I am new to snmp, and I am trying to figure out what OID's I should get/trap to see if my printers, switches (and servers) is running? I do not need to know the details - just a simple test. I have successfully med get, getbulk, (and walk) request from a device, both from bash and iReasoning MIB browser.
Edit:
Maybe the
.1.3.6.1.2.1.1.3.0
Name/OID: sysUpTime.0; Value (TimeTicks): 194 hours 43 seconds (69844352)
is used for just that!? What happens when something is wrong? -will this be reset immediately? -or will it just stop counting? or is it just the time since last power on?
Printers
You should use the Printer MIBv2 to monitior printer error status for jams...
hrPrinterDetectedErrorState reports printer errors such as low toner, jams, etc... the RFC contains details on what specific codes mean
hrDeviceStatus will reveal the big picture ability of the printer to handle tasks. For more info, see Printer MIBv2, Section 2.2.13.2
sysUpTime.0 is an OID that reports the time a system's SNMP stack has been up (reference RFC 1213: MIB-II). If this value is returned and incrementing, it's a 99% safe bet that a printer is up. Most people use sysUpTime to detect whether the device has rebooted for some reason; if that happens, you'll see a sudden decrease in sysUpTime.0, unless your last value was around 248 days (where a 32-bit counter would roll).
Ethernet Switches
Checking the basic health of ethernet switches is usually done with checks to sysDescr.0 or sysUpTime.0; the problem with this heuristic comes if you care about the up/down status of particular links... at that point, you need to check values from ifOperStatus, which is indexed by ifIndex and uses interface names from ifName. See the following examples...
[mpenning#Hotcoffee ~]$ ## Walk ifName correlated to ifIndex
[mpenning#Hotcoffee ~]$ snmpwalk -v 2c -c Public 172.25.116.6 .1.3.6.1.2.1.31.1.1.1.1
iso.3.6.1.2.1.31.1.1.1.1.1 = STRING: "Fa0/0"
iso.3.6.1.2.1.31.1.1.1.1.2 = STRING: "Nu0"
[mpenning#Hotcoffee ~]$ ## Walk ifOperStatus (up==1)
[mpenning#Hotcoffee ~]$ snmpwalk -v 2c -c Public 172.25.116.6 .1.3.6.1.2.1.2.2.1.8
iso.3.6.1.2.1.2.2.1.8.1 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.2 = INTEGER: 1
[mpenning#Hotcoffee ~]$
Thus we know from the example that both interface "Fa0/0" (index: 1) and "Nu0" (index: 2) have an ifOperStatus of "up"; the index value is the last integer returned in the OID of the results.
Scripting
I assume you will use bash for your monitoring scripts; if so, check out Net-SNMP for your SNMP manager

SNMP - Getting information from a process

I need to setup a process monitor on a number of servers using a monitoring tool called Zenoss. The problem I'm facing is how can I get information on a specific process via SNMP? I'm not familiar with SNMP at all and I'm having trouble finding out what I need.
I've been trying to use a tool called SNMP-Probe but it only seems to give basic system information, nothing that I need or can use.
Any help here is appreciated.
What you need is to query the hrSWRunTable in order to gather the information you need. This MIB gives you a lot of information such as process name, path, type, status, parameters, CPU and RAM usage even though those two informations are stored on another MIB (hrSWRunPerfEntry). However how you do that "query" depends on the environment you're using, I am almost sure that vbs includes an SNMP library.
Here is a example retrieval via NetSnmp from a Linux host. (I would have added this as a comment on the accepted answer from #raz3r, but I wanted ability to format the text!)
snmptable -v2c -Ci -c public myserver HOST-RESOURCES-MIB::hrSWRunTable
SNMP table: HOST-RESOURCES-MIB::hrSWRunTable
index hrSWRunIndex hrSWRunName hrSWRunID hrSWRunPath hrSWRunParameters hrSWRunType hrSWRunStatus
1 1 "init" SNMPv2-SMI::zeroDotZero "/sbin/init" "" application runnable
2 2 "kthreadd" SNMPv2-SMI::zeroDotZero "kthreadd" "" application runnable
3 3 "ksoftirqd/0" SNMPv2-SMI::zeroDotZero "ksoftirqd/0" "" application runnable
// other rows snipped for brevity
I was just working on the same thing
snmpwalk -v2c -c public xxx.xxx.xxx.xxx .1.3.6.1.2.1.25.4.2.1.2
HOST-RESOURCES-MIB::hrSWRunName
Unfortunately, I wasn't able to find out exactly how to do this. I ended up going with a vbs script on each machine to find the misbehaving process and kill it automatically.

Resources