Automatically detecting a PySMI parsed MIB from an existing OID












0















I have a situation where I'm trying to do some MIB-processing on a pre-existing, non-translated SNMP walk in the cloud. I have a set of translated PySMI MIB json files, but I'm unsure how to match the correct MIB with OIDs within the walk.



I saw in this post that PySNMP was unable to automatically detect a MIB but that it was being worked on. I tried to create a simple implementation myself using regex, but I cannot find the correlation between a MIB's module identity and the OIDs that I am retrieving from the SNMP walk.



I've seen the MIB index that can be generated from PySMI, which seemed promising, but I'm not sure how I can use that to find the human-readable version of an OID from a collection of MIB files.



What am I missing? Thanks!










share|improve this question





























    0















    I have a situation where I'm trying to do some MIB-processing on a pre-existing, non-translated SNMP walk in the cloud. I have a set of translated PySMI MIB json files, but I'm unsure how to match the correct MIB with OIDs within the walk.



    I saw in this post that PySNMP was unable to automatically detect a MIB but that it was being worked on. I tried to create a simple implementation myself using regex, but I cannot find the correlation between a MIB's module identity and the OIDs that I am retrieving from the SNMP walk.



    I've seen the MIB index that can be generated from PySMI, which seemed promising, but I'm not sure how I can use that to find the human-readable version of an OID from a collection of MIB files.



    What am I missing? Thanks!










    share|improve this question



























      0












      0








      0








      I have a situation where I'm trying to do some MIB-processing on a pre-existing, non-translated SNMP walk in the cloud. I have a set of translated PySMI MIB json files, but I'm unsure how to match the correct MIB with OIDs within the walk.



      I saw in this post that PySNMP was unable to automatically detect a MIB but that it was being worked on. I tried to create a simple implementation myself using regex, but I cannot find the correlation between a MIB's module identity and the OIDs that I am retrieving from the SNMP walk.



      I've seen the MIB index that can be generated from PySMI, which seemed promising, but I'm not sure how I can use that to find the human-readable version of an OID from a collection of MIB files.



      What am I missing? Thanks!










      share|improve this question
















      I have a situation where I'm trying to do some MIB-processing on a pre-existing, non-translated SNMP walk in the cloud. I have a set of translated PySMI MIB json files, but I'm unsure how to match the correct MIB with OIDs within the walk.



      I saw in this post that PySNMP was unable to automatically detect a MIB but that it was being worked on. I tried to create a simple implementation myself using regex, but I cannot find the correlation between a MIB's module identity and the OIDs that I am retrieving from the SNMP walk.



      I've seen the MIB index that can be generated from PySMI, which seemed promising, but I'm not sure how I can use that to find the human-readable version of an OID from a collection of MIB files.



      What am I missing? Thanks!







      snmp pysnmp mib






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 20 '18 at 18:59







      Hannah

















      asked Nov 20 '18 at 18:53









      HannahHannah

      53




      53
























          1 Answer
          1






          active

          oldest

          votes


















          1














          A way to deal with this would be to build the OID->MIB index by running PySMI-based script (or just vanilla mibdump tool) over your entire MIB collection. Actually, such index can be found here.



          Once you have this OID->MIB mapping, you could run the OIDs your snmpwalk script receives, match them (or their prefixes) against the OID->MIB map and load up the required MIBs.



          Unfortunately, this relatively simple process has not been built into pysnmp yet, but it should not be hard to implement within your script.






          share|improve this answer
























          • Exactly this. For my C++-based SNMP agent I had a pre-build step do [basically] a mibdump and use the result to generate C++ maps that took you from a numeric OID to an object name. I didn't need to know which MIB the object was defined in, but that information could have been added to the mapping in just the same way. Ultimately it was just a matter of parsing the output of the cmdline tool; I believe I did it in Python with a regex or two.

            – Lightness Races in Orbit
            Nov 21 '18 at 10:47











          • (This was not quite the OP's use case; I wanted my Agent to "load MIBs" at build time so I didn't have to reimplement all that information inside it. But the end result is the same.)

            – Lightness Races in Orbit
            Nov 21 '18 at 10:48











          • I am not sure I understood you correctly that your issue has been resolved by now. If not, let’s reiterate on what exactly does not work fir you. ;)

            – Ilya Etingof
            Nov 21 '18 at 10:53











          • Did you confuse me with the OP?

            – Lightness Races in Orbit
            Nov 21 '18 at 11:04











          • Not so much for OP, it’s just the wording which makes me unsure that you resolved the original issue.

            – Ilya Etingof
            Nov 22 '18 at 6:34











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53399689%2fautomatically-detecting-a-pysmi-parsed-mib-from-an-existing-oid%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          A way to deal with this would be to build the OID->MIB index by running PySMI-based script (or just vanilla mibdump tool) over your entire MIB collection. Actually, such index can be found here.



          Once you have this OID->MIB mapping, you could run the OIDs your snmpwalk script receives, match them (or their prefixes) against the OID->MIB map and load up the required MIBs.



          Unfortunately, this relatively simple process has not been built into pysnmp yet, but it should not be hard to implement within your script.






          share|improve this answer
























          • Exactly this. For my C++-based SNMP agent I had a pre-build step do [basically] a mibdump and use the result to generate C++ maps that took you from a numeric OID to an object name. I didn't need to know which MIB the object was defined in, but that information could have been added to the mapping in just the same way. Ultimately it was just a matter of parsing the output of the cmdline tool; I believe I did it in Python with a regex or two.

            – Lightness Races in Orbit
            Nov 21 '18 at 10:47











          • (This was not quite the OP's use case; I wanted my Agent to "load MIBs" at build time so I didn't have to reimplement all that information inside it. But the end result is the same.)

            – Lightness Races in Orbit
            Nov 21 '18 at 10:48











          • I am not sure I understood you correctly that your issue has been resolved by now. If not, let’s reiterate on what exactly does not work fir you. ;)

            – Ilya Etingof
            Nov 21 '18 at 10:53











          • Did you confuse me with the OP?

            – Lightness Races in Orbit
            Nov 21 '18 at 11:04











          • Not so much for OP, it’s just the wording which makes me unsure that you resolved the original issue.

            – Ilya Etingof
            Nov 22 '18 at 6:34
















          1














          A way to deal with this would be to build the OID->MIB index by running PySMI-based script (or just vanilla mibdump tool) over your entire MIB collection. Actually, such index can be found here.



          Once you have this OID->MIB mapping, you could run the OIDs your snmpwalk script receives, match them (or their prefixes) against the OID->MIB map and load up the required MIBs.



          Unfortunately, this relatively simple process has not been built into pysnmp yet, but it should not be hard to implement within your script.






          share|improve this answer
























          • Exactly this. For my C++-based SNMP agent I had a pre-build step do [basically] a mibdump and use the result to generate C++ maps that took you from a numeric OID to an object name. I didn't need to know which MIB the object was defined in, but that information could have been added to the mapping in just the same way. Ultimately it was just a matter of parsing the output of the cmdline tool; I believe I did it in Python with a regex or two.

            – Lightness Races in Orbit
            Nov 21 '18 at 10:47











          • (This was not quite the OP's use case; I wanted my Agent to "load MIBs" at build time so I didn't have to reimplement all that information inside it. But the end result is the same.)

            – Lightness Races in Orbit
            Nov 21 '18 at 10:48











          • I am not sure I understood you correctly that your issue has been resolved by now. If not, let’s reiterate on what exactly does not work fir you. ;)

            – Ilya Etingof
            Nov 21 '18 at 10:53











          • Did you confuse me with the OP?

            – Lightness Races in Orbit
            Nov 21 '18 at 11:04











          • Not so much for OP, it’s just the wording which makes me unsure that you resolved the original issue.

            – Ilya Etingof
            Nov 22 '18 at 6:34














          1












          1








          1







          A way to deal with this would be to build the OID->MIB index by running PySMI-based script (or just vanilla mibdump tool) over your entire MIB collection. Actually, such index can be found here.



          Once you have this OID->MIB mapping, you could run the OIDs your snmpwalk script receives, match them (or their prefixes) against the OID->MIB map and load up the required MIBs.



          Unfortunately, this relatively simple process has not been built into pysnmp yet, but it should not be hard to implement within your script.






          share|improve this answer













          A way to deal with this would be to build the OID->MIB index by running PySMI-based script (or just vanilla mibdump tool) over your entire MIB collection. Actually, such index can be found here.



          Once you have this OID->MIB mapping, you could run the OIDs your snmpwalk script receives, match them (or their prefixes) against the OID->MIB map and load up the required MIBs.



          Unfortunately, this relatively simple process has not been built into pysnmp yet, but it should not be hard to implement within your script.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 21 '18 at 6:57









          Ilya EtingofIlya Etingof

          4,20611320




          4,20611320













          • Exactly this. For my C++-based SNMP agent I had a pre-build step do [basically] a mibdump and use the result to generate C++ maps that took you from a numeric OID to an object name. I didn't need to know which MIB the object was defined in, but that information could have been added to the mapping in just the same way. Ultimately it was just a matter of parsing the output of the cmdline tool; I believe I did it in Python with a regex or two.

            – Lightness Races in Orbit
            Nov 21 '18 at 10:47











          • (This was not quite the OP's use case; I wanted my Agent to "load MIBs" at build time so I didn't have to reimplement all that information inside it. But the end result is the same.)

            – Lightness Races in Orbit
            Nov 21 '18 at 10:48











          • I am not sure I understood you correctly that your issue has been resolved by now. If not, let’s reiterate on what exactly does not work fir you. ;)

            – Ilya Etingof
            Nov 21 '18 at 10:53











          • Did you confuse me with the OP?

            – Lightness Races in Orbit
            Nov 21 '18 at 11:04











          • Not so much for OP, it’s just the wording which makes me unsure that you resolved the original issue.

            – Ilya Etingof
            Nov 22 '18 at 6:34



















          • Exactly this. For my C++-based SNMP agent I had a pre-build step do [basically] a mibdump and use the result to generate C++ maps that took you from a numeric OID to an object name. I didn't need to know which MIB the object was defined in, but that information could have been added to the mapping in just the same way. Ultimately it was just a matter of parsing the output of the cmdline tool; I believe I did it in Python with a regex or two.

            – Lightness Races in Orbit
            Nov 21 '18 at 10:47











          • (This was not quite the OP's use case; I wanted my Agent to "load MIBs" at build time so I didn't have to reimplement all that information inside it. But the end result is the same.)

            – Lightness Races in Orbit
            Nov 21 '18 at 10:48











          • I am not sure I understood you correctly that your issue has been resolved by now. If not, let’s reiterate on what exactly does not work fir you. ;)

            – Ilya Etingof
            Nov 21 '18 at 10:53











          • Did you confuse me with the OP?

            – Lightness Races in Orbit
            Nov 21 '18 at 11:04











          • Not so much for OP, it’s just the wording which makes me unsure that you resolved the original issue.

            – Ilya Etingof
            Nov 22 '18 at 6:34

















          Exactly this. For my C++-based SNMP agent I had a pre-build step do [basically] a mibdump and use the result to generate C++ maps that took you from a numeric OID to an object name. I didn't need to know which MIB the object was defined in, but that information could have been added to the mapping in just the same way. Ultimately it was just a matter of parsing the output of the cmdline tool; I believe I did it in Python with a regex or two.

          – Lightness Races in Orbit
          Nov 21 '18 at 10:47





          Exactly this. For my C++-based SNMP agent I had a pre-build step do [basically] a mibdump and use the result to generate C++ maps that took you from a numeric OID to an object name. I didn't need to know which MIB the object was defined in, but that information could have been added to the mapping in just the same way. Ultimately it was just a matter of parsing the output of the cmdline tool; I believe I did it in Python with a regex or two.

          – Lightness Races in Orbit
          Nov 21 '18 at 10:47













          (This was not quite the OP's use case; I wanted my Agent to "load MIBs" at build time so I didn't have to reimplement all that information inside it. But the end result is the same.)

          – Lightness Races in Orbit
          Nov 21 '18 at 10:48





          (This was not quite the OP's use case; I wanted my Agent to "load MIBs" at build time so I didn't have to reimplement all that information inside it. But the end result is the same.)

          – Lightness Races in Orbit
          Nov 21 '18 at 10:48













          I am not sure I understood you correctly that your issue has been resolved by now. If not, let’s reiterate on what exactly does not work fir you. ;)

          – Ilya Etingof
          Nov 21 '18 at 10:53





          I am not sure I understood you correctly that your issue has been resolved by now. If not, let’s reiterate on what exactly does not work fir you. ;)

          – Ilya Etingof
          Nov 21 '18 at 10:53













          Did you confuse me with the OP?

          – Lightness Races in Orbit
          Nov 21 '18 at 11:04





          Did you confuse me with the OP?

          – Lightness Races in Orbit
          Nov 21 '18 at 11:04













          Not so much for OP, it’s just the wording which makes me unsure that you resolved the original issue.

          – Ilya Etingof
          Nov 22 '18 at 6:34





          Not so much for OP, it’s just the wording which makes me unsure that you resolved the original issue.

          – Ilya Etingof
          Nov 22 '18 at 6:34




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53399689%2fautomatically-detecting-a-pysmi-parsed-mib-from-an-existing-oid%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Xamarin.form Move up view when keyboard appear

          Post-Redirect-Get with Spring WebFlux and Thymeleaf

          Anylogic : not able to use stopDelay()