summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Lorbach <alorbach@adiscon.com>2008-02-11 14:50:25 +0000
committerAndre Lorbach <alorbach@adiscon.com>2008-02-11 14:50:25 +0000
commitad55b12ac9e9162c2fff77072ab3d56e4637c788 (patch)
treee8f36d7ba33f67f2f9e4b6fd2a7d67e2b99eb3ae
parentde41d0b857eeee7e5fbf630efdb3d1976207e438 (diff)
downloadrsyslog-ad55b12ac9e9162c2fff77072ab3d56e4637c788.tar.gz
rsyslog-ad55b12ac9e9162c2fff77072ab3d56e4637c788.tar.xz
rsyslog-ad55b12ac9e9162c2fff77072ab3d56e4637c788.zip
Fixed minor bug finalize_it, pdu only needs to be cleaned if snmp_send
failed. Also added documentation to the omsnmp module.
-rw-r--r--doc/omsnmp.html118
-rw-r--r--plugins/omsnmp/omsnmp.c3
2 files changed, 113 insertions, 8 deletions
diff --git a/doc/omsnmp.html b/doc/omsnmp.html
index 7378ad72..2c9d16f8 100644
--- a/doc/omsnmp.html
+++ b/doc/omsnmp.html
@@ -1,7 +1,7 @@
-<html>
+<html>
<head>
-<meta http-equiv="Content-Language" content="de">
+<meta http-equiv="Content-Language" content="en">
<title>Understanding rsyslog queues</title>
</head>
@@ -10,20 +10,122 @@
<h1>SNMP Output Module</h1>
<p><b>Module Name:&nbsp;&nbsp;&nbsp; omsnmp</b></p>
<p><b>Description</b>:</p>
-<p>Provides the ability to send SNMPv1 &amp; v2 traps.</p>
-<p>...</p>
+<p>Provides the ability to send syslog messages as an SNMPv1 &amp; v2c traps. By
+default, SNMPv2c is preferred. The syslog message is wrapped into a OCTED
+STRING variable, by default with the OID i.o.d.internet.private.enterprises.
+This module uses the <a target="_blank" href="http://net-snmp.sourceforge.net/">
+NET-SNMP</a> library. In order to compile this module, you will need to have the
+<a target="_blank" href="http://net-snmp.sourceforge.net/">NET-SNMP</a>
+developer (headers) package installed. </p>
+<p>&nbsp;</p>
<p><b>Action Line:</b></p>
<p>%omsnmp% without any further parameters.</p>
+<p>&nbsp;</p>
<p><b>Configuration Directives</b>:</p>
<ul>
- <li>$ActionSNMPTransport ...</li>
- <li>...</li>
+ <li><strong>$actionsnmptransport </strong>(This parameter is optional, the
+ default value is &quot;udp&quot;)<br>
+ <br>
+ Defines the transport type you wish to use. Technically we can support all
+ transport types which are supported by NET-SNMP. <br>
+ To name a few possible values: <br>
+ <br>
+ udp, tcp, udp6, tcp6, icmp, icmp6 ...<br>
+ <br>
+ Example: <strong>$actionsnmptransport udp<br>
+ </strong></li>
+ <li><strong>$actionsnmptarget</strong><br>
+ <br>
+ This can be a hostname or ip address, and is our snmp target host. This
+ parameter is required, if the snmptarget is not defined, nothing will be
+ send. <br>
+ <br>
+ Example: <strong>$actionsnmptarget server.domain.xxx</strong><br>
+ </li>
+ <li><strong>$actionsnmptargetport </strong>(This parameter is optional, the
+ default value is &quot;162&quot;)<br>
+ <br>
+ The port which will be used, common values are port 162 or 161. <br>
+ <br>
+ Example: <strong>$actionsnmptargetport 162</strong><br>
+ </li>
+ <li><strong>$actionsnmpversion </strong>(This parameter is optional, the
+ default value is &quot;1&quot;)<br>
+ <br>
+ There can only be two choices for this parameter for now. <br>
+ 0 means SNMPv1 will be used.<br>
+ 1 means SNMPv2c will be used. <br>
+ Any other value will default to 1. <br>
+ <br>
+ Example: <strong>$actionsnmpversion 1</strong><br>
+ </li>
+ <li><strong>$actionsnmpcommunity </strong>(This parameter is optional, the
+ default value is &quot;public&quot;)<br>
+ <br>
+ This sets the used SNMP Community.<br>
+ <br>
+ Example:<strong> $actionsnmpcommunity public</strong><br>
+ </li>
+ <li><strong>$actionsnmpsyslogmessageoid </strong>(This parameter is
+ optional, the default value is &quot;1.3.6.1.4.1&quot; which means &quot;i.o.d.internet.private.enterprises&quot;)<br>
+ <br>
+ This OID will be used as a variable, type &quot;OCTET STRING&quot;. This variable will
+ contain the full syslog message including syslog header. I also recommend to
+ use the default value here unless you require to use a different OID. <br>
+ <br>
+ Example: <strong>$actionsnmpsyslogmessageoid 1.3.6.1.4.1</strong><br>
+ </li>
+ <li><strong>$actionsnmpenterpriseoid </strong>(This parameter is optional,
+ the default value is &quot;1.3.6.1.4.1.3.1.1&quot; which means &quot;enterprises.cmu.1.1&quot;)<br>
+ <br>
+ Customize this value if needed. I recommend to use the default value unless
+ you require to use a different OID. <br>
+ This configuration parameter is used for <strong>SNMPv1</strong> only. It
+ has no effect if <strong>SNMPv2</strong> is used. <br>
+ <br>
+ Example: <strong>$actionsnmpenterpriseoid 1.3.6.1.4.1.3.1.1 </strong><br>
+ </li>
+ <li><strong>$actionsnmpspecifictype </strong>(This parameter is optional,
+ the default value is &quot;0&quot;)<strong> </strong><br>
+ <br>
+ This is the specific trap number. This configuration parameter is used for
+ <strong>SNMPv1</strong> only. It has no effect if <strong>SNMPv2</strong> is
+ used. <br>
+ <br>
+ Example: <strong>$actionsnmpspecifictype 0</strong><br>
+ </li>
+ <li><strong>$actionsnmptraptype</strong> (This parameter is optional, the
+ default value is &quot;6&quot; which means SNMP_TRAP_ENTERPRISESPECIFIC) <br>
+ <br>
+ There are only 7 Possible trap types defined which can be used here. These
+ trap types are: <br>
+ 0 = SNMP_TRAP_COLDSTART<br>
+ 1 = SNMP_TRAP_WARMSTART<br>
+ 2 = SNMP_TRAP_LINKDOWN<br>
+ 3 = SNMP_TRAP_LINKUP<br>
+ 4 = SNMP_TRAP_AUTHFAIL<br>
+ 5 = SNMP_TRAP_EGPNEIGHBORLOSS<br>
+ 6 = SNMP_TRAP_ENTERPRISESPECIFIC<br>
+ <br>
+ Any other value will default to 6 automatically. This configuration
+ parameter is used for <strong>SNMPv1</strong> only. It has no effect if
+ <strong>SNMPv2</strong> is used. <br>
+ <br>
+ Example: <strong>$actionsnmptraptype 6</strong><br>
+ </li>
</ul>
+<p>&nbsp;</p>
<p><b>Caveats/Known Bugs:</b></p>
<p><b>Sample:</b></p>
<p>The following commands send every message as a snmp trap.</p>
-<textarea rows="4" cols="60">$ModLoad omsnmp.so
-....
+<textarea rows="10" cols="60">$ModLoad omsnmp.so
+
+$actionsnmptransport udp
+$actionsnmptarget localhost
+$actionsnmptargetport 162
+$actionsnmpversion 1
+$actionsnmpcommunity public
+
*.* :omsnmp:
</textarea>
diff --git a/plugins/omsnmp/omsnmp.c b/plugins/omsnmp/omsnmp.c
index cd3d589a..c559dbc8 100644
--- a/plugins/omsnmp/omsnmp.c
+++ b/plugins/omsnmp/omsnmp.c
@@ -250,10 +250,13 @@ static rsRetVal omsnmp_sendsnmp(instanceData *pData, uchar *psz)
/* TODO! CLEANUP */
ABORT_FINALIZE(RS_RET_ERR);
}
+ else /* Reset pdu Pointer, already cleaned */
+ pdu = NULL;
finalize_it:
if(pdu != NULL) {
snmp_free_pdu(pdu);
+ dbgprintf( "omsnmp_sendsnmp: called snmp_free_pdu - manually freeing memory for pdu\n");
}
if(ss != NULL) {