mdlogd (1M)
Table of Contents

NAME

mdlogd, mdlogd.cf - Solstice DiskSuite SNMP support

SYNOPSIS

mdlogd
mdlogd.cf

AVAILABILITY

/usr/opt/SUNWmd/sbin/mdlogd
/etc/opt/SUNWmd/mdlogd.cf

DESCRIPTION

mdlogd implements a simple daemon that watches the system console looking for messages written by the DiskSuite device driver (md). When a DiskSuite message is detected the daemon will send a generic SNMP trap.

/etc/opt/SUNWmd/mdlogd.cf is used to control the daemon's behavior.

It is an ASCII file with the basic form:

ENTERPRISE = <enterprise-id>
OBJECTID = <object-id>

<reg-exp> <trap-destination> <generic trap #> <specific trap #> [ ... ]

<enterprise-id> and <object-id> are required and must be specified. They are used by all traps generated by the daemon.

<enterprise-id> is the SNMP identifier for the enterprise to which the system running the daemon belongs. For example, the Sun Microsystems enterprise ID is: 1.3.6.1.4.1.42.

<object-id> is the SNMP identifier of the system running the daemon. For example, the object-id of a host within the Sun enterprise might be: 1.3.6.1.4.1.42.10.

The remainder of the file consists of tuples which describe a regular expression and the specific SNMP trap to be generated when a matching message is written to the system console.

Each tuple has four fields:

<regular expression>
specifies a regular expression to be matched.
<trap destination>
specifies the destination for the SNMP trap, given in the following form: "hostname:port-number:protocol"

<generic trap #>
specifies the SNMP generic trap number, ranging from 0 to 6. These numbers have pre-defined meanings:

0 - cold-start
1 - warm-start
2 - link-down
3 - link-up
4 - authentication
5 - EGP Neighbor Lost
6 - enterprise specific trap

Traps of type 6 include an additional enterprise specific trap number.

<specific trap #>
specifies an arbitrary number. Interpretation of this number is enterprise specific.

EXAMPLE

#
#ident "@(#)mdlogd.cf 1.1 96/02/15"
#
#
# DiskSuite SNMP Trap configuration file.
# # This file specifies the SNMP trap data to be sent when a
# notable condition related to the DiskSuite driver (md)
# is detected.

# The conditions are based on the event logging which the
# driver does using the cmn_err() interface. The events
# have different severity levels: NOTICE, WARNING and PANIC.
# They appear on the console and look like this:
#
# unix: WARNING: md: d81: write error on /dev/md/dsk/d5
# unix: WARNING: md: d81: /dev/md/dsk/d5 needs maintenance
# unix: NOTICE: md: d81: hotspared device /dev/md/dsk/d5 with /dev/md/dsk/d2
#
# Using this configuration file, a different SNMP trap may
# be associated with each level. See mdlogd.cf for a
# brief summary of the generic SNMP traps and their meanings.
#
# Generic trap variables:
#
# ENTERPRISE: the enterprise to which the system belongs
# OBJECTID:the id of the system
ENTERPRISE = 1.3.6.1.4.1.42
OBJECTID = 1.3.6.1.4.1.860
#
# SubString Trap Destination SNMP Trap # Specific Trap #
# xxxxx (host:port:protocol) 0 < n <= 6 0 < n
"NOTICE: md:" "spin:162:udp" 6 1
"WARNING: md:" "spin:162:udp"6 2

Given this configuration file and an error written to /dev/console on host spin which looks like:

WARNING: md: d6: /dev/dsk/c3t3d0s7 needs maintenance

an SNMP trap will be dispatched.

If this trap were received by SunNetManager, it would look like:

Wed Feb 21 15:40:41 1996 [ spin ] : Trap:

sequence=2
receive-time=Wed Feb 21 15:40:41 1996 version=0
community=public
enterprise=Sun Microsystems
source-time=00:00:00.00
trap-type=enterprise specific trap: 2

1.3.6.1.4.1.860 = Feb 21 15:40:41 1996 spin WARNING: md: d6: /dev/dsk/c3t3d0s7 needs maintenance

NOTES

The supported regular expressions (RE) are constructed as follows:

1.1 Any character that is not a special character (to be defined) matches itself.

1.2 A backslash (\) followed by a special character matches the literal character itself (i.e., this `escapes' the special character).

1.3 The `special' characters are: + * ? . [ ] ^ $

1.4 The period (.) matches any character except the newline. E.g., `.umpty' matches either `Humpty' or `Dumpty'.

1.5 A set of characters enclosed in brackets ([]) is a one-character RE that matches any of the characters in that set. E.g., `[akm]' matches either an `a', `k' or `m'. A range of characters can be indicated with a dash. E.g., `[a-z]' matches any lower-case letter. However, if the first character of the set is the caret (^), the the RE matches any character except those in the set. It does not match the empty string. Example: [^akm] matches any character except `a', `k' or `m'. The caret loses its special meaning if it is not the first character of the set.

The following rules can be used to build a multicharacter RE:

2.1 A one-character RE followed by an asterisk (*) matches zero or more occurences of the RE. Hence, [a-z]* matches zero or more lower-case characters.

2.2 A one-character RE followed by a plus (+) matches one or more occurences of the RE. Hence, [a-z]+ matches one or more lower-case characters.

2.3 A question mark (?) is an optional element. The preceeding RE can occur zero or once in the string -- no more. E.g., xy?z matches either xyz or xz.

2.4 The concatenation of REs is an RE that matches the corresponding concatenation of strings. E.g., [A-Z][a-z]* matches any capitalized word.

Finally, the entire regular expression can be anchored to match only the beginning or end of a line:

3.1 If the caret (^) is at the beginning of the RE, then the matched string must be at the beginning of a line.

3.2 If the dollar sign ($) is at the end of the RE, then the matched string must be at the end of the line.

The following escape codes can be used to match control characters:

\b
backspace
\e
ESC (escape)
\f
formfeed
\n
newline
\r
carriage return
\t
tab \xddd the literal hex number 0xddd
\^C
Control Code. E.g., \^D is `control-d'

SEE ALSO

Solstice DiskSuite User's Guide, Solstice DiskSuite Reference