Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
bsnmp-regex.conf(5)	  FreeBSD File Formats Manual	   bsnmp-regex.conf(5)

     bsnmp-regex.conf -- the configuration file	for the	bsnmp-regex(8) module.

     The bsnmp-regex SNMP module parses	logs or	other textual output and ex-
     poses 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.

     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 ex-

	   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.

     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.

     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 last user that logged into the system
     over the past hour:

	   expires = 3600
	   lastuser: /sshd.* Accepted.*	for ([^	]+) from/\1/

     bsnmp-regex(8) re_format(7)

     Stef Walter <>

bsnmp-regex			 July 31, 2021			   bsnmp-regex


Want to link to this manual page? Use this URL:

home | help