Page 1 of 2
Status Information Cut Off character restriction
Posted: Sun Feb 11, 2018 7:50 pm
by naranant
Hello,
I am looking to increase the status information cut off character restriction to capture full length of the output. I have tried to follow the steps given in the below link but that didn't help.
https://support.nagios.com/kb/article.php?id=478
I am attaching the screenshot of my output. Which captures the error in the log file.
As you could see the message it shows the 3 errors but only able to show the output of the last line in the log. I need to expand the output to reflect all the errors in the file
Re: Status Information Cut Off character restriction
Posted: Mon Feb 12, 2018 1:32 pm
by cdienger
What version of XI is this? I just tested on a 5.4.12 machine without issue. Please run the following to verify the tables were altered:
Code: Select all
echo "use nagios;show column from nagios_servicestatus;" | mysql -pnagiosxi
echo "use nagios;show column from nagios_hoststatus;" | mysql -pnagiosxi
echo "use nagios;show column from nagios_servicechecks;" | mysql -pnagiosxi
echo "use nagios;show column from nagios_hostchecks;" | mysql -pnagiosxi
Re: Status Information Cut Off character restriction
Posted: Tue Feb 13, 2018 10:49 am
by naranant
Hello,
I am using the Nagios XI Version: 5.4.10. The commands are running successfully but the status information doesnt capture all the errors it is able to show me only the last line from the log.
Re: Status Information Cut Off character restriction
Posted: Tue Feb 13, 2018 12:18 pm
by cdienger
$SERVICEOUTPUT$ will only show the first line while
$LONGSERVICEOUTPUT$ will show the full output(
https://assets.nagios.com/downloads/nag ... viceoutput). You can change which macro is used by editing the user's notification message.
https://assets.nagios.com/downloads/nag ... viceoutput
https://assets.nagios.com/downloads/nag ... iables.pdf
Re: Status Information Cut Off character restriction
Posted: Tue Feb 13, 2018 3:21 pm
by naranant
Thank you I tried to update the notification messages to %longserviceoutput% in the notification but the output result is not coming. how to check if the longserviceoutput macro is available in the nagios system.
***** Nagios XI Alert *****
%alertsummary%
Notification Type: %type%
Service: %service%
Host: %host%
Address: %hostaddress%
State: %servicestate%
Info:
%serviceoutput%
Date/Time: %datetime%
Respond: %responseurl%
Nagios URL: %xiserverurl%
Re: Status Information Cut Off character restriction
Posted: Tue Feb 13, 2018 3:33 pm
by cdienger
Find the
xi_service_event_handler under Configure > Commands > _Commands. It should look something like:
Code: Select all
/usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_event.php --handler-type=service --host="$HOSTNAME$" --service="$SERVICEDESC$" --hostaddress="$HOSTADDRESS$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTATEID$ --hosteventid=$HOSTEVENTID$ --hostproblemid=$HOSTPROBLEMID$ --servicestate=$SERVICESTATE$ --servicestateid=$SERVICESTATEID$ --lastservicestate=$LASTSERVICESTATE$ --lastservicestateid=$LASTSERVICESTATEID$ --servicestatetype=$SERVICESTATETYPE$ --currentattempt=$SERVICEATTEMPT$ --maxattempts=$MAXSERVICEATTEMPTS$ --serviceeventid=$SERVICEEVENTID$ --serviceproblemid=$SERVICEPROBLEMID$ --serviceoutput="$SERVICEOUTPUT$" --longserviceoutput="$LONGSERVICEOUTPUT$" --servicedowntime=$SERVICEDOWNTIME$
note the "--longserviceoutput="$LONGSERVICEOUTPUT$". This should make the variable available for use in notifications like:
Code: Select all
***** Nagios XI Alert *****
%alertsummary%
Notification Type: %type%
Service: %service%
Host: %host%
Address: %hostaddress%
State: %servicestate%
Info: %longserviceoutput%
Date/Time: %datetime%
Respond: %responseurl%
Nagios URL: %xiserverurl%
Re: Status Information Cut Off character restriction
Posted: Tue Feb 13, 2018 4:04 pm
by naranant
thank you i see that information is already available in the xi service handler but still the result is not coming when i put the longserviceoutput.
Please advise.
Regards,
Narayana
Re: Status Information Cut Off character restriction
Posted: Tue Feb 13, 2018 4:27 pm
by cdienger
Try this instead:
Code: Select all
***** Nagios XI Alert *****
%alertsummary%
Notification Type: %type%
Service: %service%
Host: %host%
Address: %hostaddress%
State: %servicestate%
Info: %serviceoutput%
%longserviceoutput%
Date/Time: %datetime%
Respond: %responseurl%
Nagios URL: %xiserverurl%
The problem with the previous template was that %serviceoutput% prints the first line and %longserviceoutput% actually prints the remaining lines. To get the full message you can use both macros.
If that doesn't work, make sure you're editing the template for the user receiving these alerts. Do this by logging in as that user, clicking their name in the top right corner and going to Notification Options > Notification Messages. OR you can deploy the changes as an admin by going to Admin > Users > Notification Management. Make sure that if you make changes here that you select the proper options on all tabs(Email/Mobile Text/Notification Preferences/Timeperiods) and deploy to just the users you want them to apply to.
Re: Status Information Cut Off character restriction
Posted: Tue Feb 13, 2018 4:37 pm
by naranant
Tried that option also still couldnt get the complete output.
I am making this changes after logging to the user ID and applying this changes in Notification Options > Notification Messages
Re: Status Information Cut Off character restriction
Posted: Tue Feb 13, 2018 5:54 pm
by cdienger
It looks like this may be due to the check_logfiles option do only send the last matched line by default. Running it with the "
--report=long" option will return all matched lines. See
https://labs.consol.de/nagios/check_logfiles/index.html for details.