Man Page: bsnmp-regex(5)
bsnmp-regex.conf(5) FreeBSD File Formats Manual bsnmp-regex.conf(5)
NAME
bsnmp-regex.conf -- the configuration file for the bsnmp-regex(8) module.
DESCRIPTION
The bsnmp-regex SNMP module parses logs or other textual output and
exposes the matched values as SNMP counters. The bsnmp-regex.conf config
file contains definitions for the counters you want, and what text to
match to those counters.
Blank lines and lines starting with a '#' sign are ignored.
COUNTERS
Two different kinds of counters are possible. Stat counters increment
their value each time a match is made. Value counters contain the last
matched value.
A counter line constists of a name, a colon and a delimited regular
expression:
name: /match.*/
The name is used as the regexDescr SNMP value.
A stat counter looks like the example above, and simply increments the
regexInteger SNMP value each time a match is made.
A value counter has a second part to it's regular expression, similar to
a 'sed replace':
name: /([0-9]+) degrees/\1/
The backslash-numeral refers to the regular expression group. \0 refers
to the entire matched text. The resulting value is available in the
regexString SNMP value. If the result is parseable as an integer, it is
also available in the regexInteger SNMP value.
OPTIONS
The file can contain options which change the behavior of the counters
below that point. An option line consists of a name, an equals sign, and
the value:
option = value
An option applies to all match lines below that point in the file.
expires This option is the amount of time (in seconds) after which to
expire a counter if no new values have come in. This is
mostly useful for stat counters.
EXAMPLES
Given a maillog output, this would make a counter for the number of mes-
sages relayed:
relayed: /relay.* status=sent/
This would set the counter to the user the last user that logged into the
system over the past hour:
expires = 3600
lastuser: /sshd.* Accepted.* for ([^ ]+) from/\1/
SEE ALSO
bsnmp-regex(8) re_format(7)
AUTHOR
Stef Walter <stef@thewalter.net>
bsnmp-regex April 5, 2006 bsnmp-regex