Problems with SNMP(dev)


 
Thread Tools Search this Thread
Top Forums Programming Problems with SNMP(dev)
# 1  
Old 06-29-2011
Problems with SNMP(dev)

Hi all,

I'm trying to develop a aplication in c to get the arp table from a router, i know the OID and using a snmpwalk (shell command) i can get it.
When i tried to code i saw an example but it was with pdu type SNMP_MSG_GET, but it gives an error (no such oid).

i found (with trace) that snmpwalk use a SNMP_MSG_GETNEXT, but when using it i just get the first MAC address without knowing from what ip is...

I can't found a good understandable example with GETNEXT..

Can anyone help? any good example? our know how to do it?



My code (juts the important part, i think):
Code:
pdu = snmp_pdu_create(SNMP_MSG_GETNEXT);

get_node("IP-MIB::ipNetToMediaPhysAddress",id_oid, &id_len);
snmp_add_null_var(pdu,id_oid, id_len);
status=snmp_synch_response(ss_handle, pdu, &response);
for(vars = response->variables;vars;vars=vars->next_variable)
      print_value(vars->name,vars->name_length,vars);

output:
STRING: ca:0:58:c0:0:8



I need something like this (to get the ip/MAC to put it in a DB)....

[root@localhost ~]# snmpwalk -v2c -c public 192.168.56.100 IP-MIB::ipNetToMediaPhysAddress
IP-MIB::ipNetToMediaPhysAddress.1.192.168.56.1 = STRING: 8:0:27:0:cc:e1
IP-MIB::ipNetToMediaPhysAddress.1.192.168.56.100 = STRING: ca:0:6:70:0:8
IP-MIB::ipNetToMediaPhysAddress.1.192.168.56.101 = STRING: 8:0:27:35:5c:da


Many Thanks!

Last edited by jim mcnamara; 06-29-2011 at 06:05 PM..
# 2  
Old 08-30-2011
Bump...Exact same issue
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Changing grub from /dev/sda to /dev/sdb

Hi, Please suggest steps to change grub from /dev/sda to /dev/sdb, (1 Reply)
Discussion started by: manoj.solaris
1 Replies

2. Shell Programming and Scripting

Automating partitioning setup of /dev/sda on /dev/sdc

Objective: To recreate the partitioning setup of /dev/sda on /dev/sdc How would I parse the below information and initialize variables (an array?) that can be used to build sgdisk commands in a script, regardless of the number of partitions? Something along the lines of: sgdisk -n... (12 Replies)
Discussion started by: RogerBaran
12 Replies

3. UNIX for Dummies Questions & Answers

Need to transfer all kernel logs (var/log/messages) to the snmp listener as snmp trap

i am working with embedded system -Dell DCS management sub system. my question is as below: currently we are using linux kernel 2.6.30 build and we have a kernel logs stored to the /var/log/messages path. now we have to transfer all this logs to the specified SNMP target as a part of SNMP... (4 Replies)
Discussion started by: vipul_prajapati
4 Replies

4. Solaris

Lun remove, stuck in /dev/dsk and /dev/rdsk

So, we removed a LUN from the SAN and the system is refusing to remove the references to it in the /dev folder. I've done the following: devfsadm -Cv powermt -q luxadm -e offline <drive path> luxadm probe All those commands failed to remove the path. The drive stills shows up as <drive... (13 Replies)
Discussion started by: DustinT
13 Replies

5. IP Networking

SNMP packet reception problems

server A is forwarding an snmp packets to server B on agreed port. server B is listening but getting nothing on the port. Rather, packets are arriving on a different port. What can i do to receive the packets on the agreed port? (1 Reply)
Discussion started by: kamuvi71
1 Replies

6. Red Hat

Sending data from DELL OMSA SNMP and Custom SNMP MIB to same UDP port 161

Hi , Currently DELL OMSA SNMP sends data through default udp port 161.I want my custom SNMP MIB also to send data in the same udp port 161.Whether its possible.If yes where to configure .I tried starting my custom MIB in udp port 161,but it throws port already in use.Kindly guide. (1 Reply)
Discussion started by: prabakar4all
1 Replies

7. IP Networking

Sending data from DELL OMSA SNMP and Custom SNMP MIB to same UDP port 161

Hi , Currently DELL OMSA SNMP sends data through default udp port 161.I want my custom SNMP MIB also to send data in the same udp port 161.Whether its possible.If yes where to configure .I tried starting my custom MIB in udp port 161,but it throws port already in use.Kindly guide. (0 Replies)
Discussion started by: prabakar4all
0 Replies

8. Infrastructure Monitoring

problems with Net-snmp to use with Nagios Check_hpjd

In order to get the Check_hpjd plugin for nagios to work, i have to get net-snmp (+utils) installed. If i look in the yast Control center, iwe installed everything that should have something to do with snmp. This is my first time with linux, so im abit of a noob. how do i get the plugin... (0 Replies)
Discussion started by: Nikos
0 Replies

9. SCO

Xenix Problems - No space on dev 1/40

Hello - I'm a newbie to these forums. Please excuse me if I am posting in the wrong area. My dilemma. The HD on our ancient Xenix system apparently is full. I receive the "no space on dev 1/40" prompt. This occurred after I attempted to purge some unwanted files. This system runs our small... (1 Reply)
Discussion started by: gmbrickley
1 Replies

10. Solaris

What is /dev/tty /dev/null and /dev/console

Hi, Anyone can help My solaris 8 system has the following /dev/null , /dev/tty and /dev/console All permission are lrwxrwxrwx Can this be change to a non-world write ?? any impact ?? (12 Replies)
Discussion started by: civic2005
12 Replies
Login or Register to Ask a Question