Closed bernardoaraujor closed 7 years ago
In order to solve this issue I had to copy AGENTX-TUTORIAL-MIB to /usr/share/snmp/mibs/, and modify the snmptranslate commando to:
bernardo@bernardo-ThinkCentre-Edge72:~/agentx-tutorial$ snmptranslate -m +AGENTX-TUTORIAL-MIB -Tp -IR agentxTutorial
+--agentxTutorial(9999)
|
+--myNotifications(0)
| |
| +--myNotificationObjects(0)
| | |
| | +-- ---N Integer32 myTrapTime(1)
| | +-- ---N String myTrapData(2)
| | Textual Convention: DisplayString
| | Size: 0..255
| |
| +--myROIntHit(1)
|
+--myScalars(1)
| |
| +-- -R-- String myROString(1)
| | Textual Convention: DisplayString
| | Size: 0..255
| +-- -R-- Integer32 myROInteger(2)
| Range: 0..2147483647
|
+--myTables(2)
| |
| +--myTestTable(1)
| |
| +--myTestTableEntry(1)
| | Index: myROStringCol1
| |
| +-- -R-- String myROStringCol1(1)
| | Textual Convention: DisplayString
| | Size: 0..255
| +-- -R-- Integer32 myROIntCol2(2)
| Range: 0..2147483647
|
+--myConformenceGroups(99)
|
+--myScalarGroup(1)
+--myTableGroup(2)
+--myTrapObjectGroup(3)
+--myTrapsGroup(4)
Still, I'm getting more stuff than what your tutorial shows.
Hi @bernardoaraujor. Here are the answers to both of your queries.
git checkout step1_scalars_autogenerated
or git checkout step1_scalars_implement
. Basically you have to keep on checking out different tags one by one in order to see the changes that I am discussing at each step. Can you please try that and let me know if you still see a problem?Hey Jain, thanks so much for your help. I'm a bit of a newbie in both git and snmp, so your help is of so much value to me!
step1_scalars_autogenerated
MIB and the step1_scalars_implement
branches in step one? It seems I still got pretty similar results, even after checking out the branches:
bernardo@bernardo-ThinkCentre-Edge72:~$ git clone https://github.com/jainvishal/agentx-tutorial
Cloning into 'agentx-tutorial'...
remote: Counting objects: 89, done.
remote: Compressing objects: 100% (48/48), done.
remote: Total 89 (delta 41), reused 89 (delta 41), pack-reused 0
Unpacking objects: 100% (89/89), done.
Checking connectivity... done.
bernardo@bernardo-ThinkCentre-Edge72:~$ cd agentx-tutorial/
bernardo@bernardo-ThinkCentre-Edge72:~/agentx-tutorial$ git checkout step1_scalars_autogenerated
Note: checking out 'step1_scalars_autogenerated'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at 329abf1... initial raw output of mib2c
bernardo@bernardo-ThinkCentre-Edge72:~/agentx-tutorial$ snmptranslate -M +.~/agentx-tutorial -m +AGENTX-TUTORIAL-MIB -Tp -IR agentxTutorial
+--agentxTutorial(9999)
|
+--myNotifications(0)
| |
| +--myNotificationObjects(0)
| | |
| | +-- ---N Integer32 myTrapTime(1)
| | +-- ---N String myTrapData(2)
| | Textual Convention: DisplayString
| | Size: 0..255
| |
| +--myROIntHit(1)
|
+--myScalars(1)
| |
| +-- -R-- String myROString(1)
| | Textual Convention: DisplayString
| | Size: 0..255
| +-- -R-- Integer32 myROInteger(2)
| Range: 0..2147483647
|
+--myTables(2)
| |
| +--myTestTable(1)
| |
| +--myTestTableEntry(1)
| | Index: myROStringCol1
| |
| +-- -R-- String myROStringCol1(1)
| | Textual Convention: DisplayString
| | Size: 0..255
| +-- -R-- Integer32 myROIntCol2(2)
| Range: 0..2147483647
|
+--myConformenceGroups(99)
|
+--myScalarGroup(1)
+--myTableGroup(2)
+--myTrapObjectGroup(3)
+--myTrapsGroup(4)
I removed the directory and cloned it again in order to try with the other branch:
bernardo@bernardo-ThinkCentre-Edge72:~$ git clone https://github.com/jainvishal/agentx-tutorial
Cloning into 'agentx-tutorial'...
remote: Counting objects: 89, done.
remote: Compressing objects: 100% (48/48), done.
remote: Total 89 (delta 41), reused 89 (delta 41), pack-reused 0
Unpacking objects: 100% (89/89), done.
Checking connectivity... done.
bernardo@bernardo-ThinkCentre-Edge72:~$ cd agentx-tutorial/
bernardo@bernardo-ThinkCentre-Edge72:~/agentx-tutorial$ git checkout step1_scalars_implement
Note: checking out 'step1_scalars_implement'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at 0dcfcda... implement simple scalars
bernardo@bernardo-ThinkCentre-Edge72:~/agentx-tutorial$ snmptranslate -M +.~/agentx-tutorial -m +AGENTX-TUTORIAL-MIB -Tp -IR agentxTutorial
+--agentxTutorial(9999)
|
+--myNotifications(0)
| |
| +--myNotificationObjects(0)
| | |
| | +-- ---N Integer32 myTrapTime(1)
| | +-- ---N String myTrapData(2)
| | Textual Convention: DisplayString
| | Size: 0..255
| |
| +--myROIntHit(1)
|
+--myScalars(1)
| |
| +-- -R-- String myROString(1)
| | Textual Convention: DisplayString
| | Size: 0..255
| +-- -R-- Integer32 myROInteger(2)
| Range: 0..2147483647
|
+--myTables(2)
| |
| +--myTestTable(1)
| |
| +--myTestTableEntry(1)
| | Index: myROStringCol1
| |
| +-- -R-- String myROStringCol1(1)
| | Textual Convention: DisplayString
| | Size: 0..255
| +-- -R-- Integer32 myROIntCol2(2)
| Range: 0..2147483647
|
+--myConformenceGroups(99)
|
+--myScalarGroup(1)
+--myTableGroup(2)
+--myTrapObjectGroup(3)
+--myTrapsGroup(4)
One thing that got me a bit confused was the fact that when I try to list the branches in the repo, I can't find neither step1_scalars_autogenerated
or step1_scalars_implement
. But perhaps my limited knowledge about branches on git is getting in my way.
bernardo@bernardo-ThinkCentre-Edge72:~/agentx-tutorial$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/table
remotes/origin/traps
No problem Bernardo. I am happy to help.
May I ask you what's the difference between the step1_scalars_autogenerated MIB and the step1_scalars_implement branches in step one?
autogenerated code is what gets generated by using mib2c. That is just a skeleton code or a template. It is not a fully working code. Sometimes it would not even compile. So you have to implement the logic. implement tag has the implementation on top of the autogenerated code.
It seems I still got pretty similar results, even after checking out the branches:
I noticed that you are using -M +.~/agentx-tutorial
. There is a minor issue in the directory path. Remove the "dot" and use -M +~/agentx-tutorial
. Basically you are telling it to check your home directory under current directory when you wanted to tell it to use agentx-tutorial from your home directory. As a result snmptranslate is not finding the MIB and going to default directory (/usr/share/snmp/mibs) where you have already copied the MIB from master branch. I would suggest to remove the MIB from there to avoid future confusions.
I removed the directory and cloned it again in order to try with the other branch:
You do not have to do this. If you did not make any changes you can simply checkout another branch/tag/version.
One thing that got me a bit confused was the fact that when I try to list the branches in the repo, I can't find neither step1_scalars_autogenerated or step1_scalars_implement. But perhaps my limited knowledge about branches on git is getting in my way.
Theses are tags and not branches.
vishalj@dreams:~/workspace/agentx-tutorial$ git tag -n
step1_scalars_autogenerated initial raw output of mib2c
step1_scalars_implement implement simple scalars
step2_tables_autogenerated autogenerate myTestTable code using MFD
step2_tables_implement implement simple table
step3_traps_autogenerated autogenerate trap code
step3_traps_implement implement a simple trap
step4_cleanup final cleanup and rearrangement of source code
vishalj@dreams:~/workspace/agentx-tutorial$
Hi Bernardo, are you good with my last instructions? I would like to close this thread.
Hey Jain, thanks for the replies! I'm sorry for the delay. Yes, your instructions were very helpful!
Hey Jain, how are you? Thanks for this great tutorial!
I'm trying to execute Step 1, but I'm getting the following error:
bernardo@bernardo-ThinkCentre-Edge72:~/agentx-tutorial$ snmptranslate -Tp -IR agentxTutorial Unknown object identifier: agentxTutorial