Need plugin for check on log-file
Need plugin for check on log-file
Hello,
I am trying to get a nagios plugin working for searching a word (SUCCESS) in a logfile.
I have downloaded the pluging check_log. I don't understand how to get it working.
check_logfile v1.0.0 (nagios-plugins 2.0.3)
Usage:
check_logfile [options] <regexp>[ <regexp>[ <regexp[ ...]]]
Options:
-f, --file <FILE> Logfile to search
-x, --exitcode <CODE> Code to exit with if match successful
-i, --invert Invert match expression (found == fail, not found = success)
-s, --start-at <LINE> Line number to start looking from
-v, --verbose Verbose output
-V, --version Show version and exit
-h, --help Show usage information and exit
Log file pattern detector plugin for Nagios
-bash-4.2# ./check_logfile -f /tmp/testlog -i -s 1 grep SUCCESS
0 matches found from 0 expression(s)
- no matches found for expression 'grep'
- no matches found for expression 'SUCCESS'
-bash-4.2# ./check_logfile -f /tmp/testlog -i -s 1 "Finished: SUCCESS"
0 matches found from 0 expression(s)
- no matches found for expression 'Finished: SUCCESS'
-bash-4.2# ./check_logfile -f /tmp/testlog -i -s 1 /Finished: SUCCESS/
0 matches found from 0 expression(s)
- no matches found for expression '/Finished:'
- no matches found for expression 'SUCCESS/'
I am not familiar with the regex... I must be doing something wrong..
Any help would be nice.
Regards, Paul.
I am trying to get a nagios plugin working for searching a word (SUCCESS) in a logfile.
I have downloaded the pluging check_log. I don't understand how to get it working.
check_logfile v1.0.0 (nagios-plugins 2.0.3)
Usage:
check_logfile [options] <regexp>[ <regexp>[ <regexp[ ...]]]
Options:
-f, --file <FILE> Logfile to search
-x, --exitcode <CODE> Code to exit with if match successful
-i, --invert Invert match expression (found == fail, not found = success)
-s, --start-at <LINE> Line number to start looking from
-v, --verbose Verbose output
-V, --version Show version and exit
-h, --help Show usage information and exit
Log file pattern detector plugin for Nagios
-bash-4.2# ./check_logfile -f /tmp/testlog -i -s 1 grep SUCCESS
0 matches found from 0 expression(s)
- no matches found for expression 'grep'
- no matches found for expression 'SUCCESS'
-bash-4.2# ./check_logfile -f /tmp/testlog -i -s 1 "Finished: SUCCESS"
0 matches found from 0 expression(s)
- no matches found for expression 'Finished: SUCCESS'
-bash-4.2# ./check_logfile -f /tmp/testlog -i -s 1 /Finished: SUCCESS/
0 matches found from 0 expression(s)
- no matches found for expression '/Finished:'
- no matches found for expression 'SUCCESS/'
I am not familiar with the regex... I must be doing something wrong..
Any help would be nice.
Regards, Paul.
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Need plugin for check on log-file
Where did you get this plugin?
Re: Need plugin for check on log-file
scottwilkerson wrote:Where did you get this plugin?
https://labs.consol.de/nagios/check_log ... escription
Re: Need plugin for check on log-file
But if you know another one.... What i need: to check several directory's, into some logs, checking a keyword like failure.welbp00 wrote:scottwilkerson wrote:Where did you get this plugin?
https://labs.consol.de/nagios/check_log ... escription
That should give a warning
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Need plugin for check on log-file
I'm confused because there version on that site is check_logfiles-3.11.0.2 and you showed a version of 1.0.0
also the command line arguments on the page are way different than what you showed
Are you sure that's where you downloaded it from? Can you upload the plugin you have to the forum?
also the command line arguments on the page are way different than what you showed
Code: Select all
--tag=<identifier> A short unique descriptor for this search. It will appear in the output of the plugin and is used to separare the different services.
--logfile=<filenname> This is the name of the log file you want to scan.
--rotation=<method> This is the method how log files are rotated.
--criticalpattern=<regexp> A regular expression which will trigger a critical error.
--warningpattern=<regexp> The same…a match results in a warning.
--criticalexception=<regexp> / –warningexception=<regexp> Exceptions which are not counted as errors.
--okpattern=<regexp> A pattern which resets the error counters.
--noprotocol Normally all the matched lines are written into a protocol file with this file’s name appearing in the plugin’s output. This option switches this off.
--syslogserver With this option you limit the pattern matching to lines originating from the host check_logfiles is running on.
--syslogclient=<clientname> With this option you limit the pattern matching to lines originating from the host named in this option.
--sticky[=<lifetime>] Errors are propagated through successive runs.
--unstick Resets sticky errors.
--config The name of a configuration file. The syntax of this file is described in the next section.
--configdir The name of a configuration directory. Configfiles ending in .cfg or .conf are (recursively) imported.
--searches=<tag1,tag2,…> A list of tags of those searches which are to be run. Using this parameter, not all searches listed in the config file are run, but only those selected. (–selectedsearches is also possible)
--report=[short|long|html]This option turns on multiline output (Default: off). The setting html generates a table which display the last hits in the service details view.
--maxlength=[length] With this parameter long lines are truncated (Default: off). Some programs (e.g. TrueScan) generate entries in the eventlog of such a length, that the output of the plugin becomes longer than 1024 characters. NSClient++ discards these.
--winwarncrit With this parameter messages in the eventlog are classified by the type WARNING/ERROR (Default: off). Replaces or complements warning/criticalpattern.
--rununique This parameter prevents check_logfiles from starting when there’s already another instance using the same config file. (exits with UNKNOWN)
--timeout=<seconds>. This parameter causes an abort of a running search after a defined number of seconds. It is an aborted in a controlled manner, so that the lines which have been read so far, are used for the computation of the final result.
--warning=<Number>. Complex handler-scripts can be provided with a warning-parameter (of course –critical is possible, too) this way. Inside the scripts the value is accessible as the macro CL_WARNING (resp. CL_CRITICAL).
Re: Need plugin for check on log-file
Sorry, the first item i posted is different from the last one....
This is the one i am working with: https://labs.consol.de/nagios/check_log ... escription
I will upload the plugin.
This is the one i am working with: https://labs.consol.de/nagios/check_log ... escription
I will upload the plugin.
Re: Need plugin for check on log-file
Herby the plugin
- Attachments
-
- check_logfiles.txt
- added the .txt, otherwise no upload possible..
- (206.81 KiB) Downloaded 250 times
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Need plugin for check on log-file
So this file returns completely different output than the plugin you posted above, where you posted:
https://labs.consol.de/nagios/check_log ... escription
Did you try using the arguments as outlined here?welbp00 wrote:check_logfile v1.0.0 (nagios-plugins 2.0.3)
Usage:
check_logfile [options] <regexp>[ <regexp>[ <regexp[ ...]]]
Options:
-f, --file <FILE> Logfile to search
-x, --exitcode <CODE> Code to exit with if match successful
-i, --invert Invert match expression (found == fail, not found = success)
-s, --start-at <LINE> Line number to start looking from
-v, --verbose Verbose output
-V, --version Show version and exit
-h, --help Show usage information and exit
Log file pattern detector plugin for Nagios
-bash-4.2# ./check_logfile -f /tmp/testlog -i -s 1 grep SUCCESS
0 matches found from 0 expression(s)
- no matches found for expression 'grep'
- no matches found for expression 'SUCCESS'
-bash-4.2# ./check_logfile -f /tmp/testlog -i -s 1 "Finished: SUCCESS"
0 matches found from 0 expression(s)
- no matches found for expression 'Finished: SUCCESS'
-bash-4.2# ./check_logfile -f /tmp/testlog -i -s 1 /Finished: SUCCESS/
0 matches found from 0 expression(s)
- no matches found for expression '/Finished:'
- no matches found for expression 'SUCCESS/'
https://labs.consol.de/nagios/check_log ... escription
Re: Need plugin for check on log-file
I get this:
-bash-4.2# ./check_logfiles -logfile=/tmp/testlog -criticalpattern 'FAILURE'
OK - no errors or warnings|'default_lines'=0 'default_warnings'=0 'default_criticals'=0 'default_unknowns'=0
cat /tmp/testlog
PLAY RECAP *********************************************************************
pr7p0173.prod.server.nl : ok=4 changed=1 unreachable=0 failed=0
Finished: FAILURE
-bash-4.2# ./check_logfiles -logfile=/tmp/testlog -criticalpattern 'FAILURE'
OK - no errors or warnings|'default_lines'=0 'default_warnings'=0 'default_criticals'=0 'default_unknowns'=0
cat /tmp/testlog
PLAY RECAP *********************************************************************
pr7p0173.prod.server.nl : ok=4 changed=1 unreachable=0 failed=0
Finished: FAILURE
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Need plugin for check on log-file
Looks like you are missing a - on each argument
Code: Select all
./check_logfiles --logfile=/tmp/testlog --criticalpattern 'FAILURE'