File tree Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,13 @@ Checks logfiles or any other text format file for errors or other general patter
1818
1919## Examples
2020
21+ ### Default Check
22+
23+ Alert if there are errors in the snclient log file:
24+
25+ check_files files=/var/log/snclient/snclient.log 'warn=line like Warn' 'crit=line like Error'"
26+ OK - All 1787 / 1787 Lines OK
27+
2128### Example using NRPE and Naemon
2229
2330Naemon Config
@@ -31,7 +38,7 @@ Naemon Config
3138 host_name testhost
3239 service_description check_logfile
3340 use generic-service
34- check_command check_nrpe!check_logfile!
41+ check_command check_nrpe!check_logfile!'files=/var/log/snclient/snclient.log' 'warn=line like Warn'
3542 }
3643
3744## Argument Defaults
Original file line number Diff line number Diff line change @@ -72,8 +72,12 @@ func (c *CheckLogFile) Build() *CheckData {
7272 {name : "columnN" , description : "Match the content of the N-th column only if enough columns exists" },
7373 },
7474 exampleDefault : `
75- ` ,
76- exampleArgs : `` ,
75+ Alert if there are errors in the snclient log file:
76+
77+ check_files files=/var/log/snclient/snclient.log 'warn=line like Warn' 'crit=line like Error'"
78+ OK - All 1787 / 1787 Lines OK
79+ ` ,
80+ exampleArgs : `'files=/var/log/snclient/snclient.log' 'warn=line like Warn'` ,
7781 }
7882}
7983
Original file line number Diff line number Diff line change @@ -297,17 +297,17 @@ func (cd *CheckData) buildListMacros() map[string]string {
297297
298298 // if there is only one problem, there is no need to add brackets
299299 if len (critList ) > 0 {
300- result ["crit_list" ] = "critical(" + strings .Join (critList , ", " ) + ")"
300+ result ["crit_list" ] = "critical(" + strings .Join (critList , cd . listCombine ) + ")"
301301 problemList = append (problemList , result ["crit_list" ])
302302 detailList = append (detailList , result ["crit_list" ])
303303 }
304304 if len (warnList ) > 0 {
305- result ["warn_list" ] = "warning(" + strings .Join (warnList , ", " ) + ")"
305+ result ["warn_list" ] = "warning(" + strings .Join (warnList , cd . listCombine ) + ")"
306306 problemList = append (problemList , result ["warn_list" ])
307307 detailList = append (detailList , result ["warn_list" ])
308308 }
309309 if len (okList ) > 0 {
310- result ["ok_list" ] = strings .Join (okList , ", " )
310+ result ["ok_list" ] = strings .Join (okList , cd . listCombine )
311311 detailList = append (detailList , result ["ok_list" ])
312312 }
313313
You can’t perform that action at this time.
0 commit comments