Page 1 of 2

Increase Plugin Output Length Restriction

Posted: Thu May 14, 2015 4:54 am
by Brick
I am using the Centos 64-bit VMware version.

I would like to increase the plugin output length, according to the core instructions I need to-
Nagios will only read the first 4 KB of data that a plugin returns. This is done in order to prevent runaway plugins from dumping megs or gigs of data back to Nagios. This 4 KB output limit is fairly easy to change if you need. Simply edit the value of the MAX_PLUGIN_OUTPUT_LENGTH definition in the include/nagios.h.in file of the source code distribution and recompile Nagios. There's nothing else you need to change!
However I am using the VM version so that file does not exist... is there another way of doing this?

Re: Increase Plugin Output Length Restriction

Posted: Thu May 14, 2015 10:07 am
by jolson
There should be no problem performing a recompile of Nagios Core on an XI box. First, let's check what version of Nagios Core you're using:

Code: Select all

/usr/local/nagios/bin/nagios -V
In my case, the output told me I was using 4.0.8, so my procedure below is tuned for that particular version. Use the following to recompile Nagios Core with a higher plugin output limit (default on 4.0.8 is 8k, not 4k):

Code: Select all

cd /tmp
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.8.tar.gz
tar zxf nagios-4.0.8.tar.gz
cd nagios-4.0.8
vi include/nagios.h
./configure
make all
make install
service nagios restart
When you vi into nagios.h, change the MAX_PLUGIN_OUTPUT_LENGTH value appropriately.

After these changes, you should be good to go!

Re: Increase Plugin Output Length Restriction

Posted: Tue May 19, 2015 10:09 am
by Brick
Hi,

I removed the hash and changed the line to read-

Code: Select all

define MAX_PLUGIN_OUTPUT_LENGTH                16384
But I am getting the following error when I try to 'make all'-

Code: Select all

[root@rvdvnag01 nagios-4.0.8]# make all
cd ./base && make
make[1]: Entering directory `/tmp/nagios-4.0.8/base'
gcc -Wall -I.. -g -O2 -DHAVE_CONFIG_H -DNSCORE -c -o nagios.o nagios.c
In file included from ../include/downtime.h:30,
                 from nagios.c:39:
../include/nagios.h:271: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before âMAX_PLUGIN_OUTPUT_LENGTHâ
make[1]: *** [nagios.o] Error 1
make[1]: Leaving directory `/tmp/nagios-4.0.8/base'
make: *** [all] Error 2
[root@rvdvnag01 nagios-4.0.8]#

Re: Increase Plugin Output Length Restriction

Posted: Tue May 19, 2015 10:25 am
by tgriep
You need to put back the # symbol on that line and recompile. It is not there for commenting out the line, the compiler needs it for the define statement.

Re: Increase Plugin Output Length Restriction

Posted: Tue May 19, 2015 10:51 am
by Brick
I thought that and tried it with the hashtag still in but it didn't make any difference- this is the output I am getting-

Code: Select all

ESX3 OK - storages : bcdpesx01-OS=1963.00 MB (76.68%), vv-vds-vswp-01=181593.00 MB (44.36%), vv-vds-vswp-02=190877.00 MB (46.63%), vv-vds-prod-01=1317525.00 MB (46.79%), vv-vds-prod-02=865586.00 MB (30.74%), vv-vds-prod-03=951033.00 MB (33.78%), vv-vds-te
And this is what it should look like-

Code: Select all

ESX3 OK - storages : bcdpesx01-OS=1963.00 MB (76.68%), vv-vds-vswp-01=181593.00 MB (44.36%), vv-vds-vswp-02=190877.00 MB (46.63%), vv-vds-prod-01=1317525.00 MB (46.79%), vv-vds-prod-02=865586.00 MB (30.74%), vv-vds-prod-03=951033.00 MB (33.78%), vv-vds-test-01=590070.00 MB (38.42%), vv-vds-test-02=1227547.00 MB (79.93%), vv-vds-test-03=490265.00 MB (31.92%), bcdpesx02-OS=1963.00 MB (76.68%), vv-vds-vswp-01=181593.00 MB (44.36%), vv-vds-vswp-02=190877.00 MB (46.63%), vv-vds-prod-01=1317525.00 MB (46.79%), vv-vds-prod-02=865586.00 MB (30.74%), vv-vds-prod-03=951033.00 MB (33.78%), vv-vds-test-01=590070.00 MB (38.42%), vv-vds-test-02=1227547.00 MB (79.93%), vv-vds-test-03=490265.00 MB (31.92%), bcdpesx03-OS=1963.00 MB (76.68%), vv-vds-vswp-01=181593.00 MB (44.36%), vv-vds-vswp-02=190877.00 MB (46.63%), vv-vds-prod-01=1317525.00 MB (46.79%), vv-vds-prod-02=865586.00 MB (30.74%), vv-vds-prod-03=951033.00 MB (33.78%), vv-vds-test-01=590070.00 MB (38.42%), vv-vds-test-02=1227547.00 MB (79.93%), vv-vds-test-03=490265.00 MB (31.92%), bcdpesx04-OS=1963.00 MB (76.68%), vv-vds-vswp-01=181593.00 MB (44.36%), vv-vds-vswp-02=190877.00 MB (46.63%), vv-vds-prod-01=1317525.00 MB (46.79%), vv-vds-prod-02=865586.00 MB (30.74%), vv-vds-prod-03=951033.00 MB (33.78%), vv-vds-test-01=590070.00 MB (38.42%), vv-vds-test-02=1227547.00 MB (79.93%), vv-vds-test-03=490265.00 MB (31.92%), vv-vds-vswp-01=181593.00 MB (44.36%), vv-vds-vswp-02=190877.00 MB (46.63%), vv-vds-prod-01=1317525.00 MB (46.79%), vv-vds-prod-02=865586.00 MB (30.74%), vv-vds-prod-03=951033.00 MB (33.78%), vv-vds-test-01=590070.00 MB (38.42%), vv-vds-test-02=1227547.00 MB (79.93%), vv-vds-test-03=490265.00 MB (31.92%), bcdpesx05-OS=1963.00 MB (76.68%), vv-vds-vswp-01=181593.00 MB (44.36%), vv-vds-vswp-02=190877.00 MB (46.63%), vv-vds-prod-01=1317525.00 MB (46.79%), vv-vds-prod-02=865586.00 MB (30.74%), vv-vds-prod-03=951033.00 MB (33.78%), vv-vds-test-01=590070.00 MB (38.42%), vv-vds-test-02=1227547.00 MB (79.93%), vv-vds-test-03=490265.00 MB (31.92%), bcdpesx06-OS=1963.00 MB (76.68%), vv-vds-vswp-01=181593.00 MB (44.36%), vv-vds-vswp-02=190877.00 MB (46.63%), vv-vds-prod-01=1317525.00 MB (46.79%), vv-vds-prod-02=865586.00 MB (30.74%), vv-vds-prod-03=951033.00 MB (33.78%), vv-vds-test-01=590070.00 MB (38.42%), vv-vds-test-02=1227547.00 MB (79.93%), vv-vds-test-03=490265.00 MB (31.92%), bcdpesx07-OS=1963.00 MB (76.68%), vv-vds-vswp-01=181593.00 MB (44.36%), vv-vds-vswp-02=190877.00 MB (46.63%), vv-vds-prod-01=1317525.00 MB (46.79%), vv-vds-prod-02=865586.00 MB (30.74%), vv-vds-prod-03=951033.00 MB (33.78%), vv-vds-test-01=590070.00 MB (38.42%), vv-vds-test-02=1227547.00 MB (79.93%), vv-vds-test-03=490265.00 MB (31.92%), bcdpesx08-OS=1963.00 MB (76.68%) 
And yes I did restart the service, in fact i restarted the whole machine!

Re: Increase Plugin Output Length Restriction

Posted: Tue May 19, 2015 11:53 am
by jolson
What plugin are you using? Some plugins employ their own artificial limits on message sizing. check_nrpe is notable for having this complication.

Re: Increase Plugin Output Length Restriction

Posted: Wed May 20, 2015 4:58 am
by Brick
The above post shows the results of the exact same check- the top one is what I can see on the nagiosxi box itself, the bottom one is what I can see on a Thruk server linked to the nagiosxi server via livestatus...

Re: Increase Plugin Output Length Restriction

Posted: Wed May 20, 2015 9:29 am
by jolson
What plugin are you using to get the following output?

Code: Select all

ESX3 OK - storages : bcdpesx01-OS=1963.00 MB (76.68%), vv-vds-vswp-01=181593.00 MB (44.36%), vv-vds-vswp-02=190877.00 MB (46.63%), vv-vds-prod-01=1317525.00 MB (46.79%), vv-vds-prod-02=865586.00 MB (30.74%), vv-vds-prod-03=951033.00 MB (33.78%), vv-vds-te
Did you get this output by following a wizard, or implementing your own plugin? I would like to know so that I can use the plugin on my end and reproduce your issue.

Re: Increase Plugin Output Length Restriction

Posted: Mon Jun 01, 2015 10:42 am
by Brick
Its using this plug-in-

https://exchange.nagios.org/directory/P ... st/details

Although I'm not sure if its customised from the orginal...

Running it with -l vmfs command.

Its not the only plugin effected tho- it effects all of the plug ins the same way

Re: Increase Plugin Output Length Restriction

Posted: Mon Jun 01, 2015 11:04 am
by Brick
I wrote a new check, here is the source-

Code: Select all

#!/bin/bash

echo "TESTING this is a test 1. this is a test 2. this is a test 3. this is a test 4 this is a test 5. this is a test 6. this is a test 7. this is a test 8. this is a test 9. this is a test 10. this is a test 11. this is a test 12. this is a test 13. this is a test 14."
exit $STATE_OK
This is the output I get-

Code: Select all

TESTING this is a test 1. this is a test 2. this is a test 3. this is a test 4 this is a test 5. this is a test 6. this is a test 7. this is a test 8. this is a test 9. this is a test 10. this is a test 11. this is a test 12. this is a test 13. this is a