Page 1 of 2
How to show multi-line of output using check_logfiles
Posted: Mon Feb 11, 2013 4:23 am
by prabakaran
Hi all,
I used check_logfiles for Windows log files monitoring using "NSCliet++". Plug-in can identifies the no of errors on particular time, but it shows on UI (or EMail) with minimal results like below, here it shows 4 errors, 4 warnings but in mail it sent only one ERROR detail
CRITICAL - (4 errors, 4 warnings) - 8319: 20130204-001141-663: [401] (E:Utility) ERROR: Exception.cr/4280-aee3 /Error_DuplicateName/violation of unique constraint/ at System.Environment.StackTrace(Exception e, Boolean needFileInfo) ...
$seekfilesdir='.'; $MACROS = { LOGPATH => 'C:/xxxxxxx/yyyyyy/' }; $options = 'report=long'; @searches = ({ tag => 'Test', type => 'rotating::uniform', logfile => '$LOGPATH$20121104-040845-389-TestFile.txt', rotation => '.TestFile.', criticalpatterns => ['.ERROR:.'], warningpatterns => ['.WARNING:.'],
options => 'noprotocol,nologfilenocry' });
I tried with maxlength=4096 in 'options' also, but it doesn't resolve. How can i get whole errors and warning details in Mail alert and UI? Please help me to solve this.
Thanks
Re: How to show multi-line of output using check_logfiles
Posted: Mon Feb 11, 2013 12:07 pm
by slansing
For notifications you should be able to add in the following macro in the notification configuration to see additional output from the checks.
Next to $SERVICEOUTPUT$ place $LONGSERVICEOUTPUT$.
Code: Select all
$SERVICEOUTPUT$ $LONGSERVICEOUTPUT$
Re: How to show multi-line of output using check_logfiles
Posted: Wed Feb 13, 2013 7:16 am
by prabakaran
Slansing,thanks for your quick reply. Its really helps to me. But I required little more, Following is my email notification from Nagios
Additional Info: $SERVICEOUTPUT$
WARNING - (21 warnings) - 69085: 20130213-013933-805: [200] (W:CommonApiService) WARNING: RestApiHelper.RequestFilter: user is not in role ...
Trace Info: $LONGSERVICEOUTPUT$
tag apiservice WARNING
68799: 20130213-013735-696: [206] (W:CommonApiService) WARNING: RestApiHelper.RequestFilter: user is not in role
68811: 20130213-013741-795: [206] (W:CommonApiService) WARNING: RestApiHelper.RequestFilter: user is not in role
68823: 20130213-013746-366: [226] (W:CommonApiService) WARNING: RestApiHelper.RequestFilter: user is not in role
68835: 20130213-013751-467: [209] (W:CommonApiService) WARNING: RestApiHelper.RequestFilter: user is not in role
68847: 20130213-013756-709: [152] (W:CommonApiService) WARNING: RestApiHelper.RequestFilter: user is not in role
68869: 20130213-013801-577: [226] (W:CommonApiService) WARNING: RestApiHelper.RequestFilter: user is not in role
68881: 20130213-013806-757: [227]
Actual warnings are 21, but i got 6 only. Compare to $SERVICEOUTPUT$ this one is fine, but can I get complete (i.e. 21 warnings) service output ?
Thanks
Re: How to show multi-line of output using check_logfiles
Posted: Wed Feb 13, 2013 11:28 am
by slansing
Is that how the check result is formatted for you in your actual email? It looks like it is returning an additional line but there is nothing on it:
68881: 20130213-013806-757: [227]
If you switch the notification definition from $SERVICEOUTPUT$$LONGSERVICEOUTPUT$
To $LONGSERVICEOUTPUT$ only, do you see everything after what you normally see?
Re: How to show multi-line of output using check_logfiles
Posted: Wed Feb 20, 2013 7:26 am
by prabakaran
Hi, after configured as you mentioned "$SERVICEOUTPUT$$LONGSERVICEOUTPUT$" i got below output,
Testing Info:
WARNING - (13 warnings) - 67659: 20130220-024112-124: [009] (W:CommonApiService) WARNING: RestApiHelper.RequestFilter: user is not in role ...tag apiservice WARNING
67281: 20130220-023916-778: [024] (W:CommonApiService) WARNING: RestApiHelper.RequestFilter: user is not in role
67293: 20130220-023923-954: [022] (W:CommonApiService) WARNING: RestApiHelper.RequestFilter: user is not in role
67315: 20130220-023953-251: [009] (W:CommonApiService) WARNING: RestApiHelper.RequestFilter: user is not in role
67327: 20130220-024003-188: [015] (W:CommonApiService) WARNING: RestApiHelper.RequestFilter: user is not in role
67339: 20130220-024010-660: [012] (W:CommonApiService) WARNING: RestApiHelper.RequestFilter: user is not in role
67351: 20130220-024020-566: [013] (W:CommonApiService) WARNING: RestApiHelper.RequestFilter: user is not in role
67363: 20130220-024028-491: [015]
But my log file returning more lines,
...
67363: 20130220-024028-491: [015] (W:CommonApiService) WARNING: RestApiHelper.RequestFilter: user is not in role
67375: 20130220-024034-918: [008] (W:CommonApiService) WARNING: RestApiHelper.RequestFilter: user is not in role
67387: 20130220-024042-063: [020] (W:CommonApiService) WARNING: RestApiHelper.RequestFilter: user is not in role
... etc.,
How can I resolve it ?
Thanks
Re: How to show multi-line of output using check_logfiles
Posted: Wed Feb 20, 2013 2:40 pm
by slansing
Can you show us an example of what you see on the service details page in your Nagios web UI? A copy and paste of the output with a screenshot would be great.
Re: How to show multi-line of output using check_logfiles
Posted: Sat Mar 16, 2013 9:07 am
by prabakaran
Hi,
I attached the output screenshot of error trace service. This is not same which I mentioned before, but similar to that. In here it shows 4 ERRORS , but I can view only two of them. These two error details only sent as a EMail alert. I want to send mail with complete error trace, How can I get complete error details ?
Thanks
Re: How to show multi-line of output using check_logfiles
Posted: Mon Mar 18, 2013 2:09 pm
by slansing
What does the check output when you run it from the Nagios command line? Use the same command as is shown in the email notification, and let us know what the output is, thanks!
Re: How to show multi-line of output using check_logfiles
Posted: Thu Nov 06, 2014 2:16 pm
by nshah11
Hi,
I am having the same issue. Was this one resolved?
I tried the $SERVICEOUTPUT$ $LONGSERVICEOUTPUT$ but I am still not receiving all the errors in the email.
Thanks
Re: How to show multi-line of output using check_logfiles
Posted: Thu Nov 06, 2014 2:18 pm
by tmcdonald
This topic is quite old and many things have changed since then. What version are you on now?