Check_logfile via nrpe

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
zkarman
Posts: 11
Joined: Wed Oct 15, 2014 6:26 am

Check_logfile via nrpe

Post by zkarman »

Hi All,

Could you please help for me how can I monitor the following?

- needs to monitor the one of the log file
- contains specific string
- via nrpe
- should be warning if finding count > x and critical should be if count >y

I've tried use this command but the result is not shows any warning or critical state:
Command: /usr/local/nagios/libexec/check_nrpe -H xxx.xxx.xxx.xxx -c check_logfile -a file='c:\temp\test.log' "warn=column1 LIKE 'error'" "detail-syntax=${column1}" "warn=count > 2"

The test file looks like:

"1
2
3
error
4
5
6
error"

The command needs to use the nrpe!

Regards, Zsolt
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Check_logfile via nrpe

Post by lmiltchev »

Can you show us how "check_logfile" is defined in the "nsclient.ini"?
Be sure to check out our Knowledgebase for helpful articles and solutions!
zkarman
Posts: 11
Joined: Wed Oct 15, 2014 6:26 am

Re: Check_logfile via nrpe

Post by zkarman »

Hi,

This is my ini file:

# If you want to fill this file with all avalible options run the following command:
# nscp settings --generate --add-defaults --load-all
# If you want to activate a module and bring in all its options use:
# nscp settings --activate-module <MODULE NAME> --add-defaults
# For details run: nscp settings --help
[/modules]
CheckDisk = 1
CheckEventLog = 1
CheckExternalScripts = 1
CheckHelpers = 1
CheckNSCP = 0
CheckLogFile = 1
CheckSystem = 1
CheckWMI = 1
NRPEServer = 1
NRPEClient = 0
[/settings/default]
allowed hosts = 127.0.0.1,10.31.1.45
;modern commands=1
[/settings/NRPE/server]
allow arguments = true
allow nasty characters = true
port = 5666
use ssl = true
[/settings/log]
; DATEMASK - The size of the buffer to use when getting messages this affects the speed and maximum size of messages you can recieve.
date format = %Y-%m-%d %H:%M:%S
; FILENAME - The file to write log data to. Set this to none to disable log to file.
file name = ${exe-path}/nsclient.log
; LOG LEVEL - Log level to use. Available levels are error,warning,info,debug,trace
level = debug
[/settings/external scripts]
allow arguments=true
allow_nasty_meta_chars=1
allow nasty characters=true
[/settings/external scripts/alias]
alias_process_virtual = check_process "process=$ARG1$" "warn=virtual > $ARG2$" "crit=virtual > $ARG3$"
[/settings/external scripts/scripts]
check_log_monitor=cscript.exe //NoLogo scripts\\lib\\wrapper.vbs Log_Monitor.vbs

Rgs, Zsolt
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Check_logfile via nrpe

Post by sreinhardt »

What does your output from the command look like?
Are you able to execute this correctly from the windows cmd using a command like:
cscript.exe check_logfile -a file='c:\temp\test.log' "warn=column1 LIKE 'error'" "detail-syntax=${column1}" "warn=count > 2"
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked