summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Lorbach <alorbach@adiscon.com>2008-03-04 16:22:28 +0000
committerAndre Lorbach <alorbach@adiscon.com>2008-03-04 16:22:28 +0000
commit05ba3fbffeaa3142e917ea69e9e39209e893581a (patch)
tree03cef31847a51b41c08163772fb3498263bce83c
parent9088fb40be054a25deea50baaae0a33c5dac9040 (diff)
downloadrsyslog-05ba3fbffeaa3142e917ea69e9e39209e893581a.tar.gz
rsyslog-05ba3fbffeaa3142e917ea69e9e39209e893581a.tar.xz
rsyslog-05ba3fbffeaa3142e917ea69e9e39209e893581a.zip
Added custom mibs for the OMSNMP output module. These mibs are derived from
adiscon monitorware and will be used by default from now on. The mibs can be found in the mibs folder of the omsnmp directory. For more details please see the documentation. Also added a new configuration variable $actionsnmptrapoid which defines the trap-type or notification-type that is used.
-rw-r--r--doc/omsnmp.html65
-rw-r--r--plugins/omsnmp/mibs/ADISCON-MIB.txt38
-rw-r--r--plugins/omsnmp/mibs/ADISCON-MONITORWARE-MIB.txt122
-rw-r--r--plugins/omsnmp/omsnmp.c32
4 files changed, 229 insertions, 28 deletions
diff --git a/doc/omsnmp.html b/doc/omsnmp.html
index 2f60862a..4087d830 100644
--- a/doc/omsnmp.html
+++ b/doc/omsnmp.html
@@ -62,27 +62,49 @@ developer (headers) package installed. </p>
<br>
This sets the used SNMP Community.<br>
<br>
- Example:<strong> $actionsnmpcommunity public</strong><br>
+ Example:<strong> $actionsnmpcommunity public<br>
+ </strong><br>
</li>
- <li><strong>$actionsnmpsyslogmessageoid </strong>(This parameter is
- optional, the default value is "1.3.6.1.4.1.9.9.41.2.0.1" which means "CISCO-SYSLOG-MIB::clogMessageGenerated")<br>
- <br>
- This OID will be used as a variable, type "OCTET STRING". This variable will
- contain the full syslog message including syslog header. It is recommend to
- use the default value here unless a different OID is required. <br>
- In order to decode this OID, you will need to have the CISCO-SYSLOG-MIB and
- CISCO-SMI mibs installed on the receiver side. Downloads of these mib files
+ <li><strong>$actionsnmptrapoid </strong>(This parameter is
+ optional, the default value is "1.3.6.1.4.1.19406.1.2.1&quot; which means
+ &quot;ADISCON-MONITORWARE-MIB::syslogtrap&quot;)<br>
+ This configuration parameter is used for <strong>SNMPv2</strong> only.<br>
+ <br>
+ This is the OID which defines the trap-type, or notifcation-type rsyslog
+ uses to send the trap. <br>
+ In order to decode this OID, you will need to have the
+ ADISCON-MONITORWARE-MIB and ADISCON-MIB mibs installed on the receiver side. Downloads of these mib files
can be found here: <br>
- <a href="http://www.oidview.com/mibs/9/CISCO-SYSLOG-MIB.html">
- http://www.oidview.com/mibs/9/CISCO-SYSLOG-MIB.html</a><br>
- <a href="http://www.oidview.com/mibs/9/CISCO-SMI.html">
- http://www.oidview.com/mibs/9/CISCO-SMI.html</a><br>
+ <a href="http://www.adiscon.org/download/ADISCON-MIB.txt">
+ http://www.adiscon.org/download/ADISCON-MIB.txt</a><br>
+ <a href="http://www.adiscon.org/download/ADISCON-MONITORWARE-MIB.txt">
+ http://www.adiscon.org/download/ADISCON-MONITORWARE-MIB.txt</a><br>
<br>
- We will add our own MIB definition in a later stage. For now,
- CISCO-SYSLOG-MIB::clogMessageGenerated is a good choice. Thanks to the net-snmp
+ Thanks to the net-snmp
mailinglist for the help and the recommendations ;).<br>
<br>
- Example: <strong>$actionsnmpsyslogmessageoid 1.3.6.1.4.1.9.9.41.2.0.1</strong><br>
+ Example: <strong>$actionsnmptrapoid 1.3.6.1.4.1.19406.1.2.1<br>
+ </strong>If you have this MIBS installed, you can also configured with the
+ OID Name: <strong>$actionsnmptrapoid ADISCON-MONITORWARE-MIB::syslogtrap<br>
+ </strong>
+ </li>
+ <li><strong>$actionsnmpsyslogmessageoid </strong>(This parameter is
+ optional, the default value is "1.3.6.1.4.1.19406.1.1.1&quot; which means
+ &quot;ADISCON-MONITORWARE-MIB::syslogMsg&quot;)<br>
+ <br>
+ This OID will be used as a variable, type &quot;OCTET STRING&quot;. This variable will
+ contain up to 255 characters of the original syslog message including syslog header. It is recommend to
+ use the default OID. <br>
+ In order to decode this OID, you will need to have the
+ ADISCON-MONITORWARE-MIB and ADISCON-MIB mibs installed on the receiver side.
+ To download these custom mibs, see the description of <strong>$actionsnmptrapoid.
+ </strong><br>
+ <br>
+ Example: <strong>$actionsnmpsyslogmessageoid 1.3.6.1.4.1.19406.1.1.1<br>
+ </strong>If you have this MIBS installed, you can also configured with the
+ OID Name: <strong>$actionsnmpsyslogmessageoid
+ ADISCON-MONITORWARE-MIB::syslogMsg<br>
+ </strong><br>
</li>
<li><strong>$actionsnmpenterpriseoid </strong>(This parameter is optional,
the default value is "1.3.6.1.4.1.3.1.1" which means "enterprises.cmu.1.1")<br>
@@ -92,7 +114,8 @@ developer (headers) package installed. </p>
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>
+ Example: <strong>$actionsnmpenterpriseoid 1.3.6.1.4.1.3.1.1 <br>
+ </strong><br>
</li>
<li><strong>$actionsnmpspecifictype </strong>(This parameter is optional,
the default value is "0")<strong> </strong><br>
@@ -101,7 +124,8 @@ developer (headers) package installed. </p>
<strong>SNMPv1</strong> only. It has no effect if <strong>SNMPv2</strong> is
used. <br>
<br>
- Example: <strong>$actionsnmpspecifictype 0</strong><br>
+ Example: <strong>$actionsnmpspecifictype 0<br>
+ </strong><br>
</li>
<li><strong>$actionsnmptraptype</strong> (This parameter is optional, the
default value is "6" which means SNMP_TRAP_ENTERPRISESPECIFIC) <br>
@@ -124,9 +148,8 @@ developer (headers) package installed. </p>
</li>
</ul>
<p>&nbsp;</p>
-<p><b>Caveats/Known Bugs:</b></p><ul><li>currently, the module is
-depending on a CISCO MIB defintion. This will be changed in the future.
-So be prepared to update some of your receivers when this happens.</li></ul>
+<p><b>Caveats/Known Bugs:</b></p><ul><li>In order to decode the custom OIDs, you
+ will need to have the adiscon mibs installed. </li></ul>
<p><b>Sample:</b></p>
<p>The following commands send every message as a snmp trap.</p>
<textarea rows="10" cols="60">$ModLoad omsnmp.so
diff --git a/plugins/omsnmp/mibs/ADISCON-MIB.txt b/plugins/omsnmp/mibs/ADISCON-MIB.txt
new file mode 100644
index 00000000..741ea84f
--- /dev/null
+++ b/plugins/omsnmp/mibs/ADISCON-MIB.txt
@@ -0,0 +1,38 @@
+-- *****************************************************************
+-- ADISCON-RSYSLOG-MIB.txt: Adiscon RSyslog message MIB file
+--
+-- March 2008, Andre Lorbach
+--
+-- Copyright (c) 2008 by Adiscon GmbH
+-- All rights reserved.
+-- *****************************************************************
+--
+-- This is a basic MIB which defines our main enterprise OID
+
+ADISCON-MIB DEFINITIONS ::= BEGIN
+
+--
+-- Top-level infrastructure for the Adiscon enterprise MIB tree
+--
+
+IMPORTS
+ MODULE-IDENTITY, enterprises FROM SNMPv2-SMI;
+
+adiscon MODULE-IDENTITY
+ LAST-UPDATED "200803040000Z"
+ ORGANIZATION "www.adiscon.com"
+ CONTACT-INFO
+ "postal: Adiscon GmbH
+ Mozartstrasse 21
+ D-97950 Großrinderfeld
+ Deutschland
+
+ email: info@adiscon.com"
+ DESCRIPTION
+ "Top-level infrastructure for the Adiscon enterprise MIB tree"
+ REVISION "200803040000Z"
+ DESCRIPTION
+ "First draft"
+ ::= { enterprises 19406}
+
+END
diff --git a/plugins/omsnmp/mibs/ADISCON-MONITORWARE-MIB.txt b/plugins/omsnmp/mibs/ADISCON-MONITORWARE-MIB.txt
new file mode 100644
index 00000000..7ba54cf0
--- /dev/null
+++ b/plugins/omsnmp/mibs/ADISCON-MONITORWARE-MIB.txt
@@ -0,0 +1,122 @@
+-- *****************************************************************
+-- ADISCON-MONITORWARE-MIB.txt: Adiscon Monitorware message MIB file
+--
+-- March 2008, Andre Lorbach
+--
+-- Copyright (c) 2008 by Adiscon GmbH
+-- All rights reserved.
+-- *****************************************************************
+--
+-- This MIB defines traps and variables to wrap syslog messages into
+-- snmp traps.
+
+ADISCON-MONITORWARE-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+ enterprises,
+ MODULE-IDENTITY, OBJECT-TYPE, Integer32,
+ NOTIFICATION-TYPE FROM SNMPv2-SMI,
+ adiscon FROM ADISCON-MIB
+;
+
+monitorware MODULE-IDENTITY
+ LAST-UPDATED "200803040000Z"
+ ORGANIZATION "www.adiscon-com"
+ CONTACT-INFO
+ "postal: Adiscon GmbH
+ Mozartstrasse 21
+ D-97950 Großrinderfeld
+ Deutschland
+
+ email: info@adiscon.com"
+ DESCRIPTION
+ "This MIB defines traps and variables to wrap syslog messages into snmp traps."
+ REVISION "200803040000Z"
+ DESCRIPTION
+ "First draft"
+ ::= { adiscon 1 }
+
+-- Printable string, using the ISO 8859-1 character set.
+DisplayString ::= OCTET STRING (SIZE (0..255))
+--
+
+--
+-- top level structure
+--
+-- adiscon OBJECT IDENTIFIER ::= { enterprises 19406 }
+monitorware OBJECT IDENTIFIER ::= { adiscon 1 }
+monitorwarevars OBJECT IDENTIFIER ::= { monitorware 1 }
+monitorwaretraps OBJECT IDENTIFIER ::= { monitorware 2 }
+
+-- *****************************************************************
+-- Trap variables
+-- *****************************************************************
+
+syslogMsg OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS accessible-for-notify
+ STATUS current
+ DESCRIPTION
+ "Syslog Message, this will contain the full
+ syslog message including the full syslog header"
+ ::= { monitorwarevars 1 }
+
+syslogSeverity OBJECT-TYPE
+ SYNTAX INTEGER {
+ emergency (0),
+ alert (1),
+ critical (2),
+ error (3),
+ warning (4),
+ notice (5),
+ info (6),
+ debug (7)
+ }
+ MAX-ACCESS accessible-for-notify
+ STATUS current
+ DESCRIPTION
+ "Syslog severity(priority)."
+ ::= { monitorwarevars 2 }
+
+syslogFacility OBJECT-TYPE
+ SYNTAX INTEGER {
+ kern (0),
+ user (1),
+ mail (2),
+ daemon (3),
+ auth (4),
+ syslog (5),
+ lpr (6),
+ news (7),
+ uucp (8),
+ cron (9),
+ local0 (16),
+ local1 (17),
+ local2 (18),
+ local3 (19),
+ local4 (20),
+ local5 (21),
+ local6 (22),
+ local7 (23)
+ }
+ MAX-ACCESS accessible-for-notify
+ STATUS current
+ DESCRIPTION
+ "Syslog facility."
+ ::= { monitorwarevars 3 }
+
+-- *****************************************************************
+-- Trap definitions
+-- *****************************************************************
+
+syslogtrap NOTIFICATION-TYPE
+ OBJECTS { syslogMsg,
+ syslogSeverity,
+ syslogFacility
+ }
+ STATUS current
+ DESCRIPTION
+ "Syslogmessage Trap from monitorware."
+::= { monitorwaretraps 1 }
+
+END
diff --git a/plugins/omsnmp/omsnmp.c b/plugins/omsnmp/omsnmp.c
index 67c63b64..618a3f10 100644
--- a/plugins/omsnmp/omsnmp.c
+++ b/plugins/omsnmp/omsnmp.c
@@ -66,6 +66,7 @@ static int iPort = 0;
static int iSNMPVersion = 1; /* 0 Means SNMPv1, 1 Means SNMPv2c */
static uchar* pszCommunity = NULL;
static uchar* pszEnterpriseOID = NULL;
+static uchar* pszSnmpTrapOID = NULL;
static uchar* pszSyslogMessageOID = NULL;
static int iSpecificType = 0;
static int iTrapType = SNMP_TRAP_ENTERPRISESPECIFIC;/*Default is SNMP_TRAP_ENTERPRISESPECIFIC */
@@ -86,11 +87,12 @@ typedef struct _instanceData {
uchar szTargetAndPort[MAXHOSTNAMELEN+1]; /* IP/hostname + Port,needed format for SNMP LIB */
uchar szCommunity[OMSNMP_MAXCOMMUNITYLENGHT+1]; /* Snmp Community */
uchar szEnterpriseOID[OMSNMP_MAXOIDLENGHT+1]; /* Snmp Enterprise OID - default is (1.3.6.1.4.1.3.1.1 = enterprises.cmu.1.1) */
- uchar szSyslogMessageOID[OMSNMP_MAXOIDLENGHT+1]; /* Snmp OID used for the Syslog Message - default is 1.3.6.1.4.1.9.9.41.2.0.1 - CISCO-SYSLOG-MIB::clogMessageGenerated
- * You will need the CISCO-SYSLOG-MIB and CISCO-SMI mibs installed on the receiver side in order to decode this mib.
+ uchar szSnmpTrapOID[OMSNMP_MAXOIDLENGHT+1]; /* Snmp Trap OID - default is (1.3.6.1.4.1.19406.1.2.1 = ADISCON-MONITORWARE-MIB::syslogtrap) */
+ uchar szSyslogMessageOID[OMSNMP_MAXOIDLENGHT+1]; /* Snmp OID used for the Syslog Message - default is 1.3.6.1.4.1.19406.1.1.1 - ADISCON-MONITORWARE-MIB::syslogMsg
+ * You will need the ADISCON-MONITORWARE-MIB and ADISCON-MIB mibs installed on the receiver side in order to decode this mib.
* Downloads of these mib files can be found here:
- * http://www.oidview.com/mibs/9/CISCO-SYSLOG-MIB.html
- * http://www.oidview.com/mibs/9/CISCO-SMI.html
+ * http://www.adiscon.org/download/ADISCON-MONITORWARE-MIB.txt
+ * http://www.adiscon.org/download/ADISCON-MIB.txt
*/
int iPort; /* Target Port */
int iSNMPVersion; /* SNMP Version to use */
@@ -114,6 +116,7 @@ CODESTARTdbgPrintInstInfo
dbgprintf("SNMPVersion (0=v1, 1=v2c): %d\n", pData->iSNMPVersion);
dbgprintf("Community: %s\n", pData->szCommunity);
dbgprintf("EnterpriseOID: %s\n", pData->szEnterpriseOID);
+ dbgprintf("SnmpTrapOID: %s\n", pData->szSnmpTrapOID);
dbgprintf("SyslogMessageOID: %s\n", pData->szSyslogMessageOID);
dbgprintf("TrapType: %d\n", pData->iTrapType);
dbgprintf("SpecificType: %d\n", pData->iSpecificType);
@@ -244,10 +247,10 @@ static rsRetVal omsnmp_sendsnmp(instanceData *pData, uchar *psz)
snmp_add_var(pdu, objid_sysuptime, sizeof(objid_sysuptime) / sizeof(oid), 't', trap);
/* Now set the SyslogMessage Trap OID */
- if ( snmp_add_var(pdu, objid_snmptrap, sizeof(objid_snmptrap) / sizeof(oid), 'o', (char*) pData->szSyslogMessageOID ) != 0)
+ if ( snmp_add_var(pdu, objid_snmptrap, sizeof(objid_snmptrap) / sizeof(oid), 'o', (char*) pData->szSnmpTrapOID ) != 0)
{
strErr = snmp_api_errstring(snmp_errno);
- logerrorVar("omsnmp_sendsnmp: Adding trap OID failed '%s' with error '%s' \n", pData->szSyslogMessageOID, strErr);
+ logerrorVar("omsnmp_sendsnmp: Adding trap OID failed '%s' with error '%s' \n", pData->szSnmpTrapOID, strErr);
ABORT_FINALIZE(RS_RET_DISABLE_ACTION);
}
}
@@ -369,9 +372,16 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
else /* Copy Target */
strncpy( (char*) pData->szEnterpriseOID, (char*) pszEnterpriseOID, strlen((char*) pszEnterpriseOID) );
+ /* Copy SnmpTrap OID */
+ if (pszSnmpTrapOID == NULL) /* Failsave */
+ strncpy( (char*) pData->szSnmpTrapOID, "1.3.6.1.4.1.19406.1.2.1", sizeof("1.3.6.1.4.1.19406.1.2.1") );
+ else /* Copy Target */
+ strncpy( (char*) pData->szSnmpTrapOID, (char*) pszSnmpTrapOID, strlen((char*) pszSnmpTrapOID) );
+
+
/* Copy SyslogMessage OID */
if (pszSyslogMessageOID == NULL) /* Failsave */
- strncpy( (char*) pData->szSyslogMessageOID, "1.3.6.1.4.1.9.9.41.2.0.1", sizeof("1.3.6.1.4.1.9.9.41.2.0.1") );
+ strncpy( (char*) pData->szSyslogMessageOID, "1.3.6.1.4.1.19406.1.1.1", sizeof("1.3.6.1.4.1.19406.1.1.1") );
else /* Copy Target */
strncpy( (char*) pData->szSyslogMessageOID, (char*) pszSyslogMessageOID, strlen((char*) pszSyslogMessageOID) );
@@ -410,6 +420,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
dbgprintf("SNMPVersion (0=v1, 1=v2c): %d\n", pData->iSNMPVersion);
dbgprintf("Community: %s\n", pData->szCommunity);
dbgprintf("EnterpriseOID: %s\n", pData->szEnterpriseOID);
+ dbgprintf("SnmpTrapOID: %s\n", pData->szSnmpTrapOID);
dbgprintf("SyslogMessageOID: %s\n", pData->szSyslogMessageOID);
dbgprintf("TrapType: %d\n", pData->iTrapType);
dbgprintf("SpecificType: %d\n", pData->iSpecificType);
@@ -451,6 +462,10 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
free(pszEnterpriseOID);
pszEnterpriseOID = NULL;
+ if (pszSnmpTrapOID != NULL)
+ free(pszSnmpTrapOID);
+ pszSnmpTrapOID = NULL;
+
if (pszSyslogMessageOID != NULL)
free(pszSyslogMessageOID);
pszSyslogMessageOID = NULL;
@@ -472,6 +487,8 @@ CODESTARTmodExit
free(pszCommunity);
if (pszEnterpriseOID != NULL)
free(pszEnterpriseOID);
+ if (pszSnmpTrapOID != NULL)
+ free(pszSnmpTrapOID);
if (pszSyslogMessageOID != NULL)
free(pszSyslogMessageOID);
ENDmodExit
@@ -494,6 +511,7 @@ CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(regCfSysLineHdlr( (uchar *)"actionsnmpversion", 0, eCmdHdlrInt, NULL, &iSNMPVersion, NULL));
CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionsnmpcommunity", 0, eCmdHdlrGetWord, NULL, &pszCommunity, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionsnmpenterpriseoid", 0, eCmdHdlrGetWord, NULL, &pszEnterpriseOID, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionsnmptrapoid", 0, eCmdHdlrGetWord, NULL, &pszSnmpTrapOID, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionsnmpsyslogmessageoid", 0, eCmdHdlrGetWord, NULL, &pszSyslogMessageOID, STD_LOADABLE_MODULE_ID));
CHKiRet(regCfSysLineHdlr( (uchar *)"actionsnmpspecifictype", 0, eCmdHdlrInt, NULL, &iSpecificType, NULL));
CHKiRet(regCfSysLineHdlr( (uchar *)"actionsnmptraptype", 0, eCmdHdlrInt, NULL, &iTrapType, NULL));