Status Information Cut Off character restriction

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
naranant
Posts: 90
Joined: Tue Oct 24, 2017 10:50 am

Status Information Cut Off character restriction

Post 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
You do not have the required permissions to view the files attached to this post.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Status Information Cut Off character restriction

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
naranant
Posts: 90
Joined: Tue Oct 24, 2017 10:50 am

Re: Status Information Cut Off character restriction

Post 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.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Status Information Cut Off character restriction

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
naranant
Posts: 90
Joined: Tue Oct 24, 2017 10:50 am

Re: Status Information Cut Off character restriction

Post 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%
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Status Information Cut Off character restriction

Post 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%
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
naranant
Posts: 90
Joined: Tue Oct 24, 2017 10:50 am

Re: Status Information Cut Off character restriction

Post 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
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Status Information Cut Off character restriction

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
naranant
Posts: 90
Joined: Tue Oct 24, 2017 10:50 am

Re: Status Information Cut Off character restriction

Post 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
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Status Information Cut Off character restriction

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked