[-]
[+]
|
Changed |
snmptt.spec
|
|
[-]
[+]
|
Changed |
snmptt_1.3.tar.bz2/ChangeLog
^
|
@@ -1,3 +1,69 @@
+November 15th, 2009: Alex Burger <alex_b@users.sourceforge.net>
+- Changed version to snmptt_1.3 for release.
+
+June 25th, 2009: Alex Burger <alex_b@users.sourceforge.net>
+- Changed version to snmptt_1.3beta2 for release.
+
+July 21th, 2009: Alex Burger <alex_b@users.sourceforge.net>July 18th, 2009:
+- Fixed bug with snmptthandler-embedded. It was using the wrong IP address
+ for hostname / ipaddress.
+
+July 18th, 2009: Alex Burger <alex_b@users.sourceforge.net>July 18th, 2009:
+- Updated documentation for 1.3beta1 release
+
+July 18th, 2009: Alex Burger <alex_b@users.sourceforge.net>July 18th, 2009:
+- Updated snmptthandler-embedded to support securityName and contextName.
+- Added variable substitutions Be, Bu, BE, Bn for SNMPv3 when using
+ snmptthandler-embedded.
+
+May 17th, 2009: Alex Burger <alex_b@users.sourceforge.net>
+- Added snmptthandler-embedded - a Net-SNMP embedded Perl version of
+ snmptthandler.
+- Added LSB init keywords and actions to snmptt-init.d and changed the
+ priority for start / stop so that it starts after snmptrapd and stops
+ before snmptrapd. Thanks to Ville Skytta for the patch.
+- Changed the default log path to /var/log/snmptt for Unix and c:\snmpt\log
+ for Windows to make it easier to grant write permission to the snmptt
+ process. Thanks to Ville Skytta for the patch.
+- Changed umask for log files to 002 to ensure they are not created as world
+ writable. Thanks to Ville Skytta for the suggestion.
+- Fixed a bug where the the PID file was being created using the parent (root)
+ PID instead of the child (daemon_uid) when daemon_uid is used.
+- The DEBUG log file will now be re-opened when a HUP signal is sent. Thanks
+ to Ville Skytta for the suggestion.
+- When debugging is enabled, flush buffers every sleep cycle so we can tail
+ the debug log file.
+- Don't print messages to the console when starting in daemon mode unless
+ debugging is enabled or an error occurs. Thanks to Ville Skytta for the
+ suggestion.
+- 'Could not open debug output file!' is no longer reported when debugging
+ is disabled. Thanks to Ville Skytta for the suggestion.
+- Added snmptt.logrotate file from Ville Skytta.
+
+January 15th, 2009: Alex Burger <alex_b@users.sourceforge.net>
+- Re-applied patch for bug 1748512. Somehow it was added wrong and it
+ prevented trap lines that contained single line items inside of quotes
+ from working.
+
+August 4th, 2008: Alex Burger <alex_b@users.sourceforge.net>
+- Added duplicate_trap_window variable for duplicate trap detection.
+
+March 2nd, 2008: Alex Burger <alex_b@users.sourceforge.net>
+- Fixed a bug where with handling escaped quotes in a trap message.
+ Bug 1748512. Thanks to Erwin Abrahamse for the fix.
+
+October 12th, 2007: Alex Burger <alex_b@users.sourceforge.net>
+- Updated snmptt-net-snmp-test to test MIB descriptions.
+
+June 16th, 2007: Alex Burger <alex_b@users.sourceforge.net>
+- Changed version to snmptt_1.3beta1
+- Fixed a bug where snmpttconvertmib would not recognize a MIB file if the
+ DEFINITIONS ::= BEGIN line was split across two lines. Thanks to Alex
+ Peeters for reporting the bug. Bug 1678270.
+- Improved a previous bug fix for when a TRAP-TYPE / NOTIFICATION-TYPE line
+ was split across two lines. Fix did not allow the trap name to contain
+ a symbol such as a -.
+
June 16th, 2007: Alex Burger <alex_b@users.sourceforge.net>
- Changed version to snmptt_1.2 for release.
|
[-]
[+]
|
Changed |
snmptt_1.3.tar.bz2/docs/faqs.html
^
|
@@ -3,69 +3,112 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content=
-"HTML Tidy for Linux/x86 (vers 1st October 2003), see www.w3.org" />
-<meta content="text/html; charset=us-ascii" http-equiv="Content-Type" />
+"HTML Tidy for Linux (vers 14 June 2007), see www.w3.org" />
+<meta content="text/html; charset=us-ascii" http-equiv=
+"Content-Type" />
<meta content="Alex Burger" name="Author" />
-<meta content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]" name=
-"GENERATOR" />
+<meta content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"
+name="GENERATOR" />
<link rel="StyleSheet" type="text/css" href="layout1.css" />
-<title>SNMP Trap Translator v1.2</title>
+<title>SNMP Trap Translator v1.3</title>
</head>
<body>
<h1>SNMPTT FAQ / Troubleshooting</h1>
<b>(<a href="http://www.snmptt.org">www.snmptt.org</a>)</b><br />
-This file was last updated on: November 5th, 2005<br />
+This file was last updated on: July 18th, 2009<br />
<br />
-
<h2>Table of Contents</h2>
-
<h3>Installation</h3>
<ul>
- <li><a href="#What_version_of_NET-SNMP_should_I_run">What version of Net-SNMP should I run?</a></li>
- <li><a href="#Do_I_need_the_UCD-SNMP_Net-SNMP_Perl_module">Do I need the UCD-SNMP / Net-SNMP Perl module?</a></li>
- <li><a href="#I_want_to_enable_the_Perl_support_for_UCD-SNMP">I want to enable the Perl support for UCD-SNMP / Net-SNMP under Linux, but I installed UCD-SNMP / Net-SNMP using RPMs. What is the easiest way to install the module without recompiling everything?</a></li>
- <li><a href="#I_want_to_use_Net-SNMP_under_Windows">I want to use Net-SNMP under Windows. What should I do?</a></li>
- <li><a href="#How_to_I_enable_the_Perl_support_for_UCD-SNMP">How to I enable the Perl support for UCD-SNMP / Net-SNMP under Windows</a></li>
- <li><a href="#Are_there_any_sample_files_to_get_me_started">Are there any sample files to get me started?</a></li>
- <li><a href="#Why_doesn't_the_snmptt-init.d_script_work_with_Debian">Why doesn't the snmptt-init.d script work with Debian?</a></li>
+<li><a href="#What_version_of_NET-SNMP_should_I_run">What version
+of Net-SNMP should I run?</a></li>
+<li><a href="#Do_I_need_the_UCD-SNMP_Net-SNMP_Perl_module">Do I
+need the UCD-SNMP / Net-SNMP Perl module?</a></li>
+<li><a href="#I_want_to_enable_the_Perl_support_for_UCD-SNMP">I
+want to enable the Perl support for UCD-SNMP / Net-SNMP under
+Linux, but I installed UCD-SNMP / Net-SNMP using RPMs. What is the
+easiest way to install the module without recompiling
+everything?</a></li>
+<li><a href="#I_want_to_use_Net-SNMP_under_Windows">I want to use
+Net-SNMP under Windows. What should I do?</a></li>
+<li><a href="#How_to_I_enable_the_Perl_support_for_UCD-SNMP">How to
+I enable the Perl support for UCD-SNMP / Net-SNMP under
+Windows</a></li>
+<li><a href="#Which_trap_handler_should_I_use"><b><span style=
+"font-weight: bold;">Which trap handler should I use?
+ snmptthandler or snmptthandler-embedded?</span></b></a></li>
+<li><a href="#Are_there_any_sample_files_to_get_me_started">Are
+there any sample files to get me started?</a></li>
+<li><a href=
+"#Why_doesn%27t_the_snmptt-init.d_script_work_with_Debian">Why
+doesn't the snmptt-init.d script work with Debian?</a></li>
</ul>
-
<h3>General</h3>
<ul>
- <li><a href="#I_have_enabled_net_snmp_perl_enable_but_the_variable">I have enabled net_snmp_perl_enable but the variable names are not being translated into text using $v<i>n, $-n, $+n, $-* or $+*</i>. How do I troubleshoot it?</a></li>
- <li><a href="#I_have_enabled_net_snmp_perl_enable_but_the_variable">I have enabled translate_integers but the integer values are not being translated into text. How do I troubleshoot it?</a></li>
-
- <li><a href="#SNMPTT_is_not_working">SNMPTT is not working! How do I troubleshoot it?</a></li>
- <li><a href="#I_have_configured_SNMPTT_correctly_with_an_snmptt">I have configured SNMPTT correctly with an snmptt.ini file, snmptt.conf file(s) etc and it still does not process traps. Everything appears in the snmpttunknowntrap.log file. What did I do wrong?</a></li>
- <li><a href="#I_have_disabled_syslog_support_in_SNMPTT">I have disabled syslog support in SNMPTT, but my syslog (or NT Event Log) is still filling up with trap messages. How do I disable them?</a></li>
- <li><a href="#I_have_disabled_syslog_support_in_SNMPTT">I am using syslog (or NT Event Log) to log trap messages, but there are two log entries for each trap received. How do I prevent it?</a></li>
- <li><a href="#I_set_translate_oids_or_translate_trap_oid">I set translate_oids or translate_trap_oid, but the trap is being logged in numerical form. Why?</a></li>
- <li><a href="#I_converted_a_MIB_using_snmpttconvertmib_but_the_OIDs">I converted a MIB using snmpttconvertmib but the OIDs are appearing as text instead of being numerical. Why?</a></li>
- <li><a href="#Does_SNMPTT_use_DNS">Does SNMPTT use DNS?</a></li>
-
- <li><a href="#Is_there_a_front-end_alarm_browser_available_for_SNMPTT">Is there a front-end alarm browser available for SNMPTT?</a></li>
- <li><a href="#When_I_convert_a_MIB_file_using_snmpttconvertmib">When I convert a MIB file using snmpttconvertmib I get 'Bad operator (_) errors</a></li>
- <li><a href="#Double_quotation_marks">Double quotation marks (") are being logged with a \ in front of them. How can this be disabled?</a></li>
- <li><a href="#Each_trap_received_is_being_logged_multiple">Each trap received is being logged multiple times. Why?</a></li>
+<li><a href=
+"#I_have_enabled_net_snmp_perl_enable_but_the_variable">I have
+enabled net_snmp_perl_enable but the variable names are not being
+translated into text using $v<i>n, $-n, $+n, $-* or $+*</i>. How do
+I troubleshoot it?</a></li>
+<li><a href=
+"#I_have_enabled_net_snmp_perl_enable_but_the_variable">I have
+enabled translate_integers but the integer values are not being
+translated into text. How do I troubleshoot it?</a></li>
+<li><a href="#SNMPTT_is_not_working">SNMPTT is not working! How do
+I troubleshoot it?</a></li>
+<li><a href="#I_have_configured_SNMPTT_correctly_with_an_snmptt">I
+have configured SNMPTT correctly with an snmptt.ini file,
+snmptt.conf file(s) etc and it still does not process traps.
+Everything appears in the snmpttunknowntrap.log file. What did I do
+wrong?</a></li>
+<li><a href="#I_have_disabled_syslog_support_in_SNMPTT">I have
+disabled syslog support in SNMPTT, but my syslog (or NT Event Log)
+is still filling up with trap messages. How do I disable
+them?</a></li>
+<li><a href="#I_have_disabled_syslog_support_in_SNMPTT">I am using
+syslog (or NT Event Log) to log trap messages, but there are two
+log entries for each trap received. How do I prevent it?</a></li>
+<li><a href="#I_set_translate_oids_or_translate_trap_oid">I set
+translate_oids or translate_trap_oid, but the trap is being logged
+in numerical form. Why?</a></li>
+<li><a href=
+"#I_converted_a_MIB_using_snmpttconvertmib_but_the_OIDs">I
+converted a MIB using snmpttconvertmib but the OIDs are appearing
+as text instead of being numerical. Why?</a></li>
+<li><a href="#Does_SNMPTT_use_DNS">Does SNMPTT use DNS?</a></li>
+<li><a href=
+"#Is_there_a_front-end_alarm_browser_available_for_SNMPTT">Is there
+a front-end alarm browser available for SNMPTT?</a></li>
+<li><a href=
+"#When_I_convert_a_MIB_file_using_snmpttconvertmib">When I convert
+a MIB file using snmpttconvertmib I get 'Bad operator (_)
+errors</a></li>
+<li><a href="#Double_quotation_marks">Double quotation marks (")
+are being logged with a \ in front of them. How can this be
+disabled?</a></li>
+<li><a href="#Each_trap_received_is_being_logged_multiple">Each
+trap received is being logged multiple times. Why?</a></li>
</ul>
<br />
-
-<a name="What_version_of_NET-SNMP_should_I_run"></a>
-<b>Q: What version of Net-SNMP should I run?</b>
-<p>A: If you have no plans on using the Net-SNMP Perl module (see the
-next question), then any recent version of Net-SNMP or UCD-SNMP should be
-sufficient with the exception of Net-SNMP 5.1. Net-SNMP 5.1.1 and higher
-can be used. If you plan on using UCD-SNMP 4.2.3 (provided by Compaq for
-RedHat 7.2), then you must at least use a newer version of <span style=
+<a name="What_version_of_NET-SNMP_should_I_run" id=
+"What_version_of_NET-SNMP_should_I_run"></a> <b>Q: What
+version of Net-SNMP should I run?</b>
+<p>A: If you have no plans on using the Net-SNMP Perl module
+(see the next question), then any recent version of Net-SNMP should
+be sufficient with the exception of Net-SNMP 5.1. Net-SNMP
+5.1.1 and higher can be used. If you plan on using UCD-SNMP
+4.2.3 (provided by Compaq for RedHat 7.2), then you must at least
+use a newer version of <span style=
"font-weight: bold;">snmptrapd</span>.</p>
<p>If you plan on enabling the Net-SNMP Perl module, <span style=
-"font-weight: bold;">Net-SNMP v5.1.1 or higher is</span> <span style=
-"font-weight: bold;">recommended</span>. This will allow you to use all
-the features of snmptt. Net-SNMP 5.0.8 and 5.0.9 can also be
-patched with <a style="font-weight: bold;" href=
+"font-weight: bold;">Net-SNMP v5.1.1 or higher is</span>
+<span style="font-weight: bold;">recommended</span>. This
+will allow you to use all the features of snmptt. Net-SNMP
+5.0.8 and 5.0.9 can also be patched with <a style=
+"font-weight: bold;" href=
"http://sourceforge.net/tracker/index.php?func=detail&aid=722075&group_id=12694&atid=312694">
-patch 722075</a> to provide similar functionality. The patch is
-available from the <a href=
+patch 722075</a> to provide similar functionality. The patch
+is available from the <a href=
"http://sourceforge.net/tracker/index.php?func=detail&aid=722075&group_id=12694&atid=312694">
Net-SNMP patch page</a>.</p>
The standard way to apply the patch is to follow these steps:<br />
@@ -77,361 +120,518 @@
<li>Compile Net-SNMP as per Net-SNMP documentation<br /></li>
</ol>
<p>If you run freebsd, you can simply copy the patch file into
-/usr/ports/net/net-snmp/files and rename it to patch-snmp-72205. When
-you rebuild Net-SNMP, the patch will be included.</p>
+/usr/ports/net/net-snmp/files and rename it to
+patch-snmp-72205. When you rebuild Net-SNMP, the patch will
+be included.</p>
<p><br />
-
-<a name="Do_I_need_the_UCD-SNMP_Net-SNMP_Perl_module"></a>
-<b>Q: Do I need the UCD-SNMP / Net-SNMP Perl module?<br /></b></p>
-A: SNMPTT does not REQUIRE the Perl module, but it is recommended.
-By enabling the Perl module, you will get the following benefits:<br />
+<a name="Do_I_need_the_UCD-SNMP_Net-SNMP_Perl_module" id=
+"Do_I_need_the_UCD-SNMP_Net-SNMP_Perl_module"></a> <b>Q: Do I need
+the UCD-SNMP / Net-SNMP Perl module?<br /></b></p>
+A: SNMPTT does not REQUIRE the Perl module, but it is
+recommended. By enabling the Perl module, you will get the
+following benefits:<br />
<ul>
-<li>Proper $v, $E, $O, $-n, $+n, $-*, $+* (and others that use textual names)
-variable substitution</li>
+<li>Proper $v, $E, $O, $-n, $+n, $-*, $+* (and others that use
+textual names) variable substitution</li>
<li>Conversion of numerical OIDs to text form</li>
<li>Conversion of INTEGER values to enumeration tags (for example:
<span style="font-weight: bold;">Status is now OK</span> instead of
<span style="font-weight: bold;">Status is now 1</span>)</li>
-<li>Conversion of the enterprise into textual form for logging to SQL
-databases</li>
+<li>Conversion of the enterprise into textual form for logging to
+SQL databases</li>
<li>Ability for traps passed from <span style=
-"font-weight: bold;">snmptrapd</span>or loaded from the <span style=
-"font-weight: bold;">snmptt.conf</span> files to contain symbolic OIDs such as
-<span style="font-weight: bold;">linkDown</span> and <span style=
+"font-weight: bold;">snmptrapd</span> or loaded from the
+<span style="font-weight: bold;">snmptt.conf</span> files to
+contain symbolic OIDs such as <span style=
+"font-weight: bold;">linkDown</span> and <span style=
"font-weight: bold;">IF-MIB::linkUp</span></li>
-<li>Variable syntax, description and enums when converting a MIB file using
-snmpttconvertmib</li>
+<li>Variable syntax, description and enums when converting a MIB
+file using snmpttconvertmib</li>
</ul>
-Unless Net-SNMP 5.1.1 or 5.0.8 / 5.0.9 with patch 72205 is used, some Perl
-features may not work correctly. The use of Net-SNMP 5.1.1 or 5.0.8 /
-5.0.9 with patch 72205 is <span style="font-weight: bold;">highly
-recommended</span>.<br />
-<br />
-Note1: In addition to the regular Perl modules, Net-SNMP allows Perl to be
-embedded into the SNMP agent by specifying --enable-embedded-perl during compilation.
-This is <b>not</b> currently required by SNMPTT.<br />
-<br />
-Note2: Do not confuse the CPAN module Net::SNMP (use Net::SNMP;) with the Net-SNMP Perl
-module (use SNMP;). They are two completely unrelated programs. Net::SNMP is a
-stand-alone SNMP module for Perl, while the Net-SNMP Perl module is a Perl
-extension of the <a href="http://www.net-snmp.org">Net-SNMP</a> software and
-is included with <a href="http://www.net-snmp.org">Net-SNMP</a>.<br />
+Unless Net-SNMP 5.1.1 or higher or 5.0.8 / 5.0.9 with patch 72205
+is used, some Perl features may not work correctly. The use
+of Net-SNMP 5.1.1 or higher or 5.0.8 / 5.0.9 with patch 72205 is
+<span style="font-weight: bold;">highly recommended</span>.<br />
+<br />
+Note1: In addition to the regular Perl modules, Net-SNMP
+allows Perl to be embedded into the SNMP agent (snmpd) and trap
+receiver (snmptrapd) by specifying --enable-embedded-perl during
+compilation. This is <b>only</b> required by SNMPTT if you plan on
+using the embedded trap handler (snmptthandler-embedded).<br />
+<br />
+Note2: Do not confuse the CPAN module Net::SNMP (use
+Net::SNMP;) with the Net-SNMP Perl module (use SNMP;). They
+are two completely unrelated programs. Net::SNMP is a
+stand-alone SNMP module for Perl, while the Net-SNMP Perl module is
+a Perl extension of the <a href=
+"http://www.net-snmp.org">Net-SNMP</a> software and is included
+with <a href="http://www.net-snmp.org">Net-SNMP</a>. Distributions
+such as RedHat provide the Perl modules in a separate RPM package
+called 'net-snmp-perl'.<br />
<br />
<p><br />
-
-<a name="I_want_to_enable_the_Perl_support_for_UCD-SNMP"></a>
-<b>Q: I want to enable the Perl support for UCD-SNMP / Net-SNMP under
-Linux, but I installed UCD-SNMP / Net-SNMP using RPMs. What is the
-easiest way to install the module without recompiling everything?</b></p>
-<p>A: You should not have to re-compile the entire package. Try
-the following:</p>
+<a name="I_want_to_enable_the_Perl_support_for_UCD-SNMP" id=
+"I_want_to_enable_the_Perl_support_for_UCD-SNMP"></a> <b>Q: I
+want to enable the Perl support for </b><b> </b><b>under
+Linux, but I installed </b><b>Net-SNMP /</b> <b>UCD-SNMP</b>
+<b>using RPMs. What is the easiest way to install the module
+without recompiling everything?</b></p>
+<p>A: There are two Perl components for Net-SNMP:</p>
+<p style="margin-left: 40px;">1) The Perl modules which allow you
+to create stand-alone Perl programs that use the 'SNMP' module (use
+SNMP;)</p>
+<p style="margin-left: 40px;">2) Embedded Perl for snmpd and
+snmptrapd which allow you to write Perl programs that are loaded
+and run from inside of snmpd and snmptrapd.</p>
+The Perl modules (1) are optional but recommended. See
+<a href="Do_I_need_the_UCD-SNMP_Net-SNMP_Perl_module"><b>Do I need
+the UCD-SNMP / Net-SNMP Perl module?</b></a> for the benefits of
+enabling the Perl modules.<br />
+<p>Embedded Perl (2) is only needed if you want to use the embedded
+trap handler (snmptthandler-embedded).See xxxxx for the benefits of
+using the embedded handler.</p>
+<p>For the Perl modules (1), most Linux distributions provide RPMs.
+ For RedHat, install the net-snmp-perl RPM package using
+yum.</p>
+<p>If you compiled Net-SNMP from source, then the Perl module
+should be enabled by default. Typing the following is an easy
+test to see if the Perl module has been installed:</p>
+<p style="margin-left: 40px;">perl</p>
+<p style="margin-left: 40px;">use SNMP;</p>
+<p>If you get an error message starting with 'Can't locate SNMP.pm
+in @INC....' then the Perl module has not been installed.
+ Press control-C to exit Perl if there was no error.</p>
+<p>For embedded Perl support (2), you may have to compile
+Net-SNMP yourself using the '--enable-embedded-perl' configuration
+option. To test to see if you already have embedded Perl
+enabled:</p>
+<p> Type <span style=
+"font-weight: bold;">snmptrapd -H 2>&1 | grep perl</span>.
+ It should give <span style="font-weight: bold;">perl
+ PERLCODE</span> if embedded Perl is enabled. </p>
+<p> If it's not available, you need to compile
+and install Net-SNMP using the <span style=
+"font-weight: bold;">--enable-embedded-perl</span> configure
+option. Use the net-snmp-users mail list for assistance.</p>
+<p>If you are using UCD-SNMP, you should not have to re-compile the
+entire package. Try the following:</p>
<ol>
-<li>Download the source RPM that matches the binary RPM you downloaded.
-For example: ucd-snmp-4.2.3-1.src.rpm</li>
+<li>Download the source RPM that matches the binary RPM you
+downloaded. For example: ucd-snmp-4.2.3-1.src.rpm</li>
<li>Install the RPM</li>
-<li>Locate the installed source code. For Mandrake, it should be in
-/usr/src/RPM/SOURCES</li>
+<li>Locate the installed source code. For Mandrake, it should
+be in /usr/src/RPM/SOURCES</li>
<li>Go into the sub directory perl/SNMP</li>
<li>Follow the instructions in the README file</li>
</ol>
-<p>Note: If you have installed Net-SNMP 5.0.9 or 5.0.8 using RPM
-packages, and want to apply patch 722075, you will need to re-compile the
-entire package and re-install. Patch 722075 makes modifications to both
-the Perl source files, and the main snmp libraries so the above steps will not
-work.</p>
+<p>Note: If you have installed Net-SNMP 5.0.9 or 5.0.8 using
+RPM packages, and want to apply patch 722075, you will need to
+re-compile the entire package and re-install. Patch 722075
+makes modifications to both the Perl source files, and the main
+snmp libraries so the above steps will not work.</p>
<p><br />
-
-<a name="I_want_to_use_Net-SNMP_under_Windows"></a>
-<b><span style="font-weight: bold;">Q: I want to use Net-SNMP under
- Windows. What should I do?</span></b></p>
-<p>A: You have at least three options:</p>
+<a name="I_want_to_use_Net-SNMP_under_Windows" id=
+"I_want_to_use_Net-SNMP_under_Windows"></a> <b><span style=
+"font-weight: bold;">Q: I want to use Net-SNMP under
+Windows. What should I do?</span></b></p>
+<br />
+<p>A: You have at least three options:</p>
<ol>
-<li>Download the Net-SNMP 5.1.2+ binary from the Net-SNMP home page and
-install.<br /></li>
-<li>Download the Net-SNMP 5.1.2+ source and compile using MSVC++, MinGW or
-Cygwin as described in the Net-SNMP README.WIN32 file. This should
-create a working snmptrapd. See the question: <b><span style=
-"font-weight: bold;">How to I enable the Perl support for UCD-SNMP / Net-SNMP
-under Windows</span></b><span style="font-weight: bold;">?</span> Note:
-Net-SNMP 5.1.2 or higher is recommended if compiling under Windows as it
-contains the latest Windows specific compiling improvements.<br /></li>
+<li>Download the Net-SNMP 5.1.2+ binary from the Net-SNMP home page
+and install.<br /></li>
+<li>Download the Net-SNMP 5.1.2+ source and compile using MSVC++,
+MinGW or Cygwin as described in the Net-SNMP README.WIN32
+file. This should create a working snmptrapd. See the
+question: <b><span style="font-weight: bold;">How to I enable the
+Perl support for UCD-SNMP / Net-SNMP under
+Windows</span></b><span style="font-weight: bold;">?</span> Note:
+Net-SNMP 5.1.2 or higher is recommended if compiling under Windows
+as it contains the latest Windows specific compiling
+improvements.<br /></li>
</ol>
-<p>
-
-<a name="How_to_I_enable_the_Perl_support_for_UCD-SNMP"></a>
+<p><a name="How_to_I_enable_the_Perl_support_for_UCD-SNMP" id=
+"How_to_I_enable_the_Perl_support_for_UCD-SNMP"></a>
<b><span style="font-weight: bold;"><br />
-Q: How to I enable the Perl support for UCD-SNMP / Net-SNMP under
-Windows</span></b><span style="font-weight: bold;">?</span></p>
-<p style="font-weight: bold; text-decoration: underline;">Native Windows:</p>
-<p style="margin-left: 40px;">Install ActiveState ActivePerl and then the
-ActivePerl <b>.ppm</b> module included in the Net-SNMP binary available from the
-<a href="http://www.net-snmp.org">Net-SNMP web site</a>.</p>
-<p style="margin-left: 40px;">If you compiled your own version of Net-SNMP,
-see the perl/README document for instructions on compiling the Perl
-modules.</p>
+Q: How to I enable the Perl support for UCD-SNMP / Net-SNMP
+under Windows</span></b><span style=
+"font-weight: bold;">?</span></p>
+<p>A: There are two Perl components for Net-SNMP:</p>
+<p style="margin-left: 40px;">1) The Perl modules which allow you
+to create stand-alone Perl programs that use the 'SNMP' module (use
+SNMP;)</p>
+<p style="margin-left: 40px;">2) Embedded Perl for snmpd and
+snmptrapd which allow you to write Perl programs that are loaded
+and run from inside of snmpd and snmptrapd.</p>
+The Perl modules (1) are optional but recommended. See
+<a href="Do_I_need_the_UCD-SNMP_Net-SNMP_Perl_module"><b>Do I need
+the UCD-SNMP / Net-SNMP Perl module?</b></a> for the benefits of
+enabling the Perl modules.<br />
+<br />
+<p>As of July 2009, embedded Perl (2) is not currently supported
+under Windows.</p>
+<p style="font-weight: bold; text-decoration: underline;">Native
+Windows:</p>
+<p style="margin-left: 40px;">Install ActiveState ActivePerl and
+then the ActivePerl <b>.ppm</b> module included in the Net-SNMP
+binary available from the <a href=
+"http://www.net-snmp.org">Net-SNMP web site</a>.</p>
+<p style="margin-left: 40px;">If you compiled your own version of
+Net-SNMP, see the perl/README document for instructions on
+compiling the Perl modules.</p>
<p><span style=
"font-weight: bold; text-decoration: underline;">Cygwin:</span></p>
-<p style="margin-left: 40px;">Download the Net-SNMP 5.1.2+ source and compile
-using Cygwin as described in the Net-SNMP README.WIN32 file.</p>
-<p style="margin-left: 40px;">Compile the Perl modules as described in the
-perl\SNMP\README file. </p>
+<p style="margin-left: 40px;">Download the Net-SNMP 5.1.2+ source
+and compile using Cygwin as described in the Net-SNMP README.WIN32
+file.</p>
+<p style="margin-left: 40px;">Compile the Perl modules as described
+in the perl\SNMP\README file. </p>
<p style="margin-left: 40px;">The program <span style=
-"font-weight: bold;">snmptt-net-snmp-test</span> can be used to perform
-various translations to test the functionality of the installed UCD-SNMP /
-Net-SNMP Perl module. The value of <span style=
-"font-weight: bold;">best_guess</span> can be specified on the command line to
-determine how translations should occur. If you are using 5.0.8+ with
-patch 722075 or 5.1.1+, use: <span style=
-"font-weight: bold;">snmptt-net-snmp-test --best_guess=2</span>.</p>
-
-<a name="Are_there_any_sample_files_to_get_me_started"></a>
-<p><b>Q: Are there any sample files to get me started?<br /></b></p>
-A: Yes, the examples folder contains a sample snmptt.conf file, and a
-sample trap file for testing.<br />
+"font-weight: bold;">snmptt-net-snmp-test</span> can be used to
+perform various translations to test the functionality of the
+installed UCD-SNMP / Net-SNMP Perl module. The value of
+<span style="font-weight: bold;">best_guess</span> can be specified
+on the command line to determine how translations should
+occur. If you are using 5.0.8+ with patch 722075 or 5.1.1+,
+use: <span style="font-weight: bold;">snmptt-net-snmp-test
+--best_guess=2</span>.</p>
+<p><b><span style="font-weight: bold;"><a name=
+"Which_trap_handler_should_I_use" id=
+"Which_trap_handler_should_I_use"></a> Q: Which trap
+handler should I use? snmptthandler or
+snmptthandler-embedded?</span></b></p>
+<p>A: The standard handler is fine for most installations.
+ The embedded handler was introduced in snmptt 1.3 and is
+recommended if there is a high volume of traps being received.</p>
+<p><span style=
+"text-decoration: underline; font-style: italic;">Standard
+Handler:</span></p>
+<p>The standard handler is a small Perl program that is called each
+time a trap is received by snmptrapd when using daemon mode.
+ The limitations of this handler are:<br /></p>
+<ul>
+<li>Each time a trap is received, a process must be created to run
+the snmptthandler program and snmptt.ini is read each
+time.</li>
+<li>SNMPv3 EngineID and names are not passed by snmptrapd to
+snmptthandler</li>
+</ul>
+The benefits of using this handler are:<br />
+<ul>
+<li>Does not require embedded Perl for snmptrapd</li>
+<li>Has been around since v0.1 if snmptt.</li>
+<li>Sufficient for most installations</li>
+</ul>
+<p><span style=
+"text-decoration: underline; font-style: italic;">Embedded Handler:</span></p>
+The embedded handler is a small Perl program that is loaded
+directly into snmptrapd when snmptrapd is started. The
+limitations of this handler are:<br />
+<ul>
+<li>Requires embedded Perl for snmptrapd</li>
+<li>Only works with daemon mode</li>
+</ul>
+The benefits of using this handler are:<br />
+<ul>
+<li>The handler is loaded and initialized when snmptrapd is
+started, so there is less overhead as a new process does not need
+to be created and initialization is done only once (loading of
+snmptt.ini).</li>
+<li>SNMPv3 EngineID and names variables are available in snmptt (B*
+variables)<br /></li>
+</ul>
+<br />
+<a name="Are_there_any_sample_files_to_get_me_started" id=
+"Are_there_any_sample_files_to_get_me_started"></a>
+<p><b>Q: Are there any sample files to get me
+started?<br /></b></p>
+A: Yes, the examples folder contains a sample snmptt.conf
+file, and a sample trap file for testing.<br />
<ol>
<li>Install SNMPTT as described in this document</li>
-<li>Copy the <span style="font-weight: bold;">snmptt.conf.generic</span> file
-to the location specified in the snmptt.ini file (probably <span style=
+<li>Copy the <span style=
+"font-weight: bold;">snmptt.conf.generic</span> file to the
+location specified in the snmptt.ini file (probably <span style=
"font-weight: bold;">/etc/snmp/</span> or <span style=
"font-weight: bold;">c:\snmp</span>)</li>
-<li>Add <span style="font-weight: bold;">snmptt.conf.generic</span> to the
-<span style="font-weight: bold;">snmptt_conf_files</span> section of
-<span style="font-weight: bold;">snmptt.ini</span>.</li>
-<li>For standalong mode, test SNMPTT by typing: <b>snmptt <
-sample-trap.generic</b><br />
-For daemon mode, test SNMPTT by copying sample-trap.generic.daemon to the
-spool folder</li>
+<li>Add <span style="font-weight: bold;">snmptt.conf.generic</span>
+to the <span style="font-weight: bold;">snmptt_conf_files</span>
+section of <span style="font-weight: bold;">snmptt.ini</span>.</li>
+<li>For standalong mode, test SNMPTT by typing: <b>snmptt
+< sample-trap.generic</b><br />
+For daemon mode, test SNMPTT by copying sample-trap.generic.daemon
+to the spool folder</li>
<li>Check the logs files etc for a sample linkDown trap</li>
</ol>
-<p><br />
-
-<b><br />
-<a name="Why_doesn't_the_snmptt-init.d_script_work_with_Debian"></a>
-Q: Why doesn't the snmptt-init.d script work with Debian?</b><br />
-<br />
-The snmptt-init.d script provided with SNMPTT was written for Mandrake and
-RedHat. To make the script work with Debian without requiring any
-re-writing of the script, copy <span style=
+<p><b><br />
+<a name=
+"Why_doesn't_the_snmptt-init.d_script_work_with_Debian"></a>
+Q: Why doesn't the snmptt-init.d script work with
+Debian?</b><br />
+<br />
+The snmptt-init.d script provided with SNMPTT was written for
+Mandrake and RedHat. To make the script work with Debian
+without requiring any re-writing of the script, copy <span style=
"font-weight: bold;">/etc/init.d/skeleton</span> to <span style=
"font-weight: bold;">/etc/init.d/functions</span>.<br />
-
-<a name="I_have_enabled_net_snmp_perl_enable_but_the_variable"></a>
-<p><b>Q: I have enabled net_snmp_perl_enable but the variable names are
-not being translated into text using $v<i>n, $-n, $+n, $-* or $+*</i>.
-How do I troubleshoot it?</b><br />
-<b>Q: I have enabled translate_integers but the integer values are not
-being translated into text. How do I troubleshoot it?</b></p>
-<p>A: You must have the UCD-SNMP / Net-SNMP Perl module installed and
-working, and must ensure UCD-SNMP / Net-SNMP is configured correctly with all
-the required MIBS.</p>
-<p>For starters, make sure the SNMP module is working. Type:</p>
+<a name="I_have_enabled_net_snmp_perl_enable_but_the_variable" id=
+"I_have_enabled_net_snmp_perl_enable_but_the_variable"></a></p>
+<p><b>Q: I have enabled net_snmp_perl_enable but the variable
+names are not being translated into text using $v<i>n, $-n, $+n,
+$-* or $+*</i>. How do I troubleshoot it?</b><br />
+<b>Q: I have enabled translate_integers but the integer
+values are not being translated into text. How do I
+troubleshoot it?</b></p>
+<p>A: You must have the UCD-SNMP / Net-SNMP Perl module
+installed and working, and must ensure UCD-SNMP / Net-SNMP is
+configured correctly with all the required MIBS.</p>
+<p>For starters, make sure the SNMP module is working.
+Type:</p>
<blockquote>perl<br />
use SNMP;</blockquote>
-If you get an error after typing 'use SNMP', then the module is not installed
-correctly. Re-install the module and make sure you execute the tests
-while building.
-<p>If the MIB files are present, but translations do not occur, ensure
-UCD-SNMP / Net-SNMP is correctly configured to process all the required
-mibs. This is configured in the snmp.conf file. Alternatively, you
-can try setting the <b>mibs_enviroment</b> variable in snmptt.ini to
-<b>ALL</b> (no quotes) to force all MIBS to be initialized at SNMPTT
-startup.</p>
-<p>If everything appears to be fine, try translating the variable name by hand
-by using snmptranslate. Get the variable name OID from the snmptt.debug
-file from the second Value 0+ section, and type:</p>
+If you get an error after typing 'use SNMP', then the module is not
+installed correctly. Re-install the module and make sure you
+execute the tests while building.
+<p>If the MIB files are present, but translations do not occur,
+ensure UCD-SNMP / Net-SNMP is correctly configured to process all
+the required mibs. This is configured in the snmp.conf
+file. Alternatively, you can try setting the
+<b>mibs_enviroment</b> variable in snmptt.ini to <b>ALL</b> (no
+quotes) to force all MIBS to be initialized at SNMPTT startup.</p>
+<p>If everything appears to be fine, try translating the variable
+name by hand by using snmptranslate. Get the variable name
+OID from the snmptt.debug file from the second Value 0+ section,
+and type:</p>
<blockquote>snmptranslate -Td <i>oid</i></blockquote>
-This should return the OBJECT-TYPE for the variable if it exists in a MIB file
-<p>If you are using UCD-SNMP v4.2.3, then the variables will not translate
-properly because SNMPTRAPD does not pass them correctly to SNMPTT.
-Upgrade to a newer version of snmptrapd. </p>
-<br />
-
-<a name="SNMPTT_is_not_working"></a>
-<b>Q: SNMPTT is not working! How do I troubleshoot it?</b></p>
+This should return the OBJECT-TYPE for the variable if it exists in
+a MIB file
+<p>If you are using UCD-SNMP v4.2.3, then the variables will not
+translate properly because SNMPTRAPD does not pass them correctly
+to SNMPTT. Upgrade to a newer version of snmptrapd.
+ </p>
+<br />
+<a name="SNMPTT_is_not_working" id="SNMPTT_is_not_working"></a>
+<b>Q: SNMPTT is not working! How do I troubleshoot
+it?</b>
<p>A: Start by enabling <span style=
-"font-weight: bold;">enable_unknown_trap_log</span> in the <span style=
-"font-weight: bold;">snmptt.ini</span> file. Look inside this file to
-see if the traps are being passed correctly to SNMPTT but not being handled
-correctly. Next, enable debug mode of 2 and specify a debug text file to
-log to in the snmptt.ini file. After a trap is received, take a look at
-the file to try to determine what is going wrong. Disable both logs when
+"font-weight: bold;">enable_unknown_trap_log</span> in the
+<span style="font-weight: bold;">snmptt.ini</span> file. Look
+inside this file to see if the traps are being passed correctly to
+SNMPTT but not being handled correctly. Next, enable debug
+mode of 2 and specify a debug text file to log to in the snmptt.ini
+file. After a trap is received, take a look at the file to
+try to determine what is going wrong. Disable both logs when
you are finished.</p>
-<p>To make troubleshooting a particular trap easier when working in daemon
-mode, try the following. This will prevent you have having to
-continuously generate the trap on the host.</p>
+<p>To make troubleshooting a particular trap easier when working in
+daemon mode, try the following. This will prevent you have
+having to continuously generate the trap on the host.</p>
<ol>
<li>Shut down SNMPTT</li>
<li>Generate the trap</li>
-<li>Copy the resulting # file from the spool directory (/var/spool/snmptt) to
-the /tmp directory as /tmp/test-trap<br /></li>
-<li>Edit the file, removing the first line (which is a large number that
-contains the date / time)</li>
+<li>Copy the resulting # file from the spool directory
+(/var/spool/snmptt) to the /tmp directory as
+/tmp/test-trap<br /></li>
+<li>Edit the file, removing the first line (which is a large number
+that contains the date / time)</li>
<li>Run SNMPTT in standalone method using: <span style=
"font-weight: bold;">snmptt < test-trap</span><br /></li>
<li>Troubleshoot by using the log files etc<br /></li>
</ol>
<p><br />
-
-<a name="I_have_configured_SNMPTT_correctly_with_an_snmptt"></a>
-<b>Q: I have configured SNMPTT correctly with an snmptt.ini file,
-snmptt.conf file(s) etc and it still does not process traps. Everything
-appears in the snmpttunknowntrap.log file. What did I do wrong?</b></p>
-<p>A: You probably didn't start snmptrapd correctly. Make sure it
-is started using:</p>
+<a name="I_have_configured_SNMPTT_correctly_with_an_snmptt" id=
+"I_have_configured_SNMPTT_correctly_with_an_snmptt"></a>
+<b>Q: I have configured SNMPTT correctly with an snmptt.ini
+file, snmptt.conf file(s) etc and it still does not process
+traps. Everything appears in the snmpttunknowntrap.log
+file. What did I do wrong?</b></p>
+<p>A: You probably didn't start snmptrapd correctly.
+Make sure it is started using:</p>
<blockquote><b>snmptrapd -On</b></blockquote>
-If it is not started with <span style="font-weight: bold;">-On</span>, then it
-will not pass traps using numeric OIDs and SNMPTT will not process them.
-<p>As an alternative, you can edit your <b>snmp.conf</b> file to include the
-line: <b>printNumericOids 1. </b> This setting will take effect no matter
-what is used on the command line.</p>
-<p>Note: If the UCD-SNMP / Net-SNMP Perl module is installed and
-enabled, then SNMPTT should be able to handle traps passed using symbolic
-form. The Perl module (used by SNMPTT) in Net-SNMP 5.0.8 and previous
-versions should be able to handle single symbolic names (eg: coldTrap).
-UCD-SNMP may not properly convert symbolic names to numeric OIDs which could
-result in traps not being matched. A patch is available from the
-Net-SNMP web site for 5.0.8+ to allow it to handle other symbolic names such
-as module::symbolic name (eg: SNMPv2-MIB::coldTrap) etc. The patch is
-available from the contrib folder, or it can be downloaded from the <a href=
+If it is not started with <span style=
+"font-weight: bold;">-On</span>, then it will not pass traps using
+numeric OIDs and SNMPTT will not process them.
+<p>As an alternative, you can edit your <b>snmp.conf</b> file to
+include the line: <b>printNumericOids 1. </b> This setting
+will take effect no matter what is used on the command line.</p>
+<p>Note: If the UCD-SNMP / Net-SNMP Perl module is installed
+and enabled, then SNMPTT should be able to handle traps passed
+using symbolic form. The Perl module (used by SNMPTT) in
+Net-SNMP 5.0.8 and previous versions should be able to handle
+single symbolic names (eg: coldTrap). UCD-SNMP may not
+properly convert symbolic names to numeric OIDs which could result
+in traps not being matched. A patch is available from the
+Net-SNMP web site for 5.0.8+ to allow it to handle other symbolic
+names such as module::symbolic name (eg: SNMPv2-MIB::coldTrap)
+etc. The patch is available from the contrib folder, or it
+can be downloaded from the <a href=
"http://sourceforge.net/tracker/index.php?func=detail&aid=722075&group_id=12694&atid=312694">
-Net-SNMP patch page</a>. Net-SNMP 5.1.1 and higher contain this
-patch.</p>
+Net-SNMP patch page</a>. Net-SNMP 5.1.1 and higher contain
+this patch.</p>
<p><b><br />
-
-<a name="I_have_disabled_syslog_support_in_SNMPTT"></a>
- Q: I have disabled syslog support in SNMPTT, but my syslog (or NT Event
-Log) is still filling up with trap messages. How do I disable
+<a name="I_have_disabled_syslog_support_in_SNMPTT" id=
+"I_have_disabled_syslog_support_in_SNMPTT"></a> Q: I have
+disabled syslog support in SNMPTT, but my syslog (or NT Event Log)
+is still filling up with trap messages. How do I disable
them?</b><br />
-<b>Q: I am using syslog (or NT Event Log) to log trap messages, but
-there are two log entries for each trap received. How do I prevent
-it?</b></p>
-<p>A: What you are seeing are <b>snmptrapd</b> trap messages, not SNMPTT
-messages. SNMPTT trap messages start with '<b>snmptt[<span style=
-"font-style: italic;">pid</span>]:</b>' while snmptrapd messages start with
-'<b>snmptrapd[<span style="font-style: italic;">pid</span>]:</b>'. If
-you do not start snmptrapd with either the <b>-P</b> or <b>-o</b> (lowercase
-o) switches, syslog support will be forced on. Snmptrapd should be
-started using '<b>snmptrapd -On</b>' and this results in syslog being forced
-on. The reason for this is the original design of snmptrapd assumed that
-if you are not going to display messages on the screen or log to a file, then
-you must want syslog output.</p>
-<p>A workaround is to have snmptrapd log all messages to /dev/null, or to a
-text file that can be regularily purged if needed. To log to a text
-file, start snmptrapd using:</p>
-<blockquote><b>snmptrapd -On -o /var/log/snmptrapd.log</b></blockquote>
-This will cause <b>ALL</b> snmptrapd messages to be logged to the file which
-means all snmptrapd 'system' messages such as startup and shutdown will not be
-logged to syslog.
-<p>A patch for Net-SNMP 5.0.7 is available that adds a new switch (-t) to
-prevent TRAP messages from being logged to syslog, but allowing system
-messages to continue to be logged. The patch is available from the
-<a href=
+<b>Q: I am using syslog (or NT Event Log) to log trap
+messages, but there are two log entries for each trap
+received. How do I prevent it?</b></p>
+<p>A: What you are seeing are <b>snmptrapd</b> trap messages,
+not SNMPTT messages. SNMPTT trap messages start with
+'<b>snmptt[<span style="font-style: italic;">pid</span>]:</b>'
+while snmptrapd messages start with '<b>snmptrapd[<span style=
+"font-style: italic;">pid</span>]:</b>'. If you do not start
+snmptrapd with either the <b>-P</b> or <b>-o</b> (lowercase o)
+switches, syslog support will be forced on. Snmptrapd should
+be started using '<b>snmptrapd -On</b>' and this results in syslog
+being forced on. The reason for this is the original design
+of snmptrapd assumed that if you are not going to display messages
+on the screen or log to a file, then you must want syslog
+output.</p>
+<p>A workaround is to have snmptrapd log all messages to /dev/null,
+or to a text file that can be regularily purged if needed. To
+log to a text file, start snmptrapd using:</p>
+<blockquote><b>snmptrapd -On -o
+/var/log/snmptrapd.log</b></blockquote>
+This will cause <b>ALL</b> snmptrapd messages to be logged to the
+file which means all snmptrapd 'system' messages such as startup
+and shutdown will not be logged to syslog.
+<p>A patch for Net-SNMP 5.0.7 is available that adds a new switch
+(-t) to prevent TRAP messages from being logged to syslog, but
+allowing system messages to continue to be logged. The patch
+is available from the <a href=
"http://sourceforge.net/tracker/?func=detail&atid=312694&aid=695312&group_id=12694">
-Net-SNMP patch section</a>. This patch is available in Net-SNMP 5.1.1
-and higher. With this patch, snmptrapd should be started using:</p>
+Net-SNMP patch section</a>. This patch is available in
+Net-SNMP 5.1.1 and higher. With this patch, snmptrapd should
+be started using:</p>
<blockquote><b>snmptrapd -On -t</b></blockquote>
<p><br />
-
-<a name="I_set_translate_oids_or_translate_trap_oid"></a>
-<b>Q: I set translate_oids or translate_trap_oid, but the trap is being
- logged in numerical form. Why?<br /></b><b>Q: I set translate_oids or
- translate_trap_oid to 1 or 3 in snmptt.ini, but
- the trap is not being logged with a long symbolic name. Why?</b></p>
-A: The current version of Net-SNMP (5.0.9 at the time of this writing)
-and everything before it does not support including the module name (eg:
-<span style="font-weight: bold;">IF-MIB::</span>) when translating an OID and
-most of the 5.0.x versions do not properly tranlsate numeric OIDs to long
-symbolic names. A patch is available for 5.0.8+ that will appear in
-later releases of Net-SNMP (5.1.1+). The patch is available from the
-contrib folder, or it can be downloaded from the <a href=
+<a name="I_set_translate_oids_or_translate_trap_oid" id=
+"I_set_translate_oids_or_translate_trap_oid"></a> <b>Q: I set
+translate_oids or translate_trap_oid, but the trap is being logged
+in numerical form. Why?<br /></b><b>Q: I set
+translate_oids or translate_trap_oid to 1 or 3 in snmptt.ini, but
+the trap is not being logged with a long symbolic name.
+Why?</b></p>
+A: The current version of Net-SNMP (5.0.9 at the time of this
+writing) and everything before it does not support including the
+module name (eg: <span style="font-weight: bold;">IF-MIB::</span>)
+when translating an OID and most of the 5.0.x versions do not
+properly tranlsate numeric OIDs to long symbolic names. A
+patch is available for 5.0.8+ that will appear in later releases of
+Net-SNMP (5.1.1+). The patch is available from the contrib
+folder, or it can be downloaded from the <a href=
"http://sourceforge.net/tracker/index.php?func=detail&aid=722075&group_id=12694&atid=312694">
Net-SNMP patch page</a>.<br />
<br />
-The program <span style="font-weight: bold;">snmptt-net-snmp-test</span> can
-be used to perform various translations to test the functionality of the
-installed UCD-SNMP / NE-SNMP Perl module. The value of <span style=
-"font-weight: bold;">best_guess</span> can be specified on the command line to
-determine how translations should occur.<br />
-<br />
-<p>
-
-<a name="I_converted_a_MIB_using_snmpttconvertmib_but_the_OIDs"></a>
-<b>Q: I converted a MIB using snmpttconvertmib but the OIDs are appearing as text instead of being numerical.
+The program <span style=
+"font-weight: bold;">snmptt-net-snmp-test</span> can be used to
+perform various translations to test the functionality of the
+installed UCD-SNMP / NE-SNMP Perl module. The value of
+<span style="font-weight: bold;">best_guess</span> can be specified
+on the command line to determine how translations should
+occur.<br />
+<br />
+<p><a name="I_converted_a_MIB_using_snmpttconvertmib_but_the_OIDs"
+id="I_converted_a_MIB_using_snmpttconvertmib_but_the_OIDs"></a>
+<b>Q: I converted a MIB using snmpttconvertmib but the OIDs
+are appearing as text instead of being numerical.
Why?</b></p>
<blockquote><b>For example:</b></blockquote>
<blockquote><b>EVENT linkUp
.iso.org.dod.internet.snmpV2.snmpModules.snmpMIB.snmpMIBObjects.snmpTraps.linkUp
"Status Events" Normal</b>
<p><b>instead of</b></p>
-<p><b>EVENT linkUp .1.3.6.1.6.3.1.1.5.4 "Status Events" Normal</b></p>
+<p><b>EVENT linkUp .1.3.6.1.6.3.1.1.5.4 "Status Events"
+Normal</b></p>
</blockquote>
<p><br />
-A: <b>Snmpttconvertmib</b> uses the <b>snmptranslate</b> command to
-convert MIB files. With Net-SNMP v5.0.2 and newer, setting the
-<b>-On</b> switch on the <b>snmptranslate</b> command causes the output to be
-in numerical format, which is what is needed for <b>snmpttconvertmib</b>.</p>
-<p>With Net-SNMP v5.0.1 and all versions of UCD-SNMP, setting the -On switch
-will TOGGLE the setting of using numerical output. With Net-SNMP v5.0.2
-and newer, setting the -On switch will FORCE the output to be numerical.</p>
+A: <b>Snmpttconvertmib</b> uses the <b>snmptranslate</b>
+command to convert MIB files. With Net-SNMP v5.0.2 and newer,
+setting the <b>-On</b> switch on the <b>snmptranslate</b> command
+causes the output to be in numerical format, which is what is
+needed for <b>snmpttconvertmib</b>.</p>
+<p>With Net-SNMP v5.0.1 and all versions of UCD-SNMP, setting the
+-On switch will TOGGLE the setting of using numerical output.
+With Net-SNMP v5.0.2 and newer, setting the -On switch will FORCE
+the output to be numerical.</p>
<p><b>Snmpttconvermib</b> will use the<span style=
"font-weight: bold;">-On</span> switch for <span style=
-"font-weight: bold;">snmptranslate</span> <b>only</b> if it detects anything
-but UCD-SNMP or Net-SNMP v5.0.1.</p>
-<p>If you are using UCD-SNMP, or Net-SNMP v5.0.1, the best option is to modify
-your <b>snmp.conf</b> file (for UCD-SNMP / Net-SNMP), and add or modify the
-line:</p>
+"font-weight: bold;">snmptranslate</span> <b>only</b> if it detects
+anything but UCD-SNMP or Net-SNMP v5.0.1.</p>
+<p>If you are using UCD-SNMP, or Net-SNMP v5.0.1, the best option
+is to modify your <b>snmp.conf</b> file (for UCD-SNMP / Net-SNMP),
+and add or modify the line:</p>
<blockquote><b>printNumericOids 1</b></blockquote>
-This will cause all applications to output in numerical format including
-<b>snmptranslate</b>. Note: This will affect other UCD-SNMP / Net-SNMP
-programs you are using, if any.<br />
+This will cause all applications to output in numerical format
+including <b>snmptranslate</b>. Note: This will affect other
+UCD-SNMP / Net-SNMP programs you are using, if any.<br />
<br />
-
-<a name="Does_SNMPTT_use_DNS"></a>
+<a name="Does_SNMPTT_use_DNS" id="Does_SNMPTT_use_DNS"></a>
<b>Q: Does SNMPTT use DNS?</b><br />
<br />
-Only if it is enabled. See the <a href="#DNS">Name Resolution / DNS</a>
-section.<br />
+Only if it is enabled. See the <a href="#DNS">Name Resolution
+/ DNS</a> section.<br />
<br />
-
<p><b><br />
-
- <a name="Is_there_a_front-end_alarm_browser_available_for_SNMPTT"></a>
- Q: Is there a front-end alarm browser available for SNMPTT?</b></p>
+<a name="Is_there_a_front-end_alarm_browser_available_for_SNMPTT"
+id="Is_there_a_front-end_alarm_browser_available_for_SNMPTT"></a>
+Q: Is there a front-end alarm browser available for
+SNMPTT?</b></p>
<p>A: Take a look at <a href=
-"http://sourceforge.net/projects/snmptt-gui">SNMPTT-GUI</a>. SNMPTT-GUI
-aims to provide a web based frontend for SNMPTT. The GUI is made up of
-server side perl cgi scripts with client side javascripts which interfaces to
-a SQL database using DBI::ODBC.</p>
-<p>SNMPTT-GUI questions should be directed to the project admins on the
-<a href="http://sourceforge.net/projects/snmptt-gui/">SNMPTT-GUI Sourceforge
-page</a>.<br />
+"http://sourceforge.net/projects/snmptt-gui">SNMPTT-GUI</a>.
+SNMPTT-GUI aims to provide a web based frontend for SNMPTT.
+The GUI is made up of server side perl cgi scripts with client side
+javascripts which interfaces to a SQL database using DBI::ODBC.</p>
+<p>SNMPTT-GUI questions should be directed to the project admins on
+the <a href=
+"http://sourceforge.net/projects/snmptt-gui/">SNMPTT-GUI
+Sourceforge page</a>.<br />
</p>
-
-<a name="When_I_convert_a_MIB_file_using_snmpttconvertmib"></a>
-<p><b>Q: When I convert a MIB file using snmpttconvertmib I get 'Bad
-operator (_) errors.<br /></b><br />
-A: You need to enable support for underlines / underscores in MIB
-files. See the snmp.conf man page. Support can be enabled by
-adding this line to your <span style=
-"font-weight: bold;">~/.snmp/snmp.conf</span> file: </p>
-<div style="margin-left: 40px; font-weight: bold;">mibAllowUnderline 1</div>
-
+<a name="When_I_convert_a_MIB_file_using_snmpttconvertmib" id=
+"When_I_convert_a_MIB_file_using_snmpttconvertmib"></a>
+<p><b>Q: When I convert a MIB file using snmpttconvertmib I
+get 'Bad operator (_) errors.<br /></b><br />
+A: You need to enable support for underlines / underscores in
+MIB files. See the snmp.conf man page. Support can be
+enabled by adding this line to your main <span style=
+"font-weight: bold;">snmp.conf</span> file: </p>
+<div style="margin-left: 40px; font-weight: bold;">
+mibAllowUnderline 1</div>
<p><b><br />
-<a name="Double_quotation_marks"></a>
- Q: Double quotation marks (") are being logged with a \ in front of
-them. How can this be disabled?<br /></b><br />
-A: Set <span style="font-weight: bold;">remove_backslash_from_quotes =
-1</span> in the <span style="font-weight: bold;">snmptt.ini</span> to have the
-\ removed from double quotes (").</p>
-
-<br />
-<p><b><a name="Each_trap_received_is_being_logged_multiple"></a>
- Q: Each trap received is being logged multiple times. Why?<br /></b><br />
+<a name="Double_quotation_marks" id="Double_quotation_marks"></a>
+Q: Double quotation marks (") are being logged with a \ in
+front of them. How can this be disabled?<br /></b><br />
+A: Set <span style=
+"font-weight: bold;">remove_backslash_from_quotes = 1</span> in the
+<span style="font-weight: bold;">snmptt.ini</span> to have the \
+removed from double quotes (").</p>
+<br />
+<p><b><a name="Each_trap_received_is_being_logged_multiple" id=
+"Each_trap_received_is_being_logged_multiple"></a> Q: Each
+trap received is being logged multiple times. Why?<br /></b><br />
A: There are a few possible reasons for this.</p>
<ul>
- <li>The device is sending the trap multiple times. If the device is running Net-SNMP's agent (snmpd), make sure there is only ONE trapsink, trap2sink or informsink line in <b>snmpd.conf</b>. If you are sending the trap using SNMP V1, use <b>trapsink</b>. For SNMP V2, use <b>trap2sink</b>. For SNMP V3, use <b>informsink</b>. Having both a trapsink and a trap2sink for example will cause snmpd to send the trap <b>twice</b>. Once using SNMP V1 and once using SNMP V2. It is possible that snmpd is loading multiple <b>snmp.conf</b> files. Start <b>snmpd</b> using <b>snmpd -f -Dread_config</b> to see what configuration files are being loaded.</li>
- <li>Snmptrapd is passing the trap to SNMPTT multiple times. Ensure there is only one <b>traphandle</b> statement in <b>snmptrapd.conf</b>. It is possible that snmpdtrapd is loading multiple <b>snmptrapd.conf</b> files. Start <b>snmpdtrapd</b> using <b>snmpd -f -Dread_config</b> to see what configuration files are being loaded.</li>
- <li>There is more than one <b>EVENT</b> line defined in one or more <b>snmptt.conf</b> files for the trap and <b>multiple_event</b> is enabled in <b>snmptt.ini</b>. To find all duplicate <b>EVENT</b> entries, run <b>snmptt --dump</b></li>
+<li>The device is sending the trap multiple times. If the device is
+running Net-SNMP's agent (snmpd), make sure there is only ONE
+trapsink, trap2sink or informsink line in <b>snmpd.conf</b>. If you
+are sending the trap using SNMP V1, use <b>trapsink</b>. For SNMP
+V2, use <b>trap2sink</b>. For SNMP V3, use <b>informsink</b>.
+Having both a trapsink and a trap2sink for example will cause snmpd
+to send the trap <b>twice</b>. Once using SNMP V1 and once using
+SNMP V2. It is possible that snmpd is loading multiple
+<b>snmp.conf</b> files. Start <b>snmpd</b> using <b>snmpd -f
+-Dread_config</b> to see what configuration files are being
+loaded.</li>
+<li>Snmptrapd is passing the trap to SNMPTT multiple times. Ensure
+there is only one <b>traphandle</b> statement in
+<b>snmptrapd.conf</b>. It is possible that snmpdtrapd is loading
+multiple <b>snmptrapd.conf</b> files. Start <b>snmpdtrapd</b> using
+<b>snmpd -f -Dread_config</b> to see what configuration files are
+being loaded.</li>
+<li>There is more than one <b>EVENT</b> line defined in one or more
+<b>snmptt.conf</b> files for the trap and <b>multiple_event</b> is
+enabled in <b>snmptt.ini</b>. To find all duplicate <b>EVENT</b>
+entries, run <b>snmptt --dump</b></li>
</ul>
<p><br />
<br />
|
[-]
[+]
|
Changed |
snmptt_1.3.tar.bz2/docs/snmptt.html
^
|
@@ -1,8 +1,8 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content=
-"HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org"
-name="generator" />
+"HTML Tidy for Linux (vers 14 June 2007), see www.w3.org" name=
+"generator" />
<meta http-equiv="Content-Type" content=
"text/html; charset=us-ascii" />
<meta name="Author" content="Alex Burger" />
@@ -12,9 +12,9 @@
<title>SNMP Trap Translator</title>
</head>
<body>
-<h1>SNMP Trap Translator v1.2</h1>
+<h1>SNMP Trap Translator v1.3</h1>
<b>(<a href="http://www.snmptt.org">SNMPTT</a>)</b><br />
-This file was last updated on: June 16th, 2007
+This file was last updated on: November 15th, 2009
<p><a href="#License">License</a></p>
<p><a href="#What-is-it">SNMPTT</a></p>
<blockquote><a href="#What-is-it">What is it?</a><br />
@@ -25,7 +25,12 @@
<a href="#Installation-Overview">Installation</a><br />
<b> </b> <a href=
"#Installation-Overview">Overview</a><br />
-<b> </b> <a href="#Installation-Unix">Unix</a><br />
+<b> </b> <a href=
+"snmptt.html#Installation-Unix">Unix</a><br />
+<div style="margin-left: 40px;"><a href=
+"snmptt.html#Installation-Unix-Standard">Standard handler</a><br />
+<a href="#Installation-Unix-Embedded">Embedded
+handler</a><br /></div>
<b> </b> <a href=
"#Installation-Windows">Windows</a><br />
<b> </b> <a href="#SecuringSNMPTT">Securing
@@ -85,7 +90,7 @@
<b> </b> <a href="#Hobbit">Hobbit</a></blockquote>
<br />
<h2><a id="License" name="License"></a>License</h2>
-<p>Copyright 2002-2007 Alex Burger<br />
+<p>Copyright 2002-2008 Alex Burger<br />
alex_b@users.sourceforge.net<br />
4/3/2002</p>
<p>This program is free software; you can redistribute it and/or
@@ -266,12 +271,21 @@
module (included with most if not all distributions including
ActivePerl). Required when enabling threads for EXEC
statements.</li>
+<li>Optional: <a href=
+"http://search.cpan.org/search?module=Digest::MD5">Digest::MD5</a>
+module (included with most if not all distributions including
+ActivePerl). Required when enabling duplicate trap
+detection.</li>
+<li>Optional: To use <span style=
+"font-weight: bold;">snmptthandler-embedded</span>, Net-SNMP's
+snmptrapd must be compiled with embedded Perl enabled
+(--enable-embedded-perl' configuration option)</li>
</ul>
<p>All development and testing was done with Linux, Windows 2000 or
higher and various versions of Net-SNMP from UCD SNMP v4.2.1 to the
current Net-SNMP 5.4.x release. The Windows version has been tested
with both native mode and under Cygwin.</p>
-<p>Both SNMP V1 and V2 traps have been tested.</p>
+<p>SNMP V1, V2 and V3 traps have been tested.</p>
<p>Net-SNMP 5.1.1 or higher is recommended.</p>
<p>UCD-SNMP v4.2.3 appears to have a bug that prevents it from
working correctly with SNMPTT. UCD-SNMP v4.2.1, v4.2.4 and
@@ -285,8 +299,60 @@
be able to have <b>snmptrapd</b> pass traps using symbolic form, or
you enable the options <b>translate_integers</b>,
<b>translate_trap_oid</b> or <b>translate_oids</b>. Although not
-required, using the Perl module is recommended.</blockquote>
+required, using the Perl module is recommended. It is also
+required if you want to use the snmptthandler-embedded trap handler
+with snmptrapd.</blockquote>
<h2><a id="Whats-New" name="Whats-New"></a>What's New</h2>
+<h3><b>v1.3</b> <b>- November 15th, 2009</b></h3>
+<ul>
+<li>Added <span style=
+"font-weight: bold;">snmptthandler-embedded</span> - a Net-SNMP
+snmptrapd embedded Perl version of snmptthandler.</li>
+<li>Added variable substitutions <span style=
+"font-weight: bold;">$Be</span>, <span style=
+"font-weight: bold;">$Bu</span>, <span style=
+"font-weight: bold;">$BE</span> and <span style=
+"font-weight: bold;">$Bn</span> for SNMPv3 securityEngineID,
+securityName, contextEngineID and contextName (requires
+snmptthandler-embedded handler).</li>
+<li>Added <b>snmptt.ini</b> option <b>duplicate_trap_window
+variable</b> for duplicate trap detection.</li>
+<li>Added LSB init keywords and actions to <span style=
+"font-weight: bold;">snmptt-init.d</span> and changed the priority
+for start / stop so that it starts after snmptrapd and stops before
+snmptrapd.</li>
+<li>Changed the default log path to <span style=
+"font-weight: bold;">/var/log/snmptt</span> for Unix and
+<span style="font-weight: bold;">c:\snmpt\log</span> for Windows to
+make it easier to grant write permission to the
+snmptt process.</li>
+<li>Changed umask for log files to 002 to ensure they are not
+created as world writable.</li>
+<li>Fixed a bug where the the PID file was being created using the
+parent (root) PID instead of the child (daemon_uid) when daemon_uid
+is used.</li>
+<li>The DEBUG log file will now be re-opened when a HUP signal is
+sent.</li>
+<li>When debugging is enabled, flush buffers every sleep cycle so
+we can tail the debug log file.</li>
+<li>Don't print messages to the console when starting in daemon
+mode unless debugging is enabled or an error occurs.</li>
+<li>'Could not open debug output file!' is no longer reported when
+debugging is disabled.<br /></li>
+<li>Added <span style="font-weight: bold;">snmptt.logrotate</span>
+file from Ville Skytta.</li>
+<li>Fixed a bug (1748512) with handling escaped quotes in a trap
+message.</li>
+<li>Updated snmptt-net-snmp-test to test MIB descriptions.</li>
+<li>SNMPTTConvertMIB:</li>
+<li style=
+"list-style-type: none; list-style-image: none; list-style-position: outside;">
+<ul>
+<li>Fixed a bug (1678270) where a TRAP-TYPE / NOTIFICATION-TYPE
+line would not translate if it was split across two lines.</li>
+</ul>
+</li>
+</ul>
<h3><b>v1.2</b> <b>- June 16th, 2007</b></h3>
<ul>
<li>When <b>daemon_uid</b> is used, two processes will now be
@@ -358,8 +424,6 @@
<li style=
"list-style-type: none; list-style-image: none; list-style-position: outside;">
<ul>
-<li>Fixed a bug (1438794) where a TRAP-TYPE / NOTIFICATION-TYPE
-line would not translate if it was split across two lines.</li>
<li>Fixed a bug (1438394) where ARGUMENTS lines that have $1, $2
etc instead of %0, %1 would not translate.</li>
<li>Fixed a bug where a --#SEVERITYMAP line would be used instead
@@ -835,7 +899,30 @@
<ul>
<li>Initial release</li>
</ul>
-<h2><a id="Upgrading" name="Upgrading"></a>Upgrading</h2>
+<h2><a id="Upgrading" name="Upgrading"></a>Upgrading<br /></h2>
+<h3><b>v1.2 to v1.3</b></h3>
+<p>To upgrade from v1.2 to v1.3, you should:</p>
+<ol>
+<li>Replace <b>snmptt</b> and <b>snmpttconvertmib</b> with the new
+versions. Make sure the files are executable (<b>chmod +x
+<i>filename</i></b>).</li>
+<li>Copy <span style="font-weight: bold;">snmptt-init.d</span>
+to <span style="font-weight: bold;">/etc/init.d/snmptt</span>.
+ Make sure the file is executable (<b>chmod +x
+<i>filename</i></b>).</li>
+<li>Optional: Install and configure the <span style=
+"font-weight: bold;">snmptthandler-embedded</span> trap handler.
+ See <a href="snmptt.html#Installation-Unix-Embedded">Embedded
+handler</a> for details.</li>
+<li>Backup your <b>snmptt.ini</b> file, replace it with the new
+version, and make any necessary configuration changes to it.
+ The default log paths have changed so modify as needed.</li>
+<li>Setup log rotation by copying <span style=
+"font-weight: bold;">snmptt.logrotate</span> to <span style=
+"font-weight: bold;">/etc/logrotate.d/snmptt</span> and modifying
+as needed for the correct paths, rotate frequency etc.</li>
+<li>Enable any new features in <b>snmptt.ini</b> as required.</li>
+</ol>
<h3><b>v1.1 to v1.2</b></h3>
<p>To upgrade from v1.1 to v1.2, you should:</p>
<ol>
@@ -1041,6 +1128,23 @@
</ol>
<h3><a id="Installation-Unix" name=
"Installation-Unix"></a>Installation - Unix</h3>
+<h4><a name="Installation-Unix-Standard"></a>Standard handler</h4>
+The standard handler is a small Perl program that is called each
+time a trap is received by snmptrapd when using daemon mode.
+ The limitations of this handler are:<br />
+<ul>
+<li>Each time a trap is received, a process must be created to run
+the snmptthandler program and snmptt.ini is read each
+time.</li>
+<li>SNMPv3 EngineID and names are not passed by snmptrapd to
+snmptthandler</li>
+</ul>
+The benefits of using this handler are:<br />
+<ul>
+<li>Does not require embedded Perl for snmptrapd</li>
+<li>Has been around since v0.1 if snmptt.</li>
+<li>Sufficient for most installations</li>
+</ul>
<p>1. <b><u>Read this entire file to understand how snmptt
works</u></b></p>
<p>2. Copy <b>snmptt</b> to <span style=
@@ -1052,7 +1156,8 @@
<p>4. Copy <b>snmptt.ini</b> to <b>/etc/snmp/</b> or
<span style="font-weight: bold;">/etc/</span> and edit the options
inside the file.</p>
-<p>5a. For <b>standlone mode: </b> Modify the
+<p>5. Create the log folder <b>/var/log/snmptt/</b>.</p>
+<p>6a. For <b>standlone mode: </b> Modify the
Net-SNMP <span style="font-weight: bold;">snmptrapd.conf</span>
file by adding the following line:</p>
<blockquote><b>traphandle default /usr/sbin/snmptt</b>
@@ -1061,17 +1166,23 @@
specific trap received, but using the <span style=
"font-weight: bold;">default</span> option is preferred</p>
</blockquote>
-5b. For <b>daemon mode: </b> Modify the Net-SNMP
-snmptrapd.conf file by adding the following line:
-<blockquote><b>traphandle default /usr/sbin/snmptthandler</b>
-<p>Launch snmptt using:</p>
-<p><b>snmptt --daemon</b></p>
-</blockquote>
+6b. For <b>daemon mode:<br />
+<br /></b>
+<div style="margin-left: 40px;">
+<p>Modify the Net-SNMP snmptrapd.conf file by adding the following
+line:</p>
+</div>
+<blockquote><b>traphandle default
+/usr/sbin/snmptthandler</b><br /></blockquote>
+<blockquote>
+<p>Create the spool folder <b>/var/spool/snmptt/</b>:</p>
+<span style="font-weight: bold;">mkdir
+/var/spool/snmptt/</span><br /></blockquote>
<blockquote>A startup script is included which can be used to start
and stop <b>snmptt</b> on Mandrake, RedHat and other systems.
Copy the script to the init.d directory (renaming the file during
the copy):
-<p><b>cp snmptt.init.d to /etc/rc.d/init.d/snmptt</b></p>
+<p><b>cp snmptt.init.d /etc/rc.d/init.d/snmptt</b></p>
<p>Add the service using <span style=
"font-weight: bold;">chkconfig</span>:</p>
<p><b>chkconfig --add snmptt</b></p>
@@ -1082,16 +1193,27 @@
<p><b>service snmptt start</b></p>
<p>or</p>
<p><b>/etc/rc.d/init.d/snmptt start</b></p>
+<p>To manually start snmptt, use:</p>
+<p><b>snmptt --daemon</b></p>
</blockquote>
-6. Start <span style="font-weight: bold;">snmptrapd</span>
-using the command line: <span style=
-"font-weight: bold;">snmptrapd -On</span>.<br />
- You should be able to edit the
+<p>7. A log rotation script is included
+which can be used to rotate the log files on Mandrake, RedHat
+and other systems. Copy the file to the logrotate.d
+directory (renaming the file during the copy):</p>
+<blockquote>
+<p><b>cp snmptt.logrotate /etc/logrotate.d/snmptt</b></p>
+<p>Edit the <b>/etc/logrotate.d/snmptt</b> and update
+the paths and rotate frequency as needed.</p>
+</blockquote>
+8. Start <span style=
+"font-weight: bold;">snmptrapd</span> using the command line:
+<span style="font-weight: bold;">snmptrapd -On</span>.<br />
+<br />
+<div style="margin-left: 40px;">You should be able to edit the
<b>/etc/rc.d/init.d/snmptrapd</b> script if you have one and
change<br />
- the <b>OPTIONS</b> to <b>"-On"</b>.
-<b><br />
-<span style="font-weight: bold;"><br /></span></b>
+the <b>OPTIONS</b> to <b>"-On"</b>.<br />
+<br /></div>
<div style="margin-left: 40px;"><b><span style=
"font-weight: bold;">Note: The -On is recommended. This
will make snmptrapd pass OIDs in numeric form</span> <span style=
@@ -1102,15 +1224,124 @@
installed, then you MUST use the -On switch. Depending on the
version of UCD-SNMP / Net-SNMP, some symbolic names may not
translate correctly. See the FAQ for more info.</span></div>
-<p> As an alternative, you can edit your
+<p style="margin-left: 40px;">As an alternative, you can edit your
<b>snmp.conf</b> file to include the line: <b>printNumericOids
1. </b> This setting will take effect no matter what is used
on the command line.</p>
-<p>7. See the <a href="#SecuringSNMPTT">Securing SNMPTT</a>
-section.</p>
+<p>9. See the <a href=
+"#SecuringSNMPTT">Securing SNMPTT</a> section.</p>
+<br />
+<h4><a name="Installation-Unix-Embedded"></a>Embedded handler</h4>
+<br />
+The embedded handler is a small Perl program that is loaded
+directly into snmptrapd when snmptrapd is started. The
+limitations of this handler are:<br />
+<ul>
+<li>Requires embedded Perl for snmptrapd</li>
+<li>Only works with daemon mode</li>
+</ul>
+The benefits of using this handler are:<br />
+<ul>
+<li>The handler is loaded and initialized when snmptrapd is
+started, so there is less overhead as a new process does not need
+to be created and initialization is done only once (loading of
+snmptt.ini).</li>
+<li>SNMPv3 EngineID and names variables are available in snmptt (B*
+variables)</li>
+</ul>
+<p>1. <b><u>Read this entire file to understand how snmptt
+works</u></b></p>
+<p>2. Make sure snmptrapd has embedded Perl support enabled.
+ When compiling from source, use the '--enable-embedded-perl'
+configuration option. </p>
+<p> Type <span style=
+"font-weight: bold;">snmptrapd -H 2>&1 | grep perl</span>.
+ It should give <span style="font-weight: bold;">perl
+ PERLCODE</span> if embedded Perl is enabled. </p>
+<p> If it's not available, you need to compile
+Net-SNMP using the <span style=
+"font-weight: bold;">--enable-embedded-perl</span> configure
+option.</p>
+<p>3. Copy <b>snmptt</b> to <span style=
+"font-weight: bold;">/usr/sbin/</span> and ensure it is executable
+(<b>chmod +x snmptt</b>)</p>
+<p>4. Copy <b>snmptthandler-embedded</b> to <span style=
+"font-weight: bold;">/usr/sbin/</span>. It does not need to
+be executable as it is called directly by snmptrapd.</p>
+<p>5. Copy <b>snmptt.ini</b> to <b>/etc/snmp/</b> or
+<span style="font-weight: bold;">/etc/</span> and edit the options
+inside the file.</p>
+<p>6. Create the log folder <b>/var/log/snmptt/</b>.</p>
+7. Configure snmptrapd and install the service:<br />
+<br />
+<div style="margin-left: 40px;">
+<p>Modify the Net-SNMP snmptrapd.conf file by adding the following
+line:</p>
+</div>
+<blockquote><b>perl do
+"/usr/sbin/snmptthandler-embedded";</b><br /></blockquote>
+<blockquote>Create the spool folder
+<b>/var/spool/snmptt/</b>.</blockquote>
+<blockquote>A startup script is included which can be used to start
+and stop <b>snmptt</b> on Mandrake, RedHat and other systems.
+Copy the script to the init.d directory (renaming the file during
+the copy):
+<p><b>cp snmptt.init.d /etc/rc.d/init.d/snmptt</b></p>
+<p>Add the service using <span style=
+"font-weight: bold;">chkconfig</span>:</p>
+<p><b>chkconfig --add snmptt</b></p>
+<p>Configure the service to start at runlevel 2345:</p>
+<p><b>chkconfig --level 2345 snmptt on</b></p>
+<p>Snmptt will be started at the next reboot, or can be started
+immediately with:</p>
+<p><b>service snmptt start</b></p>
+<p>or</p>
+<p><b>/etc/rc.d/init.d/snmptt start</b></p>
+<p>To manually start snmptt, use:</p>
+<p><b>snmptt --daemon</b><br /></p>
+</blockquote>
+<p>8. A log rotation script is
+included which can be used to rotate the log files on
+Mandrake, RedHat and other systems. Copy the file to
+the logrotate.d directory (renaming the file during the
+copy):</p>
+<blockquote>
+<p><b>cp snmptt.logrotate /etc/logrotate.d/snmptt</b></p>
+<p>Edit the <b>/etc/logrotate.d/snmptt</b> and update the
+paths and rotate frequency as needed.</p>
+</blockquote>
+9. Start <span style=
+"font-weight: bold;">snmptrapd</span> using the command line:
+<span style="font-weight: bold;">snmptrapd -On</span>.<br />
+<div style="margin-left: 40px;"><br />
+You should be able to edit the <b>/etc/rc.d/init.d/snmptrapd</b>
+script if you have one and change<br />
+the <b>OPTIONS</b> to <b>"-On"</b>.<br /></div>
+<b><span style="font-weight: bold;"><br /></span></b>
+<div style="margin-left: 40px;"><b><span style=
+"font-weight: bold;">Note: The -On is recommended. This
+will make snmptrapd pass OIDs in numeric form</span> <span style=
+"font-weight: bold;">and prevent SNMPTT from having to translate
+the symbolic name to numerical form. If</span> <span style=
+"font-weight: bold;">the</span></b> <span style=
+"font-weight: bold;">UCD-SNMP / Net-SNMP Perl module is not
+installed, then you MUST use the -On switch. Depending on the
+version of UCD-SNMP / Net-SNMP, some symbolic names may not
+translate correctly. See the FAQ for more info.</span><br />
+<br />
+<p>As an alternative, you can edit your <b>snmp.conf</b> file to
+include the line: <b>printNumericOids 1. </b> This setting
+will take effect no matter what is used on the command line.</p>
+</div>
+<p>10. See the <a href=
+"snmptt.html#SecuringSNMPTT">Securing SNMPTT</a> section.</p>
+<br />
<br />
<h3><a id="Installation-Windows" name=
"Installation-Windows"></a>Installation - Windows</h3>
+<p>The Net-SNMP trap receiver does not currently support embedded
+Perl, so only the standard trap handler can be used with
+Windows.</p>
<p>1. <b><u>Read this entire file to understand how snmptt
works</u></b></p>
<p>2. Create the directory <span style=
@@ -1119,7 +1350,8 @@
<p>3. Copy <b>snmptt.ini-nt</b> to
<b>%SystemRoot%\snmptt.ini</b> (c:\winnt\snmptt.ini) and edit the
options inside the file.</p>
-<p>4a. For <b>standlone mode: </b> Modify the
+<p>4. Create the log folder <b>c:\snmp\log\</b>.</p>
+<p>5a. For <b>standlone mode: </b> Modify the
Net-SNMP snmptrapd.conf file by adding the following line:</p>
<blockquote><b>traphandle default perl
c:\snmp\snmptt</b></blockquote>
@@ -1127,12 +1359,17 @@
to execute snmptt based on the specific trap received, but using
the <span style="font-weight: bold;">default</span> option is
preferred</blockquote>
-4b. For <b>daemon mode: </b> Modify the Net-SNMP
+5b. For <b>daemon mode: </b> Modify the Net-SNMP
snmptrapd.conf file by adding the following line:
-<blockquote><b>traphandle default perl c:\snmp\snmptthandler</b>
+<blockquote><b>traphandle default perl
+c:\snmp\snmptthandler</b></blockquote>
+<blockquote>Create the spool folder
+<b>c:\snmptt\spool\</b>.</blockquote>
+<blockquote>
<p>Launch snmptt using:</p>
<p><b>snmptt --daemon</b></p>
-5. Start SNMPTRAPD using the command line: SNMPTRAPD
+</blockquote>
+<p>6. Start SNMPTRAPD using the command line: SNMPTRAPD
-On. <b><br /></b> <b><span style=
"font-weight: bold;"> Note: The -On
is recommended. This will make snmptrapd pass OIDs in numeric
@@ -1146,7 +1383,7 @@
-On switch. Depending on the version
of UCD-SNMP / Net-SNMP, some symbolic names<br />
may not translate correctly. See the
-FAQ for more info.<br /></span><br />
+FAQ for more info.<br /></span></p>
As an alternative, you can edit your
<b>snmp.conf</b> file to include the line: <b>printNumericOids
1. </b> This setting will take effect no matter what is used
@@ -1291,8 +1528,8 @@
traps, and delete processed traps<br /></li>
<li>read access to configuration files (snmptt.ini and all
snmptt.conf files)</li>
-<li>write access to log files (snmptt.log, snmptt.debug if
-enabled)</li>
+<li>write access to log folder /var/log/snmptt/ or
+c:\snmp\log\.</li>
<li>any other permissions required for EXEC statements to
execute<br /></li>
</ul>
@@ -2116,6 +2353,14 @@
this string using the following variables:</p>
<blockquote>$A - Trap agent host name <b>(see Note 1)</b><br />
$aA - Trap agent IP address<br />
+$Be - securityEngineID (snmpEngineID) <b>(see Note</b> <span style=
+"font-weight: bold;">7</span><b>)</b><br />
+$Bu - securityName (snmpCommunitySecurityName) <b>(see Note</b>
+<span style="font-weight: bold;">7</span><b>)</b><br />
+$BE - contextEngineID (snmpCommunityContextEngineID) <b>(see
+Note</b> <span style="font-weight: bold;">7</span><b>)</b><br />
+$Bn - contextName (snmpCommunityContextName) <b>(see Note</b>
+<span style="font-weight: bold;">7</span><b>)</b><br />
$c - Category<br />
$C - Trap community string<br />
$D - Description text from SNMPTT.CONF or MIB file <b>(see Note
@@ -2266,7 +2511,12 @@
must be set to either 1 or 2. If set to 1, the description is
pulled from the SNMPTT.CONF files. If set to 2, the description is
pulled from the MIB file. If using the MIB file, you must have the
-UCD-SNMP / Net-SNMP Perl module installed and enabled.</blockquote>
+UCD-SNMP / Net-SNMP Perl module installed and
+enabled.<br /></blockquote>
+Note (7):
+<blockquote>These variables are only available when using the
+embedded trap handler for snmptrapd
+(snmptthandler-embedded).<br /></blockquote>
</blockquote>
<h3><a id="SNMPTT.CONF-EXEC" name=
"SNMPTT.CONF-EXEC"></a><b>EXEC:</b></h3>
@@ -3419,14 +3669,13 @@
alerted when the interface is down for more than 10 seconds, and
then when the interface comes back up.<br /></li>
</ol>
-</blockquote>
<blockquote>
<p>The following outlines how the flow of traps between SNMPTT and
SEC could take place:</p>
<ol>
<li>SNMPTT receives a trap.</li>
<li>SNMPTT logs the trap to a separate log file such as
-/var/log/snmptt.sec.log using '/bin/echo ...' for the EXEC
+/var/log/snmptt/snmptt.sec.log using '/bin/echo ...' for the EXEC
statement. No FORMAT line is defined so the trap is not
logged to the regular snmptt.log log file (or SQL table if a SQL
server is used).<br /></li>
@@ -3469,14 +3718,14 @@
linkDown and linkUp messages to a separate log file for processing
by SEC.</p>
<p>Following is an example snmptt.conf.cisco file modified to log a
-linkdown or linkup message to /var/log/snmptt/sec.log. As you
-can see there are no FORMAT lines so the trap will not be logged to
-the regular SNMPTT log system.</p>
+linkdown or linkup message to /var/log/snmptt/snmptt.sec.log.
+As you can see there are no FORMAT lines so the trap will not be
+logged to the regular SNMPTT log system.</p>
<div style="margin-left: 40px;">EVENT Cisco_Link_Down
.1.3.6.1.6.3.1.1.5.3.1.3.6.1.4.1.9 "Cisco Events" Minor<br />
<span style="font-weight: bold;">EXEC /bin/echo "node=$A
msg_text=cisco linkdown trap on interface $1" >>
-/var/log/snmptt/sec.log</span><br />
+/var/log/snmptt/snmptt.sec.log</span><br />
SDESC<br />
This event occurs when the Cisco agent<br />
detects an interface has gone down.<br />
@@ -3494,7 +3743,7 @@
<span style="font-weight: bold;">EXEC /bin/echo "node=$A
msg_text=cisco linkup trap on interface $1" >></span>
<span style=
-"font-weight: bold;">/var/log/snmptt/sec.log</span><br />
+"font-weight: bold;">/var/log/snmptt/snmptt.sec.log</span><br />
SDESC<br />
This event occurs when the Cisco agent<br />
detects an interface has come back up.<br />
|
[-]
[+]
|
Changed |
snmptt_1.3.tar.bz2/docs/snmpttconvert.html
^
|
@@ -3,65 +3,78 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content=
-"HTML Tidy for Linux/x86 (vers 1st October 2003), see www.w3.org" />
-<meta content="text/html; charset=us-ascii" http-equiv="Content-Type" />
+"HTML Tidy for Linux (vers 14 June 2007), see www.w3.org" />
+<meta content="text/html; charset=us-ascii" http-equiv=
+"Content-Type" />
<meta content="Alex Burger" name="Author" />
-<meta content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]" name=
-"GENERATOR" />
+<meta content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"
+name="GENERATOR" />
<link rel="StyleSheet" type="text/css" href="layout1.css" />
<title>SNMP Trap Translator</title>
</head>
<body>
-<h1><b>SNMP Trap Translator Convert v1.2</b></h1>
-<b>(</b><a href="http://www.snmptt.org"><b>SNMPTTCONVERT</b></a><b>)</b><br />
+<h1><b>SNMP Trap Translator Convert v1.3</b></h1>
+<b>(</b><a href=
+"http://www.snmptt.org"><b>SNMPTTCONVERT</b></a><b>)</b><br />
This file was last updated on: August 30th, 2004
<h2><b>License</b></h2>
<p>Copyright 2002-2007 Alex Burger<br />
alex_b@users.sourceforge.net<br />
4/3/2002</p>
-<p>This program is free software; you can redistribute it and/or modify<br />
-it under the terms of the GNU General Public License as published by<br />
-the Free Software Foundation; either version 2 of the License, or<br />
+<p>This program is free software; you can redistribute it and/or
+modify<br />
+it under the terms of the GNU General Public License as published
+by<br />
+the Free Software Foundation; either version 2 of the License,
+or<br />
(at your option) any later version.</p>
-<p>This program is distributed in the hope that it will be useful,<br />
-but WITHOUT ANY WARRANTY; without even the implied warranty of<br />
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br />
+<p>This program is distributed in the hope that it will be
+useful,<br />
+but WITHOUT ANY WARRANTY; without even the implied warranty
+of<br />
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+the<br />
GNU General Public License for more details.</p>
-<p>You should have received a copy of the GNU General Public License<br />
+<p>You should have received a copy of the GNU General Public
+License<br />
along with this program; if not, write to the Free Software<br />
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA<br />
</p>
<h2><b>SNMPTTCONVERT</b></h2>
-<p>Some vendors provide a file that can be imported into HP Openview using a
-HP Openview utiltity. <span style=
-"font-weight: bold;">SNMPTTCONVERT</span> is a simple Perl script which will
-convert one of these files into the format used by SNMPTT. The file can
-contain multiple traps.</p>
+<p>Some vendors provide a file that can be imported into HP
+Openview using a HP Openview utiltity. <span style=
+"font-weight: bold;">SNMPTTCONVERT</span> is a simple Perl script
+which will convert one of these files into the format used by
+SNMPTT. The file can contain multiple traps.</p>
<p>For example, if the file ciscotrap.txt contained:</p>
-<blockquote>rpsFailed {.1.3.6.1.4.1.437.1.1.3} 6 5 - "Status Events" 1<br />
-Trap received from enterprise $E with $# arguments: sysName=$1<br />
+<blockquote>rpsFailed {.1.3.6.1.4.1.437.1.1.3} 6 5 - "Status
+Events" 1<br />
+Trap received from enterprise $E with $# arguments:
+sysName=$1<br />
SDESC<br />
-"A redundant power source is connected to the switch but a failure exists
-in<br />
+"A redundant power source is connected to the switch but a failure
+exists in<br />
the power system."<br />
EDESC</blockquote>
Executing snmpttconvert ciscotrap.txt would output:
<blockquote>#<br />
#<br />
#<br />
-EVENT rpsFailed .1.3.6.1.4.1.437.1.1.3.0.5 "Status Events" Normal<br />
-FORMAT Trap received from enterprise $E with $# arguments: sysName=$1<br />
-#EXEC qpage -f TRAP notifygroup1 "Trap received from enterprise $E with $#
-arguments: sysName=$1"<br />
+EVENT rpsFailed .1.3.6.1.4.1.437.1.1.3.0.5 "Status Events"
+Normal<br />
+FORMAT Trap received from enterprise $E with $# arguments:
+sysName=$1<br />
+#EXEC qpage -f TRAP notifygroup1 "Trap received from enterprise $E
+with $# arguments: sysName=$1"<br />
SDESC<br />
-"A redundant power source is connected to the switch but a failure exists
-in<br />
+"A redundant power source is connected to the switch but a failure
+exists in<br />
the power system."<br />
EDESC</blockquote>
<p><br />
-Note: The #EXEC line is added by default. This can be changed by
-editing the SNMPTTCONVERT script.<br />
+Note: The #EXEC line is added by default. This can be
+changed by editing the SNMPTTCONVERT script.<br />
</p>
</body>
</html>
|
[-]
[+]
|
Changed |
snmptt_1.3.tar.bz2/docs/snmpttconvertmib.html
^
|
@@ -3,16 +3,17 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content=
-"HTML Tidy for Linux/x86 (vers 1st October 2003), see www.w3.org" />
-<meta content="text/html; charset=us-ascii" http-equiv="Content-Type" />
+"HTML Tidy for Linux (vers 14 June 2007), see www.w3.org" />
+<meta content="text/html; charset=us-ascii" http-equiv=
+"Content-Type" />
<meta content="Alex Burger" name="Author" />
-<meta content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]" name=
-"GENERATOR" />
+<meta content="Mozilla/4.78 [en] (Windows NT 5.0; U) [Netscape]"
+name="GENERATOR" />
<link rel="StyleSheet" type="text/css" href="layout1.css" />
<title>SNMP Trap Translator</title>
</head>
<body>
-<h1><b>SNMP Trap Translator Convert MIB v1.2</b></h1>
+<h1><b>SNMP Trap Translator Convert MIB v1.3</b></h1>
<b>(</b><a href=
"http://www.snmptt.org"><b>SNMPTTCONVERTMIB</b></a><b>)</b><br />
This file was last updated on: November 5th, 2005
@@ -20,23 +21,31 @@
<p>Copyright 2002-2007 Alex Burger<br />
alex_b@users.sourceforge.net<br />
4/3/2002</p>
-<p>This program is free software; you can redistribute it and/or modify<br />
-it under the terms of the GNU General Public License as published by<br />
-the Free Software Foundation; either version 2 of the License, or<br />
+<p>This program is free software; you can redistribute it and/or
+modify<br />
+it under the terms of the GNU General Public License as published
+by<br />
+the Free Software Foundation; either version 2 of the License,
+or<br />
(at your option) any later version.</p>
-<p>This program is distributed in the hope that it will be useful,<br />
-but WITHOUT ANY WARRANTY; without even the implied warranty of<br />
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br />
+<p>This program is distributed in the hope that it will be
+useful,<br />
+but WITHOUT ANY WARRANTY; without even the implied warranty
+of<br />
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+the<br />
GNU General Public License for more details.</p>
-<p>You should have received a copy of the GNU General Public License<br />
+<p>You should have received a copy of the GNU General Public
+License<br />
along with this program; if not, write to the Free Software<br />
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA <span style="font-weight: bold;"><br />
<br /></span></p>
<h2>SNMPTTCONVERTMIB</h2>
-<p><b>SNMPTTCONVERTMIB</b> is a Perl script which will read a MIB file and
-convert the <b>TRAP-TYPE</b> (v1) or <b>NOTIFICATION-TYPE</b> (v2) definitions
-into a configuration file readable by <b>SNMPTT</b>.</p>
+<p><b>SNMPTTCONVERTMIB</b> is a Perl script which will read a MIB
+file and convert the <b>TRAP-TYPE</b> (v1) or
+<b>NOTIFICATION-TYPE</b> (v2) definitions into a configuration file
+readable by <b>SNMPTT</b>.</p>
<p>For example, if the file <b>CPQHOST.mib</b> (v1) contained:</p>
<blockquote>CPQHOST-MIB DEFINITIONS ::= BEGIN
<p> IMPORTS<br />
@@ -57,14 +66,16 @@
cpqHoIfPhysMapPort }<br />
DESCRIPTION<br />
- "This trap
-will be sent any time the configured redundant NIC<br />
- becomes the
-active NIC."</p>
-<p>
+
+"This trap will be sent any time the configured redundant NIC<br />
+
+becomes the active NIC."</p>
+<p>
+
--#TYPE "Status Trap"<br />
---#SUMMARY "NIC switchover to slot %s, port %s from slot %s, port %s."<br />
+--#SUMMARY "NIC switchover to slot %s, port %s from slot %s, port
+%s."<br />
--#ARGUMENTS {2, 3, 4, 5}<br />
@@ -74,17 +85,18 @@
::= 11010<br />
</p>
</blockquote>
-Executing <b>snmpttconvertmib CPQHOST.mib snmptt.conf</b> would APPEND to the
-end of the <b>snmptt.conf</b> file (specified on the command line):
+Executing <b>snmpttconvertmib CPQHOST.mib snmptt.conf</b> would
+APPEND to the end of the <b>snmptt.conf</b> file (specified on the
+command line):
<blockquote>#<br />
#<br />
#<br />
-EVENT cpqHo2NicSwitchoverOccurred2 .1.3.6.1.4.1.232.0.11010 "Status Events"
-Normal<br />
-FORMAT Status Trap: NIC switchover to slot $3, port $4 from slot $5, port
-$6.<br />
-#EXEC qpage -f TRAP notifygroup1 "Status Trap: NIC switchover to slot $3, port
-$4 from slot $5, port $6."<br />
+EVENT cpqHo2NicSwitchoverOccurred2 .1.3.6.1.4.1.232.0.11010 "Status
+Events" Normal<br />
+FORMAT Status Trap: NIC switchover to slot $3, port $4 from slot
+$5, port $6.<br />
+#EXEC qpage -f TRAP notifygroup1 "Status Trap: NIC switchover to
+slot $3, port $4 from slot $5, port $6."<br />
SDESC<br />
This trap will be sent any time the configured redundant NIC<br />
becomes the active NIC.<br />
@@ -92,10 +104,11 @@
<p><br />
Notes:</p>
<blockquote>To specifiy an EXEC statement, use the <span style=
-"font-weight: bold;">--exec=</span> command line option.
-<p>To prevent the --#TYPE text from being prepended to the --#SUMMARY line,
-change <b>$prepend_type</b> to <b>0</b> in the <b>SNMPTTCONVERTMIB</b>
-script.</p>
+"font-weight: bold;">--exec=</span> command line
+option.
+<p>To prevent the --#TYPE text from being prepended to the
+--#SUMMARY line, change <b>$prepend_type</b> to <b>0</b> in the
+<b>SNMPTTCONVERTMIB</b> script.</p>
<p>See the help screen for more options (<span style=
"font-weight: bold;">snmpttconvertmib --h</span>).</p>
</blockquote>
@@ -104,17 +117,17 @@
<li>UCD-SNMP / Net-SNMP <a href=
"http://www.net-snmp.org/man/snmptranslate.html"><b>snmptranslate</b></a>
utility</li>
-<li><span style="font-weight: bold;">Optional</span>: UCD-SNMP / Net-SNMP
-<b style="font-weight: bold;"><a href=
-"http://www.net-snmp.org/FAQ.html#Where_can_I_get_the_perl_SNMP_package_">Perl
-module</a></b><br /></li>
+<li><span style="font-weight: bold;">Optional</span>: UCD-SNMP /
+Net-SNMP <b style="font-weight: bold;"><a href=
+"http://www.net-snmp.org/FAQ.html#Where_can_I_get_the_perl_SNMP_package_">
+Perl module</a></b><br /></li>
</ul>
<p>Snmpttconvertmib converts a MIB file using the <span style=
"font-weight: bold;">snmptranslate</span> utility. </p>
<p>If the Net-SNMP Perl module is enabled using <span style=
-"font-weight: bold;">--net_snmp_perl</span> on the command line, it can
-provide more detailed variable descriptions in the DESC sestion if available
-such as:</p>
+"font-weight: bold;">--net_snmp_perl</span> on the command line, it
+can provide more detailed variable descriptions in the DESC sestion
+if available such as:</p>
<ul>
<li>variable syntax</li>
<li>variable description</li>
@@ -125,132 +138,147 @@
Syntax="INTEGER"<br />
2: ok<br />
4: failure<br />
- Descr="Current status of the entire library system"</div>
+ Descr="Current status of the entire library
+system"</div>
<p><b><br /></b></p>
<h3>Converting a MIB file</h3>
-<p>See the <span style="font-weight: bold;">snmpttconvertmib</span> help
-screen for all possible command line options (<span style=
-"font-weight: bold;">snmpttconvertmib --h</span>) before converting a MIB
-file. Depending on what type of information is available in the MIB
-file, you may want to change how the FORMAT / EXEC lines are generated.</p>
-<p>Before trying to convert MIB file, you should ensure that the MIB
-file can be parsed by Net-SNMP</p>
+<p>See the <span style="font-weight: bold;">snmpttconvertmib</span>
+help screen for all possible command line options (<span style=
+"font-weight: bold;">snmpttconvertmib --h</span>) before converting
+a MIB file. Depending on what type of information is
+available in the MIB file, you may want to change how the FORMAT /
+EXEC lines are generated.</p>
+<p>Before trying to convert MIB file, you should ensure that
+the MIB file can be parsed by Net-SNMP</p>
<ol>
<li>Copy the MIB file to the UCD-SNMP / Net-SNMP mibs folder</li>
-<li>Type: <b>export MIBS=ALL</b> to ensure all the mibs will be read in by
-<b>snmptranslate</b></li>
-<li>Make sure the MIB file can be interpreted by <b>snmptranslate</b>
-correctly. Simply typing <b>snmptranslate</b> should tell you if it was
-able to read the mib file correctly. If it can't, an error will be
-produced at the top of the help screen.</li>
-<li>Try to translate a <span style="font-weight: bold;">TRAP-TYPE</span> or
-<span style="font-weight: bold;">NOTIFICATION-TYPE</span> entry contained
-inside the MIB file. For example, if the MIB file contains the
-Notification definition of '<span style="font-weight: bold;">rptrHealth
-NOTIFICATION-TYPE</span>', then type: <span style=
-"font-weight: bold;">snmptranslate rptrHealth -IR -Td</span>. If you get
-'<span style="font-weight: bold;">Unknown object identifier: xxx'</span> then
+<li>Type: <b>export MIBS=ALL</b> to ensure all the mibs will be
+read in by <b>snmptranslate</b></li>
+<li>Make sure the MIB file can be interpreted by
+<b>snmptranslate</b> correctly. Simply typing
+<b>snmptranslate</b> should tell you if it was able to read the mib
+file correctly. If it can't, an error will be produced at the
+top of the help screen.</li>
+<li>Try to translate a <span style=
+"font-weight: bold;">TRAP-TYPE</span> or <span style=
+"font-weight: bold;">NOTIFICATION-TYPE</span> entry contained
+inside the MIB file. For example, if the MIB file contains
+the Notification definition of '<span style=
+"font-weight: bold;">rptrHealth NOTIFICATION-TYPE</span>', then
+type: <span style="font-weight: bold;">snmptranslate
+rptrHealth -IR -Td</span>. If you get '<span style=
+"font-weight: bold;">Unknown object identifier: xxx'</span> then
the MIB file was not found or parsed correctly.<br /></li>
</ol>
-<p><span style="font-weight: bold;">Running snmpttconvertmib</span>:<br />
+<p><span style="font-weight: bold;">Running
+snmpttconvertmib</span>:<br />
</p>
<ol>
<li>Make sure the MIB file has been successfully installed (see
above)<br /></li>
-<li>Edit the options between OPTIONS START and OPTIONS END in snmpttconvertmib
-if needed<br /></li>
-<li>If you are using <b>UCD-SNMP</b>, or <b>Net-SNMP v5.0.<span style=
-"text-decoration: underline;">1</span></b>, then add the folllowing to your
-snmp.conf file: <b>printNumericOids 1</b> (note: this will affect all
-snmp commands). This ensures the OIDs are returned in numerical
-format. Other versions of Net-SNMP do not require this change, as
-<b>snmpttconvertmib</b> will use a command line switch to force it on when
-calling <b>snmptranslate</b>.</li>
-<li>Convert the mib file with: <b>snmpttconvertmib --in=<i>path-to-mib</i>
---out=<i>output-file-name</i></b>. Note: the
-<b>output-file-name</b> is appended to, so remember to delete it first if
-needed.<br /></li>
+<li>Edit the options between OPTIONS START and OPTIONS END in
+snmpttconvertmib if needed<br /></li>
+<li>If you are using <b>UCD-SNMP</b>, or <b>Net-SNMP
+v5.0.<span style="text-decoration: underline;">1</span></b>, then
+add the folllowing to your snmp.conf file: <b>printNumericOids
+1</b> (note: this will affect all snmp commands). This
+ensures the OIDs are returned in numerical format. Other
+versions of Net-SNMP do not require this change, as
+<b>snmpttconvertmib</b> will use a command line switch to force it
+on when calling <b>snmptranslate</b>.</li>
+<li>Convert the mib file with: <b>snmpttconvertmib
+--in=<i>path-to-mib</i> --out=<i>output-file-name</i></b>.
+Note: the <b>output-file-name</b> is appended to, so remember
+to delete it first if needed.<br /></li>
</ol>
<div style="margin-left: 40px;">Example:</div>
<blockquote style="margin-left: 80px;"><b>snmpttconvertmib
--in=/usr/share/snmp/mibs/CPQHOST.mib
--out=/etc/snmp/snmptt.conf.compaqhost<br /></b></blockquote>
-<div style="margin-left: 40px;">If the Net-SNMP Perl module is installed and
-you want more descriptive variable descriptions, add <span style=
- "font-weight: bold;">--net_snmp_perl</span> to the command line:</div>
+<div style="margin-left: 40px;">If the Net-SNMP Perl module is
+installed and you want more descriptive variable descriptions, add
+<span style="font-weight: bold;">--net_snmp_perl</span> to the
+command line:</div>
<blockquote style="margin-left: 80px;"><b>snmpttconvertmib
--in=/usr/share/snmp/mibs/CPQHOST.mib
---out=/etc/snmp/snmptt.cong.compaq --net_snmp_perl<br /></b></blockquote>
+--out=/etc/snmp/snmptt.cong.compaq
+--net_snmp_perl<br /></b></blockquote>
<br />
-<div style="margin-left: 40px;">To convert all the CPQ* files in the current folder, you can use:</div>
+<div style="margin-left: 40px;">To convert all the CPQ* files in
+the current folder, you can use:</div>
<br />
<div style="margin-left: 40px;">Unix / Linux:</div>
-<blockquote style="margin-left: 80px;"><b>
- for i in CPQ*<br />
- > do<br />
- > /usr/local/sbin/snmpttconvertmib --in=$i --out=snmptt.conf.compaq<br />
- > done<br />
+<blockquote style="margin-left: 80px;"><b>for i in CPQ*<br />
+> do<br />
+> /usr/local/sbin/snmpttconvertmib --in=$i
+--out=snmptt.conf.compaq<br />
+> done<br />
<br /></b></blockquote>
-
<div style="margin-left: 40px;">Windows:</div>
-<blockquote style="margin-left: 80px;"><b>
- for %i in (CPQ*) do perl snmpttconvertmib --in=%i --out=snmptt.conf.compaq<br />
+<blockquote style="margin-left: 80px;"><b>for %i in (CPQ*) do perl
+snmpttconvertmib --in=%i --out=snmptt.conf.compaq<br />
<br /></b></blockquote>
-
-
<blockquote style="margin-left: 80px;"></blockquote>
<h3>How it works</h3>
<p> <br />
-Some MIB files contain <b>--#SUMMARY</b> and <b>--#ARGUMENTS</b> lines which
-are used by Novell's Network Management system. These MIB files convert
-very well to <b>SNMPTT</b> as they contain detailed information that can be
-used on the <b>FORMAT</b> and <b>EXEC</b> lines. Compaq's MIBs usually
-have these lines.</p>
-<p>Other MIBS contain only a <b>DESCRIPTION</b> section where the first line
-contains the <b>FORMAT</b> string. In some MIBS, this line also contains
-variables similar to the <b>--#SUMMARY</b> lines.</p>
-<p>The mib file is searched for the name of the MIB file. This should be
-at the top of the file and contain <span style=
-"font-style: italic;">'</span><span style="font-weight: bold;"><span style=
-"font-style: italic;">name</span> DEFINITIONS ::=BEGIN</span>'. This
-name will be used when looking up the TRAP / NOTIFICATION to ensure the
-correct MIB file is accessed.</p>
-<p>The mib file is also searched for lines containing <b>TRAP-TYPE</b> or
-NOTIFICATION-TYPE. If it finds one that appears to be a valid trap
-definition, it reads in the following lines until a ::= is found while looking
-for the <b>DESCRIPTION</b> section. It then looks for the
-<b>--#SUMMARY</b> and <b>--#ARGUMENTS</b> line if enabled.</p>
-<p><b>SNMPTRANSLATE</b> is used with the following syntax to find the
-<b>OID</b> of the trap:</p>
-<p><b>snmptranslate -IR -Ts <i>mib-name::</i><i>trapname</i> -m <span style=
-"font-style: italic;">mib-filename</span></b></p>
-<p>Note: If Net-SNMP 5.0.2 or newer is detected, the command line also
-includes the -On switch. See the <a href=
+Some MIB files contain <b>--#SUMMARY</b> and <b>--#ARGUMENTS</b>
+lines which are used by Novell's Network Management system.
+These MIB files convert very well to <b>SNMPTT</b> as they contain
+detailed information that can be used on the <b>FORMAT</b> and
+<b>EXEC</b> lines. Compaq's MIBs usually have these
+lines.</p>
+<p>Other MIBS contain only a <b>DESCRIPTION</b> section where the
+first line contains the <b>FORMAT</b> string. In some MIBS,
+this line also contains variables similar to the <b>--#SUMMARY</b>
+lines.</p>
+<p>The mib file is searched for the name of the MIB file.
+This should be at the top of the file and contain <span style=
+"font-style: italic;">'</span><span style=
+"font-weight: bold;"><span style="font-style: italic;">name</span>
+DEFINITIONS ::=BEGIN</span>'. This name will be used when
+looking up the TRAP / NOTIFICATION to ensure the correct MIB file
+is accessed.</p>
+<p>The mib file is also searched for lines containing
+<b>TRAP-TYPE</b> or NOTIFICATION-TYPE. If it finds one that
+appears to be a valid trap definition, it reads in the following
+lines until a ::= is found while looking for the <b>DESCRIPTION</b>
+section. It then looks for the <b>--#SUMMARY</b> and
+<b>--#ARGUMENTS</b> line if enabled.</p>
+<p><b>SNMPTRANSLATE</b> is used with the following syntax to find
+the <b>OID</b> of the trap:</p>
+<p><b>snmptranslate -IR -Ts <i>mib-name::</i><i>trapname</i> -m
+<span style="font-style: italic;">mib-filename</span></b></p>
+<p>Note: If Net-SNMP 5.0.2 or newer is detected, the command
+line also includes the -On switch. See the <a href=
"file:///h:/cvs/snmptt/readme.html#FAQ-Troubleshooting">FAQ</a>.</p>
-<p><span style="font-weight: bold;">*</span> If <b>--#SUMMARY</b> and
-<b>--#ARGUMENTS</b> are found, the <b>%<i>letter</i></b> variables are
-replaced with <b>$<i>number</i></b> variables based on the values lists in the
-<b>--#ARGUMENTS</b> section incremented by 1 (ARGUMENTS starts with 0, SNMPTT
-starts with 1). This will be used to define the <b>FORMAT</b> and
-<b>EXEC</b> lines.</p>
-<p><span style="font-weight: bold;">*</span> If there is no <b>--#SUMMARY</b>
-and <b>--#ARGUMENTS</b> lines, but the first line of the <b>DESCRIPTION</b>
-contains <b>%<i>letter</i></b> variables, then that line will be used to
-define the <b>FORMAT</b> and <b>EXEC</b> lines. The
-<b>%<i>letter</i></b> variables are replaced with <b>$<i>number</i></b>
-variables starting at 1 and going up.</p>
-<p><span style="font-weight: bold;">*</span> If there is no <b>--#SUMMARY</b>
-and <b>--#ARGUMENTS</b> lines, and the first line of the <b>DESCRIPTION</b>
-does not contain <b>%<i>letter</i></b> variables, then that line will be sed
-to define the <b>FORMAT</b> and <b>EXEC</b> lines followed by a <b>$*</b>
-which will dump all received variables.</p>
-<p><span style="font-weight: bold;">*</span> If the entry contains variables,
-the variables are listed in the DESC section. If <span style=
-"font-weight: bold;">--net_snmp_perl</span> is specified, the syntax,
-description and enums for each variable is used.</p>
-<p style="font-weight: bold;">* Note: This can be changed by specifying
-a --format=n command line option. See the snmpttconvertmib help screen
-for all possible command line options (snmpttconvertmib --h).</p>
+<p><span style="font-weight: bold;">*</span> If <b>--#SUMMARY</b>
+and <b>--#ARGUMENTS</b> are found, the <b>%<i>letter</i></b>
+variables are replaced with <b>$<i>number</i></b> variables based
+on the values lists in the <b>--#ARGUMENTS</b> section incremented
+by 1 (ARGUMENTS starts with 0, SNMPTT starts with 1). This
+will be used to define the <b>FORMAT</b> and <b>EXEC</b> lines.</p>
+<p><span style="font-weight: bold;">*</span> If there is no
+<b>--#SUMMARY</b> and <b>--#ARGUMENTS</b> lines, but the first line
+of the <b>DESCRIPTION</b> contains <b>%<i>letter</i></b> variables,
+then that line will be used to define the <b>FORMAT</b> and
+<b>EXEC</b> lines. The <b>%<i>letter</i></b> variables are
+replaced with <b>$<i>number</i></b> variables starting at 1 and
+going up.</p>
+<p><span style="font-weight: bold;">*</span> If there is no
+<b>--#SUMMARY</b> and <b>--#ARGUMENTS</b> lines, and the first line
+of the <b>DESCRIPTION</b> does not contain <b>%<i>letter</i></b>
+variables, then that line will be sed to define the <b>FORMAT</b>
+and <b>EXEC</b> lines followed by a <b>$*</b> which will dump all
+received variables.</p>
+<p><span style="font-weight: bold;">*</span> If the entry contains
+variables, the variables are listed in the DESC
+section. If <span style=
+"font-weight: bold;">--net_snmp_perl</span> is specified, the
+syntax, description and enums for each variable is used.</p>
+<p style="font-weight: bold;">* Note: This can be changed by
+specifying a --format=n command line option. See the
+snmpttconvertmib help screen for all possible command line options
+(snmpttconvertmib --h).</p>
<br />
</body>
</html>
|
[-]
[+]
|
Changed |
snmptt_1.3.tar.bz2/snmptt
^
|
@@ -1,8 +1,8 @@
#!/usr/bin/perl
#
-# SNMPTT v1.2
+# SNMPTT v1.3
#
-# Copyright 2002-2007 Alex Burger
+# Copyright 2002-2009 Alex Burger
# alex_b@users.sourceforge.net
# 4/11/2002
#
@@ -47,7 +47,7 @@
#
use strict;
-my $snmptt_version = "v1.2";
+my $snmptt_version = "v1.3";
sub showversion
{
@@ -202,6 +202,7 @@
my $sleep;
my $use_trap_time;
my $keep_unlogged_traps;
+my $duplicate_trap_window;
# Logging
my $stdout_enable;
@@ -315,6 +316,7 @@
my $debug_file_open_error = 1;
if ($DEBUGGING >= 1)
{
+ # Open the debug file
if ($DEBUGGING_FILE ne '')
{
if (open DEBUGFILE, ">>$DEBUGGING_FILE")
@@ -391,14 +393,14 @@
if ($syslog_system_enable == 1 && $daemon == 1)
{
syslog_system("SNMPTT $snmptt_version started");
- if ($debug_file_open_error == 1) {
+ if ($DEBUGGING >= 1 && $debug_file_open_error == 1) {
syslog_system("Could not open debug output file!");
}
}
if ($log_system_enable == 1 && $daemon == 1)
{
log_system("SNMPTT $snmptt_version started");
- if ($debug_file_open_error == 1) {
+ if ($DEBUGGING >= 1 && $debug_file_open_error == 1) {
log_system("Could not open debug output file!");
}
}
@@ -406,7 +408,7 @@
if ($eventlog_system_enable == 1 && $daemon == 1)
{
eventlog_system("SNMPTT $snmptt_version started",0,$eventlog_information);
- if ($debug_file_open_error == 1) {
+ if ($DEBUGGING >= 1 && $debug_file_open_error == 1) {
eventlog_system("Could not open debug output file!",14,$eventlog_warning);
}
}
@@ -564,6 +566,20 @@
}
+if ($duplicate_trap_window > 0)
+{
+ eval 'require Digest::MD5;';
+ if ($@) {
+ warn $@;
+ print "\nCould not load the Perl module Digest::MD5! If duplicate_trap_window\n";
+ print "is set then the Digest::MD5 module is required. Please see snmptt.html\n";
+ print "for system requirements.\n\n";
+ die "died";
+ }
+ require Digest::MD5;
+}
+
+
##############################################################################
#### MAIN SECTION START
@@ -617,6 +633,7 @@
my $timetoreload;
my $timetodie;
my $timetologstatistics;
+my %duplicate_traps;
if ($daemon == 1)
{
@@ -629,7 +646,9 @@
$pid_file_set = 1;
}
- print STDOUT "$pid_file\n";
+ if ($DEBUGGING >= 1) {
+ print STDOUT "PID file: $pid_file\n";
+ }
if (-e $pid_file) {
open(OLDPID, "<$pid_file");
my $old_pid = <OLDPID>;
@@ -688,7 +707,9 @@
my $pid2;
my $working_dir = cwd;
- print "cwd: $working_dir\n";
+ if ($DEBUGGING >= 1) {
+ print "cwd: $working_dir\n";
+ }
chdir '/'
or die "Can't chdir to /: $!";
@@ -707,19 +728,21 @@
# We write PID using the uid of the user that started snmptt.
if ($pid) # This is run in the parent process
- {
- if (open(PID, ">$pid_file") ) {
- print(PID "$pid\n");
- close(PID);
- }
- else {
- $pid_file = "$working_dir/snmptt.pid";
-
- if (open(PID, ">$pid_file") )
- {
+ {
+ if ($daemon_uid eq '') {
+ if (open(PID, ">$pid_file") ) {
print(PID "$pid\n");
close(PID);
}
+ else {
+ $pid_file = "$working_dir/snmptt.pid";
+
+ if (open(PID, ">$pid_file") )
+ {
+ print(PID "$pid\n");
+ close(PID);
+ }
+ }
}
exit;
@@ -727,14 +750,15 @@
POSIX:setsid
or die "Can't start a new session: $!";
- umask 0;
+ #umask 0;
+ umask 002;
# We fork again so there are two processes. The first which is run using the uid
# of the user that started snmptt, and the second which is run as the user as
# defined by daemon_uid in snmptt.ini. We do this so we can sit and wait for the
# child to finish so we can clean up the snmptt.pid file.
# We only need to do this if daemon_uid is set..
- if ($^O ne "MSWin32" && $daemon_uid ne '') {
+ if ($daemon_uid ne '') {
defined($pid2 = fork)
or die "Can't fork: $!";
@@ -742,6 +766,20 @@
{
$SIG{TERM} = \&signal_handler_die; # new signal for parent
+ if (open(PID, ">$pid_file") ) {
+ print(PID "$pid2\n");
+ close(PID);
+ }
+ else {
+ $pid_file = "$working_dir/snmptt.pid";
+
+ if (open(PID, ">$pid_file") )
+ {
+ print(PID "$pid2\n");
+ close(PID);
+ }
+ }
+
while (1) {
if ($timetodie == 1 || waitpid($pid2, WNOHANG) != 0) {
kill SIGTERM, $pid2;
@@ -755,7 +793,8 @@
POSIX:setsid
or die "Can't start a new session: $!";
- umask 0;
+ #umask 0;
+ umask 002;
}
}
@@ -828,40 +867,8 @@
$debug_file_open_error = 1;
# Re-open debug file (if needed) as the new user
if ($DEBUGGING >= 1)
- {
- if ($DEBUGGING_FILE ne '')
- {
- if (open DEBUGFILE, ">>$DEBUGGING_FILE")
- {
- select DEBUGFILE; # change default output to debug file
- $debug_file_used = 1;
- $debug_file_open_error = 0;
- print "Debug file $DEBUGGING_FILE re-opened under uid $daemon_uid\n";
- warn "Debug file $DEBUGGING_FILE re-opened under uid $daemon_uid\n";
- }
- else
- {
- warn "could not re-open debug output file ($!)";
- }
- if ($syslog_system_enable == 1 && $daemon == 1)
- {
- if ($debug_file_open_error == 1) {
- syslog_system("Could not re-open debug output file!");
- }
- }
- if ($log_system_enable == 1 && $daemon == 1)
- {
- if ($debug_file_open_error == 1) {
- log_system("Could not re-open debug output file!");
- }
- }
- }
-
- if ($eventlog_system_enable == 1 && $daemon == 1){
- if ($debug_file_open_error == 1) {
- eventlog_system("Could not re-open debug output file!",14,$eventlog_error);
- }
- }
+ {
+ &reopen_debug_file;
}
}
}
@@ -877,6 +884,27 @@
while (!$timetodie)
{
+ # If debugging, flush the buffers so we can tail snmptt.debug file.
+ if ($DEBUGGING >= 1) {
+ $| = 1;
+ $| = 0;
+ }
+
+ if ($duplicate_trap_window) {
+ # Purge traps older than duplicate_trap_window in %duplicate_traps
+ my $duplicate_traps_current_time = time();
+ foreach my $key (sort keys %duplicate_traps)
+ {
+ #print "Previous trap digest: $key: " . localtime($duplicate_traps{$key}) . "\n";
+ if ($duplicate_traps{$key} < $duplicate_traps_current_time - $duplicate_trap_window) {
+ # Purge the record
+ delete $duplicate_traps{$key};
+ #print " Deleted...\n";
+ }
+ }
+ #print "\n";
+ }
+
if (! (chdir($spool_directory)))
{
if ($DEBUGGING >= 1)
@@ -1039,18 +1067,32 @@
$input = 'FILE';
- if (! (&readtrap())) { # Read trap from STDIN or file
+ my $readtrap_result = &readtrap(); # Read trap from STDIN or file
+
+ if ($readtrap_result == 0) {
+ if ($DEBUGGING >= 1) {
print " Error processing trap file $file. Skipping...\n";
+ }
next;
}
- &searchfortrap; # Search for trap snmptt.conf (array)
+ my $trap_is_a_duplicate = 0;
+ if ($readtrap_result == -1) {
+ $trap_is_a_duplicate = 1;
+ if ($DEBUGGING >= 1) {
+ print " Duplicate trap detected in trap file $file. Skipping...\n";
+ }
+ }
+ # Search for trap only if it's not a duplicate.
+ if (! ($trap_is_a_duplicate)) {
+ &searchfortrap; # Search for trap snmptt.conf (array)
+ }
close FILE;
if ($filesuccess == 1)
{
- if ($keep_unlogged_traps == 0 || $trap_successfully_logged == 1)
+ if ($keep_unlogged_traps == 0 || $trap_successfully_logged == 1 || $trap_is_a_duplicate)
{
unless (unlink($file))
{
@@ -1219,6 +1261,10 @@
# $var[4] ip address from trap agent
# $var[5] trap community string
# $var[6] enterprise
+ # $var[7] securityEngineID (snmptthandler-embedded required)
+ # $var[8] securityName (snmptthandler-embedded required)
+ # $var[9] contextEngineID (snmptthandler-embedded required)
+ # $var[10] contextName (snmptthandler-embedded required)
#
# $entvarname[0] passed variable name 1
# $entvarname[1] passed variable name 2
@@ -1385,7 +1431,6 @@
$nodesmatch = 1;
}
}
-
# If NODES MODE=NEG, then reverse the result.
if ($nodes_mode eq 'neg') {
if ($nodesmatch == 0) {
@@ -1397,13 +1442,21 @@
}
if ($DEBUGGING >= 1)
{
- if ($nodesmatch == 1)
- {
- print " NODES has a positive match (node mode \'$nodes_mode\' and node found in list)\n";
+ if ($nodes_mode eq 'pos') {
+ if ($nodesmatch == 1) {
+ print " NODES has a positive match (node mode \'pos\' and node found in list)\n";
+ }
+ else {
+ print " NODES has a negative match (node mode \'pos\' and node NOT found in list)\n";
+ }
+ }
+ else {
+ if ($nodesmatch == 1) {
+ print " NODES has a positive match (node mode \'neg\' and node NOT found in list)\n";
+ }
+ else {
+ print " NODES has a negative match (node mode \'neg\' and node found in list)\n";
}
- else
- {
- print " NODES has a negative match (node mode \'$nodes_mode\' and node NOT found in list)\n";
}
}
}
@@ -2222,6 +2275,18 @@
}
}
+ # $Be - securityEngineID (snmpEngineID)
+ &substitute2 ("\$Be", $var[7]);
+
+ # $Bu - securityName (snmpCommunitySecurityName)
+ &substitute2 ("\$Bu", $var[8]);
+
+ # $BE - contextEngineID (snmpCommunityContextEngineID)
+ &substitute2 ("\$BE", $var[9]);
+
+ # $Bn - contextName (snmpCommunityContextName)
+ &substitute2 ("\$Bn", $var[10]);
+
# $c - Category
#s(\$c)($event2[1])g;
&substitute2 ("\$c", $event2[1]);
@@ -3013,6 +3078,7 @@
@entvar = ();
@entvarname = ();
@preexec_var = ();
+ my @rawtrap = ();
# Statistics
$g_total_traps_received++;
@@ -3025,6 +3091,7 @@
if ( $daemon == 1)
{
chomp($trap_date_time_epoch = (<$input>)); # Pull time trap was spooled
+ push(@rawtrap, $trap_date_time_epoch);
if ($trap_date_time_epoch eq "") {
if ($DEBUGGING >= 1) {
print " Invalid trap file. Expected a serial time on the first line but got nothing\n";
@@ -3085,6 +3152,7 @@
# Pull in passed SNMP info from snmptrapd via STDIN and place in the array @tempvar
chomp($tempvar[0]=<$input>); # hostname
+ push(@rawtrap, $tempvar[0]);
$tempvar[0] =~ s(`)(')g; #` Replace any back ticks with regular single quote
if ($tempvar[0] eq "") {
if ($DEBUGGING >= 1) {
@@ -3094,6 +3162,7 @@
}
chomp($tempvar[1]=<$input>); # ip address
+ push(@rawtrap, $tempvar[1]);
$tempvar[1] =~ s(`)(')g; #` Replace any back ticks with regular single quote
if ($tempvar[1] eq "") {
if ($DEBUGGING >= 1) {
@@ -3117,6 +3186,7 @@
my $linenum = 1;
while (defined(my $line = <$input>))
{
+ push(@rawtrap, $line);
$line =~ s(`)(')g; #` Replace any back ticks with regular single quote
if ($remove_backslash_from_quotes == 1) # Remove escape from quotes if enabled
@@ -3152,9 +3222,9 @@
$temp1 = translate_symbolic_to_oid($temp1);
# If line begins with a double quote (") but does not END in a double quote then we need to merge
- # the following lines together into one until we find the closing double quote.
+ # the following lines together into one until we find the closing double quote. Allow for escaped quotes.
# Net-SNMP sometimes divides long lines into multiple lines..
- if ( ($temp2 =~ /^\"/) && ( ! ($temp2 =~ /\"$/)) )
+ if ( ($temp2 =~ /^\"/) && ( ! ($temp2 =~ /[^\\]\"$/)) )
{
if ($DEBUGGING >= 2) {
print " Multi-line value detected - merging onto one line...\n";
@@ -3163,8 +3233,9 @@
while (defined(my $line2 = <$input>))
{
chomp $line2;
+ push(@rawtrap, $line2);
$temp2.=" ".$line2;
- if ($line2 =~ /\"$/)
+ if ($line2 =~ /[^\\]\"$/) # Ends in a non-escaped quote
{
last;
}
@@ -3211,9 +3282,9 @@
}
# If line begins with a double quote (") but does not END in a double quote then we need to merge
- # the following lines together into one until we find the closing double quote.
+ # the following lines together into one until we find the closing double quote. Allow for escaped quotes.
# Net-SNMP sometimes divides long lines into multiple lines..
- if ( ($line =~ /^\"/) && ( ! ($line =~ /\"$/)) )
+ if ( ($line =~ /^\"/) && ( ! ($line =~ /[^\\]\"$/)) )
{
if ($DEBUGGING >= 2) {
print " Multi-line value detected - merging onto one line...\n";
@@ -3222,8 +3293,9 @@
while (defined(my $line2 = <$input>))
{
chomp $line2;
+ push(@rawtrap, $line2);
$line.=" ".$line2;
- if ($line2 =~ /\"$/)
+ if ($line2 =~ /[^\\]\"$/) # Ends in a non-escaped quote
{
last;
}
@@ -3254,6 +3326,14 @@
if ($DEBUGGING >= 2)
{
+ # Print out raw trap passed from snmptrapd
+ print "\nRaw trap passed from snmptrapd:\n";
+ for (my $i=0;$i <= $#rawtrap;$i++)
+ {
+ chomp($rawtrap[$i]);
+ print "$rawtrap[$i]\n";
+ }
+
# Print out all items passed from snmptrapd
print "\nItems passed from snmptrapd:\n";
for (my $i=0;$i <= $#tempvar;$i++)
@@ -3271,9 +3351,13 @@
$var[3] = $tempvar[5]; # trapname / OID - assume first value after uptime is
# the trap OID (value for .1.3.6.1.6.3.1.1.4.1.0)
- $var[4] = ""; # Clear ip address from trap agent
- $var[5] = ""; # Clear trap community string
- $var[6] = ""; # Clear enterprise
+ $var[4] = ""; # Clear ip address from trap agent
+ $var[5] = ""; # Clear trap community string
+ $var[6] = ""; # Clear enterprise
+ $var[7] = ""; # Clear securityEngineID
+ $var[8] = ""; # Clear securityName
+ $var[9] = ""; # Clear contextEngineID
+ $var[10] = ""; # Clear contextName
# Make sure trap OID is numerical as event lookups are done using numerical OIDs only
$var[3] = translate_symbolic_to_oid($var[3]);
@@ -3298,6 +3382,22 @@
# Make sure enterprise value is numerical
$var[6] = translate_symbolic_to_oid($tempvar[$i+1]);
}
+ elsif ($tempvar[$i] =~ /^.1.3.6.1.6.3.10.2.1.1.0$/) # securityEngineID
+ {
+ $var[7] = $tempvar[$i+1];
+ }
+ elsif ($tempvar[$i] =~ /^.1.3.6.1.6.3.18.1.1.1.3$/) # securityName
+ {
+ $var[8] = $tempvar[$i+1];
+ }
+ elsif ($tempvar[$i] =~ /^.1.3.6.1.6.3.18.1.1.1.4$/) # contextEngineID
+ {
+ $var[9] = $tempvar[$i+1];
+ }
+ elsif ($tempvar[$i] =~ /^.1.3.6.1.6.3.18.1.1.1.5$/) # contextName
+ {
+ $var[10] = $tempvar[$i+1];
+ }
else # application specific variables
{
$entvarname[$j] = $tempvar[$i];
@@ -3392,6 +3492,10 @@
print "4: ip address from trap agent\n";
print "5: trap community string\n";
print "6: enterprise\n";
+ print "7: securityEngineID (snmptthandler-embedded required)\n";
+ print "8: securityName (snmptthandler-embedded required)\n";
+ print "9: contextEngineID (snmptthandler-embedded required)\n";
+ print "10: contextName (snmptthandler-embedded required)\n";
print "0+: passed variables\n\n";
#print out all standard variables
@@ -3409,6 +3513,26 @@
}
}
+ # Generate hash of trap and detect duplicates
+ if ($duplicate_trap_window) {
+ my $md5 = Digest::MD5->new;
+ # All variables except for uptime.
+ $md5->add($var[0],$var[1].$var[3].$var[4].$var[5].$var[6].$var[7].$var[8].$var[9].$var[10]."@entvar");
+
+ my $trap_digest = $md5->hexdigest;
+
+ if ($DEBUGGING >= 2) {
+ print "Trap digest: $trap_digest\n";
+ }
+
+ if ($duplicate_traps{$trap_digest}) {
+ # Duplicate trap detected. Skipping trap...
+ return -1;
+ }
+
+ $duplicate_traps{$trap_digest} = time();
+ }
+
return 1;
# Variables of trap received by SNMPTRAPD:
@@ -3420,6 +3544,10 @@
# $var[4] ip address from trap agent
# $var[5] trap community string
# $var[6] enterprise
+ # $var[7] securityEngineID (snmptthandler-embedded required)
+ # $var[8] securityName (snmptthandler-embedded required)
+ # $var[9] contextEngineID (snmptthandler-embedded required)
+ # $var[10] contextName (snmptthandler-embedded required)
#
# $entvarname[0] passed variable name 1
# $entvarname[1] passed variable name 2
@@ -3446,6 +3574,10 @@
# $var[4] ip address from trap agent
# $var[5] trap community string
# $var[6] enterprise
+ # $var[7] securityEngineID (snmptthandler-embedded required)
+ # $var[8] securityName (snmptthandler-embedded required)
+ # $var[9] contextEngineID (snmptthandler-embedded required)
+ # $var[10] contextName (snmptthandler-embedded required)
#
# $entvarname[0] passed variable name 1
# $entvarname[1] passed variable name 2
@@ -3897,7 +4029,7 @@
if( open( CONFIG, $configfile ) ) {
close CONFIG;
$cfg = new Config::IniFiles( -file => $configfile);
- if ($DEBUGGING >= 0) {
+ if ($DEBUGGING >= 1) {
print "Config file $configfile loaded\n";
}
}
@@ -3963,6 +4095,7 @@
$sleep = $cfg->val('DaemonMode', 'sleep');
$use_trap_time = $cfg->val('DaemonMode', 'use_trap_time');
$keep_unlogged_traps = $cfg->val('DaemonMode', 'keep_unlogged_traps');
+ $duplicate_trap_window = $cfg->val('DaemonMode', 'duplicate_trap_window');
# Logging
$stdout_enable = $cfg->val('Logging', 'stdout_enable');
@@ -4106,8 +4239,9 @@
if (! defined ($spool_directory)) { $spool_directory = ''} ;
if (! defined ($sleep)) { $sleep = 5} ;
if (! defined ($use_trap_time)) { $use_trap_time = 1} ;
-
if (! defined ($keep_unlogged_traps)) { $keep_unlogged_traps = 1} ;
+ if (! defined ($duplicate_trap_window)) { $duplicate_trap_window = 0} ;
+
if (! defined ($stdout_enable)) { $stdout_enable = 0} ;
if (! defined ($log_enable)) { $log_enable = 1} ;
if (! defined ($log_file)) { $log_file = ''} ;
@@ -4207,6 +4341,7 @@
# Daemon reload
#
$timetoreload = 1;
+ &reopen_debug_file;
}
sub signal_handler_die {
@@ -5859,3 +5994,46 @@
return 0;
}
}
+
+sub reopen_debug_file {
+ if ($DEBUGGING_FILE ne '')
+ {
+ close DEBUGFILE;
+ if (open DEBUGFILE, ">>$DEBUGGING_FILE")
+ {
+ select DEBUGFILE; # change default output to debug file
+ $debug_file_used = 1;
+ $debug_file_open_error = 0;
+ print "Debug file $DEBUGGING_FILE re-opened under uid $daemon_uid\n";
+ warn "Debug file $DEBUGGING_FILE re-opened under uid $daemon_uid\n";
+ }
+ else
+ {
+ warn "could not re-open debug output file ($!)";
+
+ if ($syslog_system_enable == 1 && $daemon == 1)
+ {
+ syslog_system("Could not re-open debug output file!");
+ }
+
+ if ($log_system_enable == 1 && $daemon == 1)
+ {
+ log_system("Could not re-open debug output file!");
+ }
+
+ if ($eventlog_system_enable == 1 && $daemon == 1){
+ eventlog_system("Could not re-open debug output file!",14,$eventlog_error);
+ }
+ return 0;
+ }
+ return 1;
+ }
+ return 0;
+}
+
+
+
+
+
+
+
|
[-]
[+]
|
Changed |
snmptt_1.3.tar.bz2/snmptt-init.d
^
|
@@ -1,14 +1,25 @@
#!/bin/bash
# init file for snmptt
-# Alex Burger - 8/29/02
-# - 9/8/03 - Added snmptt.pid support to Stop function
-#
-# chkconfig: - 50 50
-# description: Simple Network Management Protocol (SNMP) Daemon
+# Alex Burger - 08/29/02
+# - 09/08/03 - Added snmptt.pid support to Stop function
+# - 05/17/09 - Added LSB init keywords, change priority, add
+# INIT INFO.
+# chkconfig: - 49 51
+# description: SNMP Trap Translator daemon
#
# processname: /usr/sbin/snmptt
# pidfile: /var/run/snmptt.pid
+### BEGIN INIT INFO
+# Provides: snmptt
+# Default-Stop: 0 1 6
+# Required-Start: $syslog $local_fs
+# Required-Stop: $syslog $local_fs
+# Should-Start: $network snmptrapd
+# Should-Stop: $network snmptrapd
+# Short-Description: SNMP Trap Translator daemon
+### END INIT INFO
+
# source function library
. /etc/init.d/functions
@@ -65,10 +76,10 @@
restart)
restart
;;
- reload)
+ reload|force-reload)
reload
;;
- condrestart)
+ try-restart|condrestart)
condrestart
;;
status)
@@ -76,7 +87,7 @@
RETVAL=$?
;;
*)
- echo $"Usage: $0 {start|stop|restart|condrestart|reload}"
+ echo $"Usage: $0 {start|stop|status|restart|try-restart|condrestart|reload|force-reload}"
RETVAL=1
esac
|
[-]
[+]
|
Changed |
snmptt_1.3.tar.bz2/snmptt-net-snmp-test
^
|
@@ -2,7 +2,7 @@
#
# SNMPTT Net-SNMP-Test v1.0
#
-# Copyright 2002-2005 Alex Burger
+# Copyright 2002-2007 Alex Burger
# alex_b@users.sourceforge.net
#
# 4/13/2003
@@ -117,6 +117,8 @@
{
$ENV{'MIBS'} = $mibs_environment;
}
+
+$SNMP::save_descriptions = 1;
&SNMP::initMib();
if (defined ($best_guess))
@@ -208,6 +210,13 @@
$expect = 'INTEGER';
&my_getType($test, $expect,);
+print "\n\nTesting Description\n";
+print "*******************\n";
+
+$test = '.1.3.6.1.2.1.4.1'; # ipForwarding
+$expect = 'The indication of whether this entity is acting';
+&my_getDescription($test, $expect,);
+
print "\n";
sub translate
@@ -247,3 +256,28 @@
}
+sub my_getDescription
+{
+ my $test = shift;
+ my $expect = shift;
+ my $description_temp = $SNMP::MIB{$test}->{description};
+ $description_temp =~ s/\n\s+/\n/g;
+
+ if ($description_temp =~ $expect)
+ {
+ print "Test passed. Result:\n";
+ print "-------------------------------------------------\n";
+ print "$description_temp\n";
+ print "-------------------------------------------------\n";
+ }
+ else
+ {
+ print "Test FAILED! Expected a string containing:\n";
+ print "$expect\n\n";
+ print "Received:\n";
+ print "-------------------------------------------------\n";
+ print "$description_temp\n";
+ print "-------------------------------------------------\n";
+ }
+}
+
|
[-]
[+]
|
Changed |
snmptt_1.3.tar.bz2/snmptt.ini
^
|
@@ -1,5 +1,5 @@
#
-# SNMPTT v1.2 Configuration File
+# SNMPTT v1.3 Configuration File
#
# Linux / Unix
#
@@ -262,6 +262,19 @@
# The recommended setting is 1 with only one log system enabled.
keep_unlogged_traps = 1
+# How often duplicate traps will be processed. An MD5 hash of all incoming traps
+# is stored in memory and is used to check for duplicates. All variables except for
+# the uptime variable are used when calculating the MD5. The larger this variable,
+# the more memory snmptt will require.
+# Note: In most cases it may be a good idea to enable this but sometimes it can have a
+# negative effect. For example, if you are trying to troubleshoot a wireless device
+# that keeps losing it's connection you may want to disable this so that you see
+# all the associations and disassociations.
+# 5 minutes = 300
+# 10 minutes = 600
+# 15 minutes = 900
+duplicate_trap_window = 0
+
[Logging]
# Set to 1 to enable messages to be sent to standard output, or 0 to disable.
# Would normally be disabled unless you are piping this program to another
@@ -271,16 +284,16 @@
# location
log_enable = 1
-# Log file location. The COMPLETE path and filename. Ex: '/var/log/snmptt.log'
-log_file = /var/log/snmptt.log
+# Log file location. The COMPLETE path and filename. Ex: '/var/log/snmptt/snmptt.log'
+log_file = /var/log/snmptt/snmptt.log
# Set to 1 to enable text logging of *SNMPTT system errors*. Make sure you
# specify a log_system_file location
log_system_enable = 0
# Log file location. The COMPLETE path and filename.
-# Ex: '/var/log/snmpttsystem.log'
-log_system_file = /var/log/snmpttsystem.log
+# Ex: '/var/log/snmptt/snmpttsystem.log'
+log_system_file = /var/log/snmptt/snmpttsystem.log
# Set to 1 to enable logging of unknown traps. This should normally be left off
# as the file could grow large quickly. Used primarily for troubleshooting. If
@@ -292,10 +305,10 @@
unknown_trap_log_enable = 0
# Unknown trap log file location. The COMPLETE path and filename.
-# Ex: '/var/log/snmpttunknown.log'
+# Ex: '/var/log/snmptt/snmpttunknown.log'
# Leave blank to disable logging to text file if logging to SQL is enabled
# for unknown traps
-unknown_trap_log_file = /var/log/snmpttunknown.log
+unknown_trap_log_file = /var/log/snmptt/snmpttunknown.log
# How often in seconds statistics should be logged to syslog or the event log.
# Set to 0 to disable
@@ -590,12 +603,12 @@
# Location of debugging output file. Leave blank to default to STDOUT (good for
# standalone mode, or daemon mode without forking)
DEBUGGING_FILE =
-# DEBUGGING_FILE = /var/log/snmptt.debug
+# DEBUGGING_FILE = /var/log/snmptt/snmptt.debug
# Debugging file - SNMPTTHANDLER
# Location of debugging output file. Leave blank to default to STDOUT
DEBUGGING_FILE_HANDLER =
-# DEBUGGING_FILE_HANDLER = /var/log/snmptthandler.debug
+# DEBUGGING_FILE_HANDLER = /var/log/snmptt/snmptthandler.debug
[TrapFiles]
# A list of snmptt.conf files (this is NOT the snmptrapd.conf file). The COMPLETE path
|
[-]
[+]
|
Changed |
snmptt_1.3.tar.bz2/snmptt.ini-nt
^
|
@@ -1,5 +1,5 @@
#
-# SNMPTT v1.2 Configuration File
+# SNMPTT v1.3 Configuration File
#
# Windows NT
#
@@ -247,6 +247,19 @@
# The recommended setting is 1 with only one log system enabled.
keep_unlogged_traps = 1
+# How often duplicate traps will be processed. An MD5 hash of all incoming traps
+# is stored in memory and is used to check for duplicates. All variables except for
+# the uptime variable are used when calculating the MD5. The larger this variable,
+# the more memory snmptt will require.
+# Note: In most cases it may be a good idea to enable this but sometimes it can have a
+# negative effect. For example, if you are trying to troubleshoot a wireless device
+# that keeps losing it's connection you may want to disable this so that you see
+# all the associations and disassociations.
+# 5 minutes = 300
+# 10 minutes = 600
+# 15 minutes = 900
+duplicate_trap_window = 0
+
[Logging]
# Set to 1 to enable messages to be sent to standard output, or 0 to disable.
# Would normally be disabled unless you are piping this program to another
@@ -256,16 +269,16 @@
# location
log_enable = 1
-# Log file location. The COMPLETE path and filename. Ex: '/var/log/snmptt.log'
-log_file = c:\\snmp\\snmptt.log
+# Log file location. The COMPLETE path and filename. Ex: 'c:\\snmp\\log\\snmptt.log'
+log_file = c:\\snmp\\log\\snmptt.log
# Set to 1 to enable text logging of *SNMPTT system errors*. Make sure you
# specify a log_system_file location
log_system_enable = 0
# Log file location. The COMPLETE path and filename.
-# Ex: '/var/log/snmpttsystem.log'
-log_system_file = c:\\snmp\\snmpttsystem.log
+# Ex: 'c:\\snmp\\log\\snmpttsystem.log'
+log_system_file = c:\\snmp\\log\\snmpttsystem.log
# Set to 1 to enable logging of unknown traps. This should normally be left off
# as the file could grow large quickly. Used primarily for troubleshooting. If
@@ -277,10 +290,10 @@
unknown_trap_log_enable = 0
# Unknown trap log file location. The COMPLETE path and filename.
-# Ex: 'c:\\snmp\\snmpttunknown.log'
+# Ex: 'c:\\snmp\\log\\snmpttunknown.log'
# Leave blank to disable logging to text file if logging to SQL is enabled
# for unknown traps
-unknown_trap_log_file = c:\\snmp\\snmpttunknown.log
+unknown_trap_log_file = c:\\snmp\\log\\snmpttunknown.log
# How often in seconds statistics should be logged to syslog or the event log.
# Set to 0 to disable
@@ -585,12 +598,12 @@
# Location of debugging output file. Leave blank to default to STDOUT (good for
# standalone mode, or daemon mode without forking)
DEBUGGING_FILE =
-# DEBUGGING_FILE = c:\\snmp\\snmptt.debug
+# DEBUGGING_FILE = c:\\snmp\\log\\snmptt.debug
# Debugging file - SNMPTTHANDLER
# Location of debugging output file. Leave blank to default to STDOUT
DEBUGGING_FILE_HANDLER =
-# DEBUGGING_FILE_HANDLER = c:\\snmp\\snmptthandler.debug
+# DEBUGGING_FILE_HANDLER = c:\\snmp\\log\\snmptthandler.debug
[TrapFiles]
# A list of snmptt.conf files (this is NOT the snmptrapd.conf file). The COMPLETE path
|
[-]
[+]
|
Added |
snmptt_1.3.tar.bz2/snmptt.logrotate
^
|
@@ -0,0 +1,14 @@
+/var/log/snmptt/snmptt*.log /var/log/snmptt/snmptthandler.debug {
+ weekly
+ notifempty
+ missingok
+}
+
+/var/log/snmptt/snmptt.debug {
+ weekly
+ notifempty
+ missingok
+ postrotate
+ /etc/init.d/snmptt reload >/dev/null 2>/dev/null || true
+ endscript
+}
|
[-]
[+]
|
Changed |
snmptt_1.3.tar.bz2/snmpttconvert
^
|
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
-# SNMPTTCONVERT v1.2
+# SNMPTTCONVERT v1.3
#
# Copyright 2002-2007 Alex Burger
# alex_b@users.sourceforge.net
|
[-]
[+]
|
Changed |
snmptt_1.3.tar.bz2/snmpttconvertmib
^
|
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
-# SNMPTTCONVERTMIB v1.2
+# SNMPTTCONVERTMIB v1.3
#
# Copyright 2002-2007 Alex Burger
# alex_b@users.sourceforge.net
@@ -50,7 +50,7 @@
#############################################################################
#
-my $snmpttconvertmib_version = "v1.2";
+my $snmpttconvertmib_version = "v1.3";
sub showversion
{
@@ -206,14 +206,26 @@
die "Cannot open output file: $!";
}
-# A mib file can contain multiple BEGIN definitions. This finds the first on
+# A mib file can contain multiple BEGIN definitions. This finds the first one
# to make sure we have at least one definition.
# Determine name of MIB file
my $mib_name = '';
while ($currentline <= $#mibfile)
{
my $line = $mibfile[$currentline];
- if ($line =~ /(.*)DEFINITIONS\s*::=\s*BEGIN/)
+
+ # Sometimes DEFINITIONS ::= BEGIN will appear on the line following the mib name.
+ # Look for DEFINITIONS ::= BEGIN with nothing (white space allowed) around it and a previous line with
+ # only a single word with whitespace around it.
+ if ($currentline > 0 && $line =~ /^\s*DEFINITIONS\s*::=\s*BEGIN\s*$/ && $mibfile[$currentline-1] =~ /^\s*(\S+)\s*$/) {
+ # We should have found the mib name
+ $mib_name = $1;
+ print "\nSplit line DEFINITIONS ::= BEGIN found ($1).\n";
+ $mib_name =~ s/\s+//g;
+ last;
+ }
+
+ elsif ($line =~ /(.*)DEFINITIONS\s*::=\s*BEGIN/)
{
$mib_name = $1;
$mib_name =~ s/\s+//g;
@@ -253,8 +265,26 @@
while ($currentline <= $#mibfile)
{
my $line = $mibfile[$currentline];
-
- if ($line =~ /(.*)DEFINITIONS\s*::=\s*BEGIN/)
+
+ # Sometimes DEFINITIONS ::= BEGIN will appear on the line following the mib name.
+ # Look for DEFINITIONS ::= BEGIN with nothing (white space allowed) around it and a previous line with
+ # only a single word with whitespace around it.
+ if ($currentline > 0 && $line =~ /^\s*DEFINITIONS\s*::=\s*BEGIN\s*$/ && $mibfile[$currentline-1] =~ /^\s*(\S+)\s*$/) {
+ # We should have found the mib name
+ print "\n\nSplit line DEFINITIONS ::= BEGIN found ($1).\n";
+
+ $mib_name = $1;
+ $mib_name =~ s/\s+//g;
+ print "Processing MIB: $mib_name\n";
+
+ print OUTPUTFILE "#\n#\n#\n#\n";
+ print OUTPUTFILE "MIB: $mib_name (file:$input) converted on " . scalar(localtime) . " using snmpttconvertmib $snmpttconvertmib_version\n";
+
+ $currentline++; # Increment to the next line
+ next;
+ }
+
+ elsif ($line =~ /(.*)DEFINITIONS\s*::=\s*BEGIN/)
{
$mib_name = $1;
$mib_name =~ s/\s+//g;
@@ -300,14 +330,16 @@
my @variables = ();
+ print "#\n";
+
# Sometimes the TRAP-TYPE / NOTIFICATION-TYPE will appear on the line following the trap name
# Look for xxx-TYPE with nothing (white space allowed) around it and a previous line with only a single word
# with whitespace around it.
- if ( ($currentline > 0 && $line =~ /^\s*TRAP-TYPE\s*$/ && $mibfile[$currentline-1] =~ /^\s*(\w+)\s*$/) ||
- ($currentline > 0 && $line =~ /^\s*NOTIFICATION-TYPE\s*$/ && $mibfile[$currentline-1] =~ /^\s*(\w+)\s*$/) ) {
+ if ( ($currentline > 0 && $line =~ /^\s*TRAP-TYPE\s*$/ && $mibfile[$currentline-1] =~ /^\s*(\S+)\s*$/) ||
+ ($currentline > 0 && $line =~ /^\s*NOTIFICATION-TYPE\s*$/ && $mibfile[$currentline-1] =~ /^\s*(\S+)\s*$/) ) {
# We should have found the trap name
$trapname = $1;
- print "split line TRAP-TYPE / NOTIFICATION-TYPE found ($1).\n";
+ print "Split line TRAP-TYPE / NOTIFICATION-TYPE found ($1).\n";
}
# If the TRAP-TYPE / NOTIFICATION-TYPE line starts with white space, it's probably a import line, so ignore
@@ -326,7 +358,6 @@
$trapname = $1;
- print "#\n";
print "Line: $currentline\n";
if ($trapversion eq 'TRAP')
{
@@ -898,6 +929,11 @@
print "Total translations: $total_translations\n";
print "Successful translations: $successful_translations\n";
print "Failed translations: $failed_translations\n";
+
+ if ($total_translations == 0) {
+ print "\nThe MIB file did not contain any TRAP-TYPE or NOTIFICATION-TYPE definitions,\n";
+ print "so no translations occured. Try another MIB file.\n\n";
+ }
}
|
[-]
[+]
|
Changed |
snmptt_1.3.tar.bz2/snmptthandler
^
|
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
-# SNMPTTHANDLER v1.2
+# SNMPTTHANDLER v1.3
#
# Copyright 2002-2007 Alex Burger
# alex_b@users.sourceforge.net
|
[-]
[+]
|
Added |
snmptt_1.3.tar.bz2/snmptthandler-embedded
^
|
@@ -0,0 +1,298 @@
+#!/usr/bin/perl
+#
+# SNMPTTHANDLER-E v1.3
+#
+# Copyright 2009 Alex Burger
+# alex_b@users.sourceforge.net
+# 5/17/2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+##############################################################################
+#
+# http://www.sourceforge.net/projects/snmptt
+#
+# This script is an embedded snmptrapd trap handler for use with the NET-SNMP
+# / UCD-SNMP and SNMPTT. ** It can only be run directly from snmptrapd. **
+#
+# The script is called by defining a perl handler snmptrapd.conf.
+# For example:
+#
+# perl do "/sbin/snmptthandler-embedded";
+#
+# SNMPTTHANDLER-EMBEDDED dumps the received traps into a directory to be
+# processed by the SNMPTT daemon.
+#
+##############################################################################
+use strict;
+use Getopt::Long;
+use Time::HiRes qw(gettimeofday);
+use Config::IniFiles;
+
+my $debug = ''; # Override debug level setting in snmptt.ini
+ # Set to '' to use the snmptt.ini setting or set to 1 to enable.
+
+my $ini = ''; # Override snmptt.ini file location.
+ # Set to '' to use the default locations of /etc/snmp/snmptt.ini
+ # and /etc/snmptt.ini for Unix and %SYSTEMROOT%\snmptt.ini for
+ # Windows.
+
+##############################################################################
+# Don't modify anything below this line
+#
+my $DEBUGGING;
+my $DEBUGGING_FILE;
+my $configfile;
+my $spool_directory;
+
+if ($debug >= 1)
+{
+ $DEBUGGING = 1;
+}
+
+&loadsnmpttini; # Load snmptt.ini
+
+##############################################################################
+
+# Register the trap receiver
+NetSNMP::TrapReceiver::register("all", \&snmptt_trap_receiver) ||
+warn "failed to register our perl trap handler\n";
+
+print STDERR "Loaded the SNMPTT embedded snmptrapd handler\n";
+
+##############################################################################
+# Trap receiver.
+sub snmptt_trap_receiver {
+ my $pdu_info = $_[0];
+ my $varbinds = $_[1];
+
+ my $hostname = $$pdu_info{"receivedfrom"} || "unknown";
+ if ($hostname ne "unknown") {
+ $hostname =~ /\[(.*?)\].*/; # UDP: [127.0.0.1]:41070->[127.0.0.1]
+ $hostname = $1 || "unknown";
+ }
+
+ my $ip_address = $hostname;
+
+ my $community = $$pdu_info{"community"} || "unknown";
+
+ # contextEngineID in hash = snmpCommunityContextEngineID = .1.3.6.1.6.3.18.1.1.1.4
+ my $contextEngineID = $$pdu_info{"contextEngineID"} || "unknown";
+ $contextEngineID = unpack('h*', $contextEngineID);
+
+ # contextName in hash = snmpCommunityContextName = .1.3.6.1.6.3.18.1.1.1.5
+ my $contextName = $$pdu_info{"contextName"} || "unknown";
+
+ # snmplib/snmp_api.c:
+ # static oid snmpEngineIDoid[] = { 1,3,6,1,6,3,10,2,1,1,0};
+ # securityEngineID in hash = snmpEngineID = .1.3.6.1.6.3.10.2.1.1.0
+ my $securityEngineID = $$pdu_info{"securityEngineID"} || "unknown";
+ $securityEngineID = unpack('h*', $securityEngineID);
+
+ # securityName in hash = snmpCommunitySecurityName = .1.3.6.1.6.3.18.1.1.1.3
+ my $securityName = $$pdu_info{"securityName"} || "unknown";
+
+ # SNMPTT expects the 3rd item to be the uptime and the 4th to be the trapname
+ my $uptime;
+ my $trapname;
+ my $other_varbinds;
+
+ # Cycle through all the varbinds
+ foreach my $x (@$varbinds) {
+ printf " %-30s type=%-2d value=%s\n", $x->[0], $x->[2], $x->[1];
+
+ my $oid = "$x->[0]";
+ my $value = "$x->[1]";
+ $value =~ s/STRING: //g;
+ $value =~ s/INTEGER: //g;
+
+ if ($oid eq ".1.3.6.1.2.1.1.3.0") {
+ my $temp = $value;
+ $temp =~ /Timeticks: \(.*?\) (.*)/;
+ $uptime = $oid . " " . $1;
+ }
+ elsif ($oid eq ".1.3.6.1.6.3.1.1.4.1.0") {
+ my $temp = $value;
+ $temp =~ /OID: (.*)/;
+ $trapname = $oid . " " . $1;
+ }
+ else {
+ $other_varbinds .= $oid . " " . $value . "\n";
+ }
+ }
+
+ ##############################################################################
+ # Create file in spool directory based on current time
+ my ($s, $usec) = gettimeofday;
+
+ # Pad the numbers with 0's to make sure they are all the same length. Sometimes the
+ # usec is shorter than 6.
+ my $s_pad = sprintf("%09d",$s);
+ my $usec_pad = sprintf("%06d",$usec);
+
+ if ($DEBUGGING >= 1)
+ {
+ if ($DEBUGGING_FILE ne '')
+ {
+ open DEBUGFILE, ">>$DEBUGGING_FILE"
+ or warn "Could not open debug output file ($!)";
+
+ select DEBUGFILE; # Change default output to debug file
+ }
+
+ # Print out time
+ print "-------------------------------------------------------------\n";
+ print "SNMPTTHANDLER-EMBEDDED started: ",scalar(localtime),"\n\n";
+ print "s = $s, usec = $usec\n";
+ print "s_pad = $s_pad, usec_pad = $usec_pad\n\n";
+ print "Data received:\n\n";
+ }
+
+ my $spoolfile = $spool_directory.'#snmptt-trap-'.$s_pad.$usec_pad;
+
+ unless (open SPOOL, ">$spoolfile")
+ {
+ if ($DEBUGGING >= 1)
+ {
+ print "Could not write to file file $spoolfile! Trap will be lost!\n";
+ }
+ die "Could not write to file $spoolfile! Trap will be lost!\n";
+ }
+
+ print SPOOL time()."\n";
+ print SPOOL $hostname . "\n";
+ print SPOOL $ip_address . "\n";
+ print SPOOL $uptime . "\n";
+ print SPOOL $trapname . "\n";
+ print SPOOL ".1.3.6.1.6.3.18.1.4.0 $community\n";
+ print SPOOL $other_varbinds;
+ if ($securityEngineID ne "") {
+ print SPOOL ".1.3.6.1.6.3.10.2.1.1.0 \"0x$securityEngineID\"\n";
+ }
+ if ($securityName ne "") {
+ print SPOOL ".1.3.6.1.6.3.18.1.1.1.3 \"$securityName\"\n";
+ }
+ if ($contextEngineID ne "") {
+ print SPOOL ".1.3.6.1.6.3.18.1.1.1.4 \"0x$contextEngineID\"\n";
+ }
+ if ($contextName ne "") {
+ print SPOOL ".1.3.6.1.6.3.18.1.1.1.5 \"$contextName\"\n";
+ }
+
+ close SPOOL;
+
+ if ($DEBUGGING >= 1) {
+ print SPOOL time()."\n";
+ print $hostname . "\n";
+ print $ip_address . "\n";
+ print $uptime . "\n";
+ print $trapname . "\n";
+ print ".1.3.6.1.6.3.18.1.4.0 $community\n";
+ print $other_varbinds;
+ if ($securityEngineID ne "") {
+ print ".1.3.6.1.6.3.10.2.1.1.0 \"0x$securityEngineID\"\n";
+ }
+ if ($securityName ne "") {
+ print ".1.3.6.1.6.3.18.1.1.1.3 \"$securityName\"\n";
+ }
+ if ($contextEngineID ne "") {
+ print ".1.3.6.1.6.3.18.1.1.1.4 \"0x$contextEngineID\"\n";
+ }
+ if ($contextName ne "") {
+ print ".1.3.6.1.6.3.18.1.1.1.5 \"$contextName\"\n";
+ }
+
+ # Flush the buffers for debugging.
+ $| = 1;
+ $| = 0;
+ }
+
+ return NETSNMPTRAPD_HANDLER_OK;
+}
+
+sub loadsnmpttini {
+ ##############################################################################
+ # Load snmptt.ini
+ #
+ # For Linux / Unix, try /etc/snmp/snmptt.ini first, /etc/snmptt.ini second.
+ #
+ # For Windows, try %SystemRoot%\snmptt.ini only.
+ #
+
+ my $cfg;
+
+ if ($ini ne '') {
+ $configfile = $ini;
+ }
+ else {
+ if ($^O ne "MSWin32") {
+ if (-f '/etc/snmp/snmptt.ini' && -r '/etc/snmp/snmptt.ini') {
+ $configfile = '/etc/snmp/snmptt.ini';
+ }
+ elsif (-f '/etc/snmptt.ini' && -r '/etc/snmptt.ini') {
+ $configfile = '/etc/snmptt.ini';
+ }
+ else {
+ if ($DEBUGGING >= 1) {
+ print "Could not load snmptt.ini from the default file locations (/etc/snmp/ or /etc/).\n";
+ }
+ warn "Could not load snmptt.ini from the default file locations (/etc/snmp/ or /etc/).\n";
+ exit(1);
+ }
+ }
+ else {
+ $configfile = $ENV{'SystemRoot'}."\\snmptt.ini";
+ }
+ }
+
+ if( open( CONFIG, $configfile ) ) {
+ close CONFIG;
+ $cfg = new Config::IniFiles( -file => $configfile);
+ }
+ else
+ {
+ if ($DEBUGGING >= 1) {
+ print "Config file ($configfile) could not be loaded\n";
+ }
+ warn "Config file ($configfile) could not be loaded\n";
+ exit(1);
+ }
+
+ if (! $cfg)
+ {
+ if ($DEBUGGING >= 1) {
+ print "Error in config file - please check the syntax in the config file\n";
+ }
+ exit(1);
+ }
+
+ # DaemonMode
+ $spool_directory = $cfg->val('DaemonMode', 'spool_directory');
+
+ # Debugging
+ if ($debug eq '') {
+ $DEBUGGING = $cfg->val('Debugging', 'DEBUGGING');
+ }
+ $DEBUGGING_FILE = $cfg->val('Debugging', 'DEBUGGING_FILE_HANDLER');
+
+ $cfg->Delete;
+
+ # Defaults Start
+ if (! defined ($spool_directory)) { $spool_directory = ''} ;
+ if (! defined ($DEBUGGING)) { $DEBUGGING = 0} ;
+ if (! defined ($DEBUGGING_FILE)) { $DEBUGGING_FILE = ''} ;
+ # Defaults End
+}
+
|