Page 1 of 1

Monitoring MSSQL&MySQL&Oracle Server AlertLogs in Nagios

Posted: Wed Jul 17, 2019 8:21 am
by dca_admin
Hello Team,

As per customer requirement need to monitor significant database exceptions in the alert logs.

I identified one plugin and started working on it. Please find below link of Logfiles Plugin.

Link: https://labs.consol.de/nagios/check_log ... escription

I have run this plugin in Nagios and getting output is below attached sceenshot.

We have tried our best to work on it. But we are not able to understand how to make success this plugin in nagios. Please help me the process to work on this.

Note: SQL,Mysql,Oracle Server is running on windows server.

Re: Monitoring MSSQL&MySQL&Oracle Server AlertLogs in Nagios

Posted: Wed Jul 17, 2019 1:24 pm
by tgriep
That plugin is a perl script and to get it to run on a Windows System, you would have to install a Windows version of Perl to run it and some sort of agent on the Windows System to run the script.

For perl, you can use this.
http://strawberryperl.com/

And an Windows Agent, you can use the Nagios NCPA agent.
https://www.nagios.org/ncpa/

I did find a German version of some instructions to get the plugin installed on a Windows system.
https://labs.consol.de/nagios/check_log ... index.html

Once you get the check_logfiles to run, you would copy it to the following folder if you are using the NCPA agent.
C:\Program Files (x86)\Nagios\NCPA\plugins

Once the above is done, the following example is a command you would run on the Nagios server for that plugin.
It should check the C:\Files\file.log for the pattern of Error and generate an alert.

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -H xxx.xxx.xxx.xxx -t ncpapassword -M 'plugins/check_log' -a '--logfile=C:\Files\file.log --criticalpattern 'Error'
You would have to adjust the command as necessary for your needs.

See this for alternate ways to check log files.
https://support.nagios.com/kb/article/l ... s-787.html

Re: Monitoring MSSQL&MySQL&Oracle Server AlertLogs in Nagios

Posted: Fri Jul 19, 2019 7:30 am
by dca_admin
Hello tgriep,

Thanks for your response.

we have done the configuration as suggested but after running the script or plugin we are getting below issue attached the screenshots. Please do needful.

Re: Monitoring MSSQL&MySQL&Oracle Server AlertLogs in Nagios

Posted: Fri Jul 19, 2019 9:23 am
by tgriep
You are missing a single quote at the end of the line so add a ' to the end of the argument section.

The -M option is not correct, it needs to be specified like this with the plugins/ directive.

Code: Select all

-M 'plugins/check_logfiles'
Another thing, you have a secret setup with special characters, it needs single quotes as well.

Code: Select all

./check_ncpa.py -H 152.63.3.143 -t '$@to$!ke#ll' -M 'plugins/check_logfiles' -a '--logfile=E:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Log\ERRORLOG --criticalpattern 'Error''
Make sure I typed in everything correctly in the example.

The connection refused error could be a misconfiguration in the ncpa.cfg file on the Windows server.
Check this file

Code: Select all

C:\Program Files (x86)\Nagios\NCPA\etc\ncpa.cfg
Under the [api] section, make sure the following is correct.

Code: Select all

community_string = $@to$!ke#ll
Any changes, restart the ncpa_passive service.
If you still have connection issues, look at this log file.

Code: Select all

C:\Program Files (x86)\Nagios\NCPA\var\log/ncpa_listener.log

Re: Monitoring MSSQL&MySQL&Oracle Server AlertLogs in Nagios

Posted: Wed Jul 31, 2019 1:31 pm
by dca_admin
Hi tgriep,

Thanks for your response.

I have tried as per your suggestions but we are facing one error. Please find attached screenshot.

Re: Monitoring MSSQL&MySQL&Oracle Server AlertLogs in Nagios

Posted: Wed Jul 31, 2019 3:02 pm
by tgriep
The NCPA agent uses port 5693 for connections and not port 443 so make sure that port is allowed through the Windows Firewall.

If you still have issues, check the NCPA agent's log files in the following folder. Especially the ncpa_listener.log file for any errors.

Code: Select all

C:\Program Files (x86)\Nagios\NCPA\var\log