Problem solved:
The OID was not accessible because of insuficient user permissions. Giving more
permissions solved the Problem.
Nobody helped me i solved it myself :(
----- Original Message -----
From: Martin
To: [email protected]
Sent: Thursday, September 10, 2009 6:18 PM
Subject: SubAgent Tutorial Problem
Sorry, the first mail was digitally signed. this one is not.
Hi,
i am using Ubuntu 9.04
i want to add snmp functionality to a programm i wrote earlier so i tried the
subagent tutorial.
http://net-snmp.sourceforge.net/wiki/index.php/TUT:Writing_a_Subagent
But that does not work. I only get the error message:
u...@laptop-amd:~$ snmpget -v 2c -c public localhost
1.3.6.1.4.1.8072.2.4.1.1.2.0
NET-SNMP-MIB::netSnmp.2.4.1.1.2.0 = No Such Object available on this agent at
this OID
But one after the other:
What i have done:
First i installed
sudo apt-get install snmp
sudo apt-get install snmpd
sudo apt-get install tkmib
then i configured snmpd by editing snmpd.conf:
Start of file
#v2 access rights
com2sec paranoid default public
com2sec readwrite default private123
#v3 access rights
group MyROSystem v1 paranoid
group MyROSystem v2c paranoid
group MyROSystem usm paranoid
group MyROGroup v1 readonly
group MyROGroup v2c readonly
group MyROGroup usm readonly
group MyRWGroup v1 readwrite
group MyRWGroup v2c readwrite
group MyRWGroup usm readwrite
view all included .1 80
view system included .iso.org.dod.internet.mgmt.mib-2.system
access MyROSystem "" any noauth exact system none none
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none
#infos
syslocation Unknown (configure /etc/snmp/snmpd.local.conf)
syscontact Root <r...@localhost> (configure /etc/snmp/snmpd.local.conf)
#enabling agentx functionality
master agentx
End Of file
agenty configuration corect? or more needed?
The snmpd service works
u...@laptop-amd:~$ snmpget -v 2c -c public localhost .1.3.6.1.2.1.1.5.0
SNMPv2-MIB::sysName.0 = STRING: Laptop-AMD
otherwise i wouldn't get the answer: Laptop-AMD
wireshark confirms that, i see a request packet and a response packet.
Then i downloaded NET-SNMP-TUTORIAL-MIB.txt and copied it to
/usr/share/snmp/mibs/
Test:
u...@laptop-amd:~$ snmptranslate -IR -On nstAgentSubagentObject
Unknown object identifier: nstAgentSubagentObject
u...@laptop-amd:~$ snmptranslate -m +NET-SNMP-TUTORIAL-MIB -IR -On
nstAgentSubagentObject
.1.3.6.1.4.1.8072.2.4.1.1.2
the second command gives the corect answer so the file is in the corect folder
I created a folder "agentx" on the desktop and copied
;example-demon.c;Makefile;NET-SNMP-TUTORIAL-MIB.txt;nstAgentSubagentObject.c;nstAgentSubagentObject.h;
from the tutorial into it.
make command:
u...@laptop-amd:~/Desktop/agentx$ make
gcc -I. `net-snmp-config --cflags` -c -o example-demon.o example-demon.c
example-demon.c: In Funktion »main«:
example-demon.c:50: Warnung: Implizite Deklaration der Funktion
»init_vacm_vars«
example-demon.c:51: Warnung: Implizite Deklaration der Funktion
»init_usmUser«
gcc -I. `net-snmp-config --cflags` -c -o nstAgentSubagentObject.o
nstAgentSubagentObject.c
gcc -o example-demon example-demon.o nstAgentSubagentObject.o
`net-snmp-config --agent-libs`
make: *** Keine Regel vorhanden, um das Target »snmpdemoapp.o«,
benötigt von »snmpdemoapp«, zu erstellen. Schluss.
executing the subagent:
u...@laptop-amd:~/Desktop/agentx$ sudo ./example-demon
[sudo] password for user:
NET-SNMP version 5.4.1 AgentX subagent connected
example-demon is up and running.
now in another window:
u...@laptop-amd:~$ snmpget -v 2c -c public localhost
1.3.6.1.4.1.8072.2.4.1.1.2.0
NET-SNMP-MIB::netSnmp.2.4.1.1.2.0 = No Such Object available on this agent at
this OID
and
u...@laptop-amd:~$ snmpget -v 2c -c public localhost
NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0
NET-SNMP-TUTORIAL-MIB::nstAgentSubagentObject.0 = No Such Object available on
this agent at this OID
wireshark shows a request packet and a response packet with the answer:
unknownOID
??????Whats wrong??????
after that i added the line printf("adding OID\n"); before the
netsnmp_register_int_instance command in nstAgentSubagentObject.c
after that i added the line printf("doing something\n"); before the
agent_check_and_process(1); command in example-demon.c
u...@laptop-amd:~/Desktop/agentx$ sudo ./example-demon
[sudo] password for user:
adding OID
NET-SNMP version 5.4.1 AgentX subagent connected
example-demon is up and running.
doing something
doing something
doing something
doing something
the messages are displayed so the OID should be working.
the "doing something\n" message is displayed only 4 times, but i used snmpget
10 times.
I think the subagent does not get the command to do something
What did i do wrong?
Perhaps the MIB is not loaded? so the OID can not be registered corect?
Does the Subagent get the command to do something?
Any ideas?
Do you need more information?
You can answer using the mailing list or directly to [email protected]
Regards and a big thank you!!
Martin
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
------------------------------------------------------------------------------
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders