https://net-snmp.sourceforge.io/wiki/index.php?title=TUT:Customized_Output_Formats&feed=atom&action=history TUT:Customized Output Formats - Revision history 2024-03-29T14:25:25Z Revision history for this page on the wiki MediaWiki 1.26.3 https://net-snmp.sourceforge.io/wiki/index.php?title=TUT:Customized_Output_Formats&diff=5695&oldid=prev Ileadu: /* -Oe */ 2013-05-30T08:26:55Z <p>‎<span dir="auto"><span class="autocomment">-Oe</span></span></p> <table class='diff diff-contentalign-left'> <col class='diff-marker' /> <col class='diff-content' /> <col class='diff-marker' /> <col class='diff-content' /> <tr style='vertical-align: top;' lang='en'> <td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td> <td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 08:26, 30 May 2013</td> </tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l48" >Line 48:</td> <td colspan="2" class="diff-lineno">Line 48:</td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>&#160;&#160; snmp.snmpEnableAuthenTraps.0 = disabled(2)</div></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>&#160;&#160; snmp.snmpEnableAuthenTraps.0 = disabled(2)</div></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr> <tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>&#160;&#160; % &#039;&#039;&#039;snmpgetnext -v 2c -c demopublic test.net-snmp.org snmpEnableAuthenTraps&#039;&#039;&#039;</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>&#160;&#160; % &#039;&#039;&#039;snmpgetnext -v 2c <ins class="diffchange diffchange-inline">-Oe </ins>-c demopublic test.net-snmp.org snmpEnableAuthenTraps&#039;&#039;&#039;</div></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>&#160;&#160; snmp.snmpEnableAuthenTraps.0 = 2</div></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>&#160;&#160; snmp.snmpEnableAuthenTraps.0 = 2</div></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr> </table> Ileadu https://net-snmp.sourceforge.io/wiki/index.php?title=TUT:Customized_Output_Formats&diff=3726&oldid=prev Dts12: Remove garbled text, reported by Kyle Stemen 2009-02-24T13:24:51Z <p>Remove garbled text, reported by Kyle Stemen</p> <table class='diff diff-contentalign-left'> <col class='diff-marker' /> <col class='diff-content' /> <col class='diff-marker' /> <col class='diff-content' /> <tr style='vertical-align: top;' lang='en'> <td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td> <td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 13:24, 24 February 2009</td> </tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l43" >Line 43:</td> <td colspan="2" class="diff-lineno">Line 43:</td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>=== -Oe&#160; ===</div></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>=== -Oe&#160; ===</div></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr> <tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Similarly, this flag controls whether you want to display enumerated lists numerically or with textual translations <del class="diffchange diffchange-inline">(this example will not work for you the</del>: &#160;</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Similarly, this flag controls whether you want to display enumerated lists numerically or with textual translations: &#160;</div></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>&#160;&#160; % &#039;&#039;&#039;snmpgetnext -v 2c -c demopublic test.net-snmp.org snmpEnableAuthenTraps&#039;&#039;&#039;</div></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>&#160;&#160; % &#039;&#039;&#039;snmpgetnext -v 2c -c demopublic test.net-snmp.org snmpEnableAuthenTraps&#039;&#039;&#039;</div></td></tr> </table> Dts12 https://net-snmp.sourceforge.io/wiki/index.php?title=TUT:Customized_Output_Formats&diff=2781&oldid=prev Debaets: Added the uppercase "I" option before the R to make it "-IR". Previously it could not work. Verified it worked on my MIB. 2007-09-06T15:40:02Z <p>Added the uppercase &quot;I&quot; option before the R to make it &quot;-IR&quot;. Previously it could not work. Verified it worked on my MIB.</p> <table class='diff diff-contentalign-left'> <col class='diff-marker' /> <col class='diff-content' /> <col class='diff-marker' /> <col class='diff-content' /> <tr style='vertical-align: top;' lang='en'> <td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td> <td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 15:40, 6 September 2007</td> </tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l55" >Line 55:</td> <td colspan="2" class="diff-lineno">Line 55:</td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Many SNMP tables are indexed by strings. The strings are then translated into OID segments so that they can be referenced in a SNMP request. The best way to understand this is through an example. So, let&#039;s take a look at the usmUserEntry object and how it is indexed: &#160;</div></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Many SNMP tables are indexed by strings. The strings are then translated into OID segments so that they can be referenced in a SNMP request. The best way to understand this is through an example. So, let&#039;s take a look at the usmUserEntry object and how it is indexed: &#160;</div></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr> <tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>&#160;&#160; % &#039;&#039;&#039;snmptranslate -Td -<del class="diffchange diffchange-inline">R </del>usmUserEntry&#039;&#039;&#039;</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>&#160;&#160; % &#039;&#039;&#039;snmptranslate -Td -<ins class="diffchange diffchange-inline">IR </ins>usmUserEntry&#039;&#039;&#039;</div></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>&#160;&#160; .1.3.6.1.6.3.15.1.2.2.1</div></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>&#160;&#160; .1.3.6.1.6.3.15.1.2.2.1</div></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>&#160;&#160; usmUserEntry OBJECT-TYPE</div></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>&#160;&#160; usmUserEntry OBJECT-TYPE</div></td></tr> </table> Debaets https://net-snmp.sourceforge.io/wiki/index.php?title=TUT:Customized_Output_Formats&diff=2509&oldid=prev Rstory: formatting fix 2007-03-23T22:20:29Z <p>formatting fix</p> <table class='diff diff-contentalign-left'> <col class='diff-marker' /> <col class='diff-content' /> <col class='diff-marker' /> <col class='diff-content' /> <tr style='vertical-align: top;' lang='en'> <td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td> <td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 22:20, 23 March 2007</td> </tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l49" >Line 49:</td> <td colspan="2" class="diff-lineno">Line 49:</td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>&#160;&#160; % &#039;&#039;&#039;snmpgetnext -v 2c -c demopublic test.net-snmp.org snmpEnableAuthenTraps&#039;&#039;&#039;</div></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>&#160;&#160; % &#039;&#039;&#039;snmpgetnext -v 2c -c demopublic test.net-snmp.org snmpEnableAuthenTraps&#039;&#039;&#039;</div></td></tr> <tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>snmp.snmpEnableAuthenTraps.0 = 2</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">&#160; </ins>snmp.snmpEnableAuthenTraps.0 = 2</div></td></tr> <tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>&#160;</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div></div></td></tr> <tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>&#160;</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div></div></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>=== -Ob&#160; ===</div></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>=== -Ob&#160; ===</div></td></tr> </table> Rstory https://net-snmp.sourceforge.io/wiki/index.php?title=TUT:Customized_Output_Formats&diff=2503&oldid=prev Jifl: Typos 2007-03-09T17:36:59Z <p>Typos</p> <table class='diff diff-contentalign-left'> <col class='diff-marker' /> <col class='diff-content' /> <col class='diff-marker' /> <col class='diff-content' /> <tr style='vertical-align: top;' lang='en'> <td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td> <td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 17:36, 9 March 2007</td> </tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l4" >Line 4:</td> <td colspan="2" class="diff-lineno">Line 4:</td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>All of the net-snmp commands pick a common set of options, which the next few sections will be discussing. The only commands that do not accept these common set of arguments are the running demons (like snmpd and snmptrapd). &#160;</div></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>All of the net-snmp commands pick a common set of options, which the next few sections will be discussing. The only commands that do not accept these common set of arguments are the running demons (like snmpd and snmptrapd). &#160;</div></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr> <tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>A list of all of the options that are available for use from a command can be printed by passing &quot;-h&quot; on the command <del class="diffchange diffchange-inline">lien </del>to any of the commands. &#160;</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>A list of all of the options that are available for use from a command can be printed by passing &quot;-h&quot; on the command <ins class="diffchange diffchange-inline">line </ins>to any of the commands. &#160;</div></td></tr> <tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Command Options Affecting Output Formatting</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">=== </ins>Command Options Affecting Output Formatting <ins class="diffchange diffchange-inline">===</ins></div></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>All of the commands allow you to format their output in a manner which you personally will find attractive. The behavior is controlled using the -O flag: &#160;</div></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>All of the commands allow you to format their output in a manner which you personally will find attractive. The behavior is controlled using the -O flag: &#160;</div></td></tr> <tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l125" >Line 125:</td> <td colspan="2" class="diff-lineno">Line 125:</td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>=== -Os, -OS, and -Of&#160; ===</div></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>=== -Os, -OS, and -Of&#160; ===</div></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr> <tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">Shorting </del>the output of those really long OIDs is also possible, using the -Os and -OS command (the -OS version <del class="diffchange diffchange-inline">pre-pends </del>the url with the MIB name that the node came from): &#160;</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Shortening </ins>the output of those really long OIDs is also possible, using the -Os and -OS command (the -OS version <ins class="diffchange diffchange-inline">prepends </ins>the url with the MIB name that the node came from): &#160;</div></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr> </table> Jifl https://net-snmp.sourceforge.io/wiki/index.php?title=TUT:Customized_Output_Formats&diff=2322&oldid=prev Wes: /* -Oq = */ 2007-01-23T20:14:34Z <p>‎<span dir="auto"><span class="autocomment">-Oq =</span></span></p> <table class='diff diff-contentalign-left'> <col class='diff-marker' /> <col class='diff-content' /> <col class='diff-marker' /> <col class='diff-content' /> <tr style='vertical-align: top;' lang='en'> <td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td> <td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 20:14, 23 January 2007</td> </tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l161" >Line 161:</td> <td colspan="2" class="diff-lineno">Line 161:</td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr> <tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>=== -Oq <del class="diffchange diffchange-inline">=</del>===</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>=== -Oq ===</div></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Finally, the -Oq flag allows us to print everything as quick as possible in a fashion that is easily parsible by things like scripting languages: &#160;</div></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Finally, the -Oq flag allows us to print everything as quick as possible in a fashion that is easily parsible by things like scripting languages: &#160;</div></td></tr> <tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l171" >Line 171:</td> <td colspan="2" class="diff-lineno">Line 171:</td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr> <tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Note that in the above output, there is no equal sign and there is no &quot;OID:&quot; string in the output. &#160;</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Note that in the above output, there is no equal sign and there is no &quot;OID:&quot; string in the output.</div></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>=== Combinations ===</div></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>=== Combinations ===</div></td></tr> </table> Wes https://net-snmp.sourceforge.io/wiki/index.php?title=TUT:Customized_Output_Formats&diff=2321&oldid=prev Wes at 20:14, 23 January 2007 2007-01-23T20:14:08Z <p></p> <p><b>New page</b></p><div>== Output Formatting ==<br /> <br /> <br /> All of the net-snmp commands pick a common set of options, which the next few sections will be discussing. The only commands that do not accept these common set of arguments are the running demons (like snmpd and snmptrapd). <br /> <br /> A list of all of the options that are available for use from a command can be printed by passing &quot;-h&quot; on the command lien to any of the commands. <br /> Command Options Affecting Output Formatting<br /> <br /> All of the commands allow you to format their output in a manner which you personally will find attractive. The behavior is controlled using the -O flag: <br /> <br /> % &#039;&#039;&#039;snmpget -h&#039;&#039;&#039;<br /> Usage: snmpget [options...] [ ...]<br /> ...<br /> -O Toggle various defaults controlling oid printing:<br /> OIDOPTS values:<br /> n: Print oids numerically.<br /> e: Print enums numerically.<br /> E: Escape quotes in string indices.<br /> X: Extended index format.<br /> b: Dont break oid indexes down.<br /> q: Quick print for easier parsing.<br /> f: Print full oids on output.<br /> s: Print only last symbolic element of oid.<br /> S: Print MIB module-id plus last element.<br /> t: Print timeticks unparsed as numeric integers.<br /> v: Print values only (not OID = value).<br /> <br /> <br /> Here are brief examples of all the above options in use: <br /> <br /> === -On ===<br /> <br /> This flag controls whether or not you want to display the results using numerical order to textual OIDs: <br /> <br /> % &#039;&#039;&#039;snmpgetnext -v 2c -c demopublic test.net-snmp.org sysObjectID&#039;&#039;&#039;<br /> system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.hpux10<br /> <br /> % &#039;&#039;&#039;snmpgetnext -v 2c -On -c demopublic test.net-snmp.org sysObjectID&#039;&#039;&#039;<br /> .1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.2021.250.6<br /> <br /> <br /> <br /> === -Oe ===<br /> <br /> Similarly, this flag controls whether you want to display enumerated lists numerically or with textual translations (this example will not work for you the: <br /> <br /> % &#039;&#039;&#039;snmpgetnext -v 2c -c demopublic test.net-snmp.org snmpEnableAuthenTraps&#039;&#039;&#039;<br /> snmp.snmpEnableAuthenTraps.0 = disabled(2)<br /> <br /> % &#039;&#039;&#039;snmpgetnext -v 2c -c demopublic test.net-snmp.org snmpEnableAuthenTraps&#039;&#039;&#039;<br /> snmp.snmpEnableAuthenTraps.0 = 2<br /> <br /> <br /> <br /> === -Ob ===<br /> <br /> Many SNMP tables are indexed by strings. The strings are then translated into OID segments so that they can be referenced in a SNMP request. The best way to understand this is through an example. So, let&#039;s take a look at the usmUserEntry object and how it is indexed: <br /> <br /> % &#039;&#039;&#039;snmptranslate -Td -R usmUserEntry&#039;&#039;&#039;<br /> .1.3.6.1.6.3.15.1.2.2.1<br /> usmUserEntry OBJECT-TYPE<br /> -- FROM SNMP-USER-BASED-SM-MIB<br /> MAX-ACCESS not-accessible<br /> STATUS current<br /> INDEXES { usmUserEngineID, usmUserName }<br /> DESCRIPTION &quot;A user configured in the SNMP engine&#039;s Local<br /> Configuration Datastore (LCD) for the User-based<br /> Security Model.<br /> &quot;<br /> ::= { iso(1) org(3) dod(6) internet(1) snmpV2(6) snmpModules(3) snmpUsmMIB(15) usmMIBObjects(1) usmUser(2) usmUserTable(2) 1 }<br /> <br /> <br /> <br /> <br /> As you can see by the above description, it is indexed by two different objects: usmUserEngineID, and usmUserName. Both of these are strings. The default for all of the commands is to breakdown the result for you to make it easier for you to decode the above indexes out of the printed result: <br /> <br /> % &#039;&#039;&#039;snmpgetnext -v 2c -c demopublic test.net-snmp.org usmUserEntry&#039;&#039;&#039;<br /> .iso.org.dod.internet.snmpV2.snmpModules.snmpUsmMIB.usmMIBObjects.usmUser.usmUserTable.usmUserEntry.usmUserOwnPrivKeyChange.&quot;.........&quot;.&quot;MD5User&quot; = &quot;&quot;<br /> <br /> <br /> As you can see, they OID in the output above shows 2 strings in it: &quot;.........&quot; and &quot;MD5User&quot;. The first string is an engine ID which is full of unprintable characters, so in this case it didn&#039;t help much that the library printed it out for us. However, the user string &quot;MD5User&quot; got nicely printed instead. We generally think this is much easier to understand than looking at the numbers directly. However, this is available to you as an option as well: <br /> <br /> % &#039;&#039;&#039;snmpgetnext -Ob -v 2c -c demopublic test.net-snmp.org usmUserEntry&#039;&#039;&#039;<br /> .iso.org.dod.internet.snmpV2.snmpModules.snmpUsmMIB.usmMIBObjects.usmUser.usmUserTable.usmUserEntry.usmUserOwnPrivKeyChange.9.128.0.7.229.1.169.237.235.161.7.77.68.53.85.115.101.114 = &quot;&quot;<br /> <br /> <br /> Here you can see that the OID is much more complex, and does not intuitively look like it contains 2 strings to the naked eye. <br /> <br /> Of course, all of the net-snmp commands also accept strings in the requested OID, although most shells will require you to escape the quotes with a back slash: <br /> <br /> % &#039;&#039;&#039;snmpget -v 2c -c demopublic test.net-snmp.org usmUserOwnPrivKeyChange.9.128.0.7.229.1.169.237.235.161.\&quot;MD5User\&quot;&#039;&#039;&#039;<br /> .iso.org.dod.internet.snmpV2.snmpModules.snmpUsmMIB.usmMIBObjects.usmUser.usmUserTable.usmUserEntry.usmUserOwnPrivKeyChange.&quot;.........&quot;.&quot;MD5User&quot; = &quot;&quot;<br /> <br /> <br /> === -OX ===<br /> A more elaborate output for index values is -OX. This format is output-only - no provision has been made to accept it on input. <br /> Especially the IPv6 mibs return values that can be very difficult to read, and is very different from the ways you normally see the values involved. <br /> Consider for instance the IPV6-MIB:ipv6RouteTable <br /> <br /> % &#039;&#039;&#039;snmptranslate -Td IPV6-MIB::ipv6RouteEntry&#039;&#039;&#039;<br /> .1.3.6.1.2.1.55.1.11.1<br /> ipv6RouteEntry OBJECT-TYPE<br /> -- FROM IPV6-MIB<br /> MAX-ACCESS not-accessible<br /> STATUS current<br /> INDEX { ipv6RouteDest, ipv6RoutePfxLength, ipv6RouteIndex }<br /> DESCRIPTION &quot;A routing entry.&quot;<br /> ::= { iso(1) org(3) dod(6) internet(1) mgmt(2) mib-2(1) ipv6MIB(55) ipv6MIBObjects(1) ipv6RouteTable(11) 1 }<br /> <br /> <br /> i.e. the index is an IPv6 address and two integers. So requesting <br /> <br /> % &#039;&#039;&#039;snmpgetnext -OS host IPV6-MIB::ipv6RouteTable&#039;&#039;&#039;<br /> IPV6-MIB::ipv6RouteIfIndex.63.254.1.0.255.0.0.0.0.0.0.0.0.0.0.0.64.1 = 2<br /> <br /> <br /> is not easily read. But how about <br /> <br /> % &#039;&#039;&#039;snmpgetnext -OSX host IPV6-MIB::ipv6RouteTable&#039;&#039;&#039;<br /> IPV6-MIB::ipv6RouteIfIndex[3ffe:100:ff00:0:0:0:0:0][64][1] = 2<br /> <br /> <br /> It looks a lot nicer. The format puts square brackets around each index, and uses DISPLAY-HINT information and string conversions to format each index. <br /> <br /> === -Os, -OS, and -Of ===<br /> <br /> Shorting the output of those really long OIDs is also possible, using the -Os and -OS command (the -OS version pre-pends the url with the MIB name that the node came from): <br /> <br /> <br /> <br /> % &#039;&#039;&#039;snmpget -v 2c -c demopublic test.net-snmp.org sysUpTime.0 ucdDemoUserList.0&#039;&#039;&#039;<br /> system.sysUpTime.0 = Timeticks: (586910990) 67 days, 22:18:29.90<br /> enterprises.ucdavis.ucdDemoMIB.ucdDemoMIBObjects.ucdDemoPublic.ucdDemoUserList.0 = &quot; noAuthUser MD5User MD5DESUser SHAUser SHADESUser&quot;<br /> <br /> % &#039;&#039;&#039;snmpget -Os -v 2c -c demopublic test.net-snmp.org sysUpTime.0 ucdDemoUserList.0&#039;&#039;&#039;<br /> sysUpTime.0 = Timeticks: (586910990) 67 days, 22:18:29.90<br /> ucdDemoUserList.0 = &quot; noAuthUser MD5User MD5DESUser SHAUser SHADESUser&quot;<br /> <br /> % &#039;&#039;&#039;snmpget -OS -v 2c -c demopublic test.net-snmp.org sysUpTime.0 ucdDemoUserList.0&#039;&#039;&#039;<br /> RFC1213-MIB::sysUpTime.0 = Timeticks: (586911833) 67 days, 22:18:38.33<br /> UCD-DEMO-MIB::ucdDemoUserList.0 = &quot; noAuthUser MD5User MD5DESUser SHAUser SHADESUser&quot;<br /> <br /> <br /> <br /> As you can see the above options only print out the last node in the OID, but the -OS option additionally prepends the output with the name of the MIB that the OID can be found in. <br /> -Of Is sort of the reverse of the previous options and always displays the full OID: <br /> <br /> % &#039;&#039;&#039;snmpget -Of -v 2c -c demopublic test.net-snmp.org sysUpTime.0 ucdDemoUserList.0&#039;&#039;&#039;<br /> .iso.org.dod.internet.mgmt.mib-2.system.sysUpTime.0 = Timeticks: (741998862) 85 days, 21:06:28.62<br /> .iso.org.dod.internet.private.enterprises.ucdavis.ucdDemoMIB.ucdDemoMIBObjects.ucdDemoPublic.ucdDemoUserList.0 = &quot; noAuthUser MD5User MD5DESUser SHAUser SHADESUser&quot;<br /> <br /> <br /> <br /> === -Ov === <br /> <br /> The -Ov flag outputs only the value, but not variable name <br /> <br /> % &#039;&#039;&#039;snmpget -Ov -v 2c -c demopublic test.net-snmp.org sysObjectID.0&#039;&#039;&#039;<br /> OID: enterprises.ucdavis.ucdSnmpAgent.hpux10<br /> <br /> <br /> <br /> === -Oq ====<br /> <br /> Finally, the -Oq flag allows us to print everything as quick as possible in a fashion that is easily parsible by things like scripting languages: <br /> <br /> % &#039;&#039;&#039;snmpget -Oq -v 2c -c demopublic test.net-snmp.org sysObjectID.0&#039;&#039;&#039;<br /> system.sysObjectID.0 enterprises.ucdavis.ucdSnmpAgent.hpux10<br /> <br /> <br /> <br /> <br /> Note that in the above output, there is no equal sign and there is no &quot;OID:&quot; string in the output. <br /> <br /> === Combinations ===<br /> <br /> Of course, you&#039;re allowed to combine many of these options into one statement: <br /> <br /> % &#039;&#039;&#039;snmpget -Oqs -v 2c -c demopublic test.net-snmp.org sysObjectID.0&#039;&#039;&#039;<br /> sysObjectID.0 hpux10<br /> <br /> <br /> <br /> For shell scripts, the -Oqv option is useful. It only returns the value of the attribute, which is useful for instance in (using sh/ksh/bash syntax) <br /> <br /> % &#039;&#039;&#039;interfaces=`snmpget -Oqv -v 2c -c demopublic test.net-snmp.org ifNumber.0````<br /> <br /> {{TUT:LIST}}</div> Wes