Page 1 of 1

Service Check Output - Not displaying all lines of output

Posted: Fri Nov 22, 2019 6:06 pm
by scomdco
In Nagios XI, the output message field/box(?) will not display all the output of the check's script that ran. This was not an issue in Nagios Core and it'd be great to know if there is a way to modify how much text that box will display.

I have to redact most of the info, but hopefully you can see in this picture how the message is cut off within the second line. Each line is using a break code, and realistically there is 4 lines that should be displaying.
Annotation 2019-11-22 144346.png
Also, and i'll create a seperate thread if needed. The email alerts we receive are not acknowledging any html code we have. Within Nagios XI it's acknowledging the code successfully as shown in the above screenshots. It'd be great to know if there is a way for emails to acknowledge the html code as well, especially if the output message field/box within XI can't be modified.

Re: Service Check Output - Not displaying all lines of outpu

Posted: Mon Nov 25, 2019 10:55 am
by scottwilkerson
Can you show the results of the following run from the CLI

Code: Select all

echo "desc nagios_servicestatus;"|mysql -pnagiosxi nagios|grep output
The commands end with -pnagiosxi where nagiosxi is the default password. If you have changed your database password you'll need to change the command to reflect this.

Re: Service Check Output - Not displaying all lines of outpu

Posted: Mon Nov 25, 2019 2:23 pm
by scomdco
Sure thing, here you go:

Code: Select all


output  varchar(255)    NO
long_output     text    NO              NULL


Re: Service Check Output - Not displaying all lines of outpu

Posted: Mon Nov 25, 2019 2:56 pm
by scottwilkerson
I think you are getting cut-off ate the 255 chars

Run the following on the server and it should increase the size of the output fields

Code: Select all

echo "use nagios;alter table nagios_servicestatus modify output varchar(65535) not null;alter table nagios_servicestatus modify long_output TEXT not null;alter table nagios_servicestatus modify perfdata TEXT not null;" | mysql -pnagiosxi

echo "use nagios;alter table nagios_hoststatus modify output varchar(65535) not null;alter table nagios_hoststatus modify long_output TEXT not null;alter table nagios_hoststatus modify perfdata TEXT not null;" | mysql -pnagiosxi

echo "use nagios;alter table nagios_servicechecks modify output varchar(65535) not null;alter table nagios_servicechecks modify long_output TEXT not null;alter table nagios_servicechecks modify perfdata TEXT not null;" | mysql -pnagiosxi

echo "use nagios;alter table nagios_hostchecks modify output varchar(65535) not null;alter table nagios_hostchecks modify long_output TEXT not null;alter table nagios_hostchecks modify perfdata TEXT not null;" | mysql -pnagiosxi

Re: Service Check Output - Not displaying all lines of outpu

Posted: Mon Nov 25, 2019 3:37 pm
by scomdco
Thank you Scott! I've applied the change and i see the full output is displaying now, this is much appreciated.

If i needed to revert the change, or modify how many characters i'd want to allow, then i would just edit the number with the parenthesis, correct? If not let me know. If it is correct, and just for informational purposes, is 65535 the max number of characters that can be allowed?

echo "use nagios;alter table nagios_hostchecks modify output varchar(255) not null;alter table nagios_hostchecks modify long_output TEXT not null;alter table nagios_hostchecks modify perfdata TEXT not null;" | mysql -pnagiosxi

Re: Service Check Output - Not displaying all lines of outpu

Posted: Mon Nov 25, 2019 3:48 pm
by scottwilkerson
scomdco wrote:If i needed to revert the change, or modify how many characters i'd want to allow, then i would just edit the number with the parenthesis, correct? If not let me know. If it is correct, and just for informational purposes, is 65535 the max number of characters that can be allowed?

echo "use nagios;alter table nagios_hostchecks modify output varchar(255) not null;alter table nagios_hostchecks modify long_output TEXT not null;alter table nagios_hostchecks modify perfdata TEXT not null;" | mysql -pnagiosxi
Correct and correct.

Re: Service Check Output - Not displaying all lines of outpu

Posted: Mon Nov 25, 2019 4:17 pm
by scomdco
Sounds good! This thread can be closed as i'll create a seperate thread for the emails not acknowledging HTML code, unless you'd rather give insight on that through here.

Here's the output of the service check now. It's acknowledging any of the HTML code within the script, (Underline,Bold,Break), i redacted some info for security purposes.
htmlemail3.png
Here's the output in the email, you can see the raw html code within the output
htmlemail1.png
Here's another example where just Bold is supposed to apply
htmlemail.png

Re: Service Check Output - Not displaying all lines of outpu

Posted: Mon Nov 25, 2019 4:33 pm
by scottwilkerson
Lets create a different thread for that but I am going to speculate that the output just has newline seperators and not html <br> tags which would make this expected output.

The only way I can see around this would be to change the email template to wrap %serviceoutput% in a pre tag, like

Code: Select all

<pre>%serviceoutput%</pre>
Locking thread