Man Page: bsnmp-regex(8)
bsnmp-regex(8) FreeBSD System Manager's Manual bsnmp-regex(8)
NAME
bsnmp-regex -- an SNMP module which produces counters from logs or other
text
DESCRIPTION
bsnmp-regex is a module for bsnmpd(1) which allows you to make SNMP coun-
ters from log files or other text. For example you could count the number
of occurances of a certain string in a text file. You can also match spe-
cific numbers or text to build SNMP values.
bsnmp-regex has a configuration file which contains regular expressions
for the text you'd like to match. See bsnmp-regex.conf(5) for details on
this file.
bsnmp-regex opens a UNIX domain socket which text is piped into. The text
is matched line by line against the regular expressions in the configura-
tion file and the appropriate counter or value is updated. The sockin(1)
utility is useful for piping text into this socket.
MIBS
The counters will be available as a table under the following MIB:
.1.3.6.1.4.1.12325.1.203
Or if the appropriate MIB.txt files have been installed:
enterprises.fokus.begemot.regexData
The following SNMP MIBs are available for use (where X is the counter
index):
regexData.regexCount.0
The number of counters available.
regexData.regexEntry.regexIndex.X
The index of the counter.
regexData.regexEntry.regexDescr.X
The description of the counter.
regexData.regexEntry.regexLast.X
How long ago the counter was last updated.
regexData.regexEntry.regexInteger.X
The current counter value as a integer.
regexData.regexEntry.regexString.X
The current counter value as a string.
OPTIONS
To activate the bsnmp-regex module you must load the module in
/etc/snmpd.config and configure the location for the UNIX socket and
bsnmp-regex.conf(5) file. See the examples section below.
regexConfig
The location of the bsnmp-regex.conf(5) file. This option
must be specified.
regexSocket
The location of the UNIX socket on which this module will
listen for logs or text to match.
EXAMPLES
For a simple bsnmp-regex configuration add the following to
/etc/snmpd.config:
begemotSnmpdModulePath."regex" = "/usr/local/lib/snmp_regex.so"
%regex
regexConfig = "/usr/local/etc/bsnmp-regex.conf"
regexSocket = "/var/run/bsnmp-regex.sock"
For details on what /usr/local/etc/bsnmp-regex.conf should contain, see
the bsnmp-regex.conf(5) man page.
To pipe logs or text to match into the socket use the sockin(1) utility,
run something like this:
# sockin /var/run/bsnmp-regex.sock tail -f /var/log/maillog
To have syslogd(8) send all logs for matching add a line like this to the
/etc/syslog.conf file:
*.* | sockin /var/run/bsnmp-regex.sock
SEE ALSO
bsnmp-regex.conf(5), bsnmpd(1), sockin(1), syslog.conf(5)
AUTHOR
Stef Walter <stef@thewalter.nethewalter.net>>
bsnmp-regex April 5, 2006 bsnmp-regex