📄 net-snmp-mib-compiler.html
字号:
<!-- Copyright (C) 2003 Red Hat, Inc. --><!-- This material may be distributed only subject to the terms --><!-- and conditions set forth in the Open Publication License, v1.0 --><!-- or later (the latest version is presently available at --><!-- http://www.opencontent.org/openpub/). --><!-- Distribution of the work or derivative of the work in any --><!-- standard (paper) book form is prohibited unless prior --><!-- permission is obtained from the copyright holder. --><HTML><HEAD><TITLE>MIB Compiler </TITLE><meta name="MSSmartTagsPreventParsing" content="TRUE"><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="eCos Reference Manual"HREF="ecos-ref.html"><LINKREL="UP"TITLE="SNMP for eCos"HREF="net-snmp-ecos-port.html"><LINKREL="PREVIOUS"TITLE="Unimplemented features"HREF="net-snmp-unimplemented-features.html"><LINKREL="NEXT"TITLE="snmpd.conf"HREF="net-snmp-agent-manpages-snmpd.conf.html"></HEAD><BODYCLASS="SECT1"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">eCos Reference Manual</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="net-snmp-unimplemented-features.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 47. SNMP for <SPANCLASS="emphasis"><ICLASS="EMPHASIS">eCos</I></SPAN></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="net-snmp-agent-manpages-snmpd.conf.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="NET-SNMP-MIB-COMPILER">MIB Compiler</H1><P>In the directory <TTCLASS="FILENAME">/snmp/agent/VERSION/utils/mib2c</TT>,there are the following files:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">README-eCos notes about running with a nonstandard perl path.README.mib2c the README from UCD; full instructions on using mib2c mib2c the perl programmib2c.conf a configuration file altered to include the eCos/UCD mib2c.conf-ORIG copyright and better #include paths; and the ORIGinal. mib2c.storage.conf other config files, not modified. mib2c.vartypes.conf</PRE></TD></TR></TABLE><P>mib2c is provided BUT it requires the SNMP perl package SNMP-3.1.0,and that in turn requires perl nsPerl5.005_03 (part ofRed Hat Linux from 6.0, April 1999).</P><P>These are available from the CPAN (“the ComprehensivePerl Archive Network”) as usual;<AHREF="http://www.cpan.org/"TARGET="_top">http://www.cpan.org/</A>and links from there. Specifically:</P><P></P><UL><LI><P>PERL itself:<AHREF="http://people.netscape.com/kristian/nsPerl/"TARGET="_top">http://people.netscape.com/kristian/nsPerl/</A></P></LI><LI><P><AHREF="http://people.netscape.com/richm/nsPerl/nsPerl5.005_03-11-i686-linux.tar.gz"TARGET="_top">http://people.netscape.com/richm/nsPerl/nsPerl5.005_03-11-i686-linux.tar.gz</A></P></LI><LI><P>SNMP.pl<AHREF="http://www.cpan.org/modules/01modules.index.html"TARGET="_top">http://www.cpan.org/modules/01modules.index.html</A></P></LI><LI><P><AHREF="http://cpan.valueclick.com/modules/by-category/05_Networking_Devices_IPC/SNMP/"TARGET="_top">http://cpan.valueclick.com/modules/by-category/05_Networking_Devices_IPC/SNMP/</A></P></LI><LI><P><AHREF="http://www.cpan.org/authors/id/G/GS/GSM/SNMP.tar.gz"TARGET="_top">http://www.cpan.org/authors/id/G/GS/GSM/SNMP.tar.gz</A></P></LI></UL><P>(note that the .tar.gz files are not browsable)</P><P>For documentation on the files produced, see the documentationavailable at<AHREF="http://ucd-snmp.ucdavis.edu/"TARGET="_top">http://ucd-snmp.ucdavis.edu/</A>in general, and file <TTCLASS="FILENAME">AGENT.txt</TT> in particular.</P><P>It is likely that the output of mib2c will be further customizeddepending on eCos customer needs; it’s easy to do thisby editing the mib2c.conf file to add or remove whatever you needwith the resulting C sources.</P><P>The UCD autoconf-style configuration does not apply to eCos. So if you add a completely new MIB to the agent, and support itusing mib2c so that the my_new_mib.c file containsa init_my_new_mib() routine to registerthe MIB handler, you will also need to edit a couple of controlfiles; these claim to be auto-generated, but in the eCos release,they’re not, don’t worry.</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">PACKAGES/net/snmp/agent/VERSION/include/mib_module_includes.h</PRE></TD></TR></TABLE><P>contains a number of lines like</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">#include “mibgroup/mibII/interfaces.h”</PRE></TD></TR></TABLE><P>so add your new MIB thus:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">#include “mibgroup/mibII/my_new_mib.h”</PRE></TD></TR></TABLE><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">PACKAGES/net/snmp/agent/VERSION/include/mib_module_inits.h </PRE></TD></TR></TABLE><P>contains a number of lines like</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">init_interfaces(); init_dot3(); </PRE></TD></TR></TABLE><P>and so on; add your new MIB as follows:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">init_my_new_mib(); </PRE></TD></TR></TABLE><P>and this should work correctly.</P></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="net-snmp-unimplemented-features.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="ecos-ref.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="net-snmp-agent-manpages-snmpd.conf.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Unimplemented features</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="net-snmp-ecos-port.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">snmpd.conf</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -