Page 1 of 1

Changing the length of the plugin output in Nagiosxi

Posted: Thu Jun 02, 2011 7:53 am
by arnab.roy
Hi ,

I am trying to monitor a number of wireless access points the output of the plugin looks like this
OK AP-Khipu-Comms-Room Clients-0 OK AP-Khipu-South-Africa-Office Clients-0 OK AP-Khipu-South-Africa-Office Clients-0 OK AP-Khipu-Board-Room Clients-5 OK AP-Khipu-Board-Room Clients-5 OK AP-Khipu-MiltonKeynes-Office Clients-0 OK AP-Khipu-Remote-Backup Clients-0 OK AP-Khipu-Technical Clients-4 |Khipu-Comms-Room1=0;25;30;0; Khipu-South-Africa-Office2=0;25;30;0; Khipu-South-Africa-Office3=0;25;30;0; Khipu-Board-Room4=5;25;30;0; Khipu-Board-Room5=5;25;30;0; Khipu-MiltonKeynes-Office6=0;25;30;0; Khipu-Remote-Backup7=0;25;30;0; Khipu-Technical8=4;25;30;0;

Nagios is obviously chopping the output off and processing 4k, in the opensource version this value can be modified at compile time is their a way we can increase this in NagiosXI.

Many Thanks
Arnab

Re: Changing the length of the plugin output in Nagiosxi

Posted: Thu Jun 02, 2011 9:32 am
by tonyyarusso
You would need to do the same process, recompiling Core underneath.

Re: Changing the length of the plugin output in Nagiosxi

Posted: Thu Jun 02, 2011 11:18 am
by arnab.roy
I am afraid I will end up breaking the whole thing, as I am not very sure how the core and xi frontend talks to each other ...:( it would be great if some kind of step by step process is provided, many thanks

Arnab

Re: Changing the length of the plugin output in Nagiosxi

Posted: Thu Jun 02, 2011 11:34 am
by tonyyarusso
Start with the Upgrade Instructions. After you have unpacked the update tarball and before you run the upgrade script, create a patch file in /tmp/nagiosxi/subcomponents/nagioscore/patches/ with your changes and add it to /tmp/nagiosxi/subcomponents/nagioscore/apply-patches, then run the upgrade script and proceed as usual. (This assumes you know how to make a patch file - there are other more direct but less "correct" ways to do this that will work too.)

Re: Changing the length of the plugin output in Nagiosxi

Posted: Thu Jun 02, 2011 1:18 pm
by arnab.roy
hi tony thanks for that , unfortunately we have some customization and integration with netdisco which will get blown if I run the upgrade script. we usually recopy the modified php s when we upgrade . so if you can suggest some alternatives that would be great

Re: Changing the length of the plugin output in Nagiosxi

Posted: Thu Jun 02, 2011 1:36 pm
by tonyyarusso
You could try tracking down which file(s) get modified by that option and figuring out how to compile just those I guess, although that would be a bit tedious. You really should separate out any customizations in a way that will be either saved or easily replaceable on an upgrade though, since you'll need to keep the software up to date anyway.

Re: Changing the length of the plugin output in Nagiosxi

Posted: Thu Jun 02, 2011 2:35 pm
by arnab.roy
hi tony ok I think we will go the upgrade way can you give an example of the patch file which will modify the value in the header file thanks s lot for your help

Re: Changing the length of the plugin output in Nagiosxi

Posted: Thu Jun 02, 2011 3:26 pm
by tonyyarusso
Here you go:

Code: Select all

[root@demo nagioscore]# pwd
/tmp/nagiosxi/subcomponents/nagioscore
[root@demo nagioscore]# cat patches/output-length.patch
diff -rau nagios-3.2.3/include/common.h /root/nagios-3.2.3/include/common.h
--- nagios-3.2.3/include/common.h       2010-10-03 22:56:55.000000000 -0500
+++ /root/nagios-3.2.3/include/common.h 2011-06-02 15:15:56.000000000 -0500
@@ -471,7 +471,7 @@
 #define MAX_FILENAME_LENGTH                    256     /* max length of path/filename that Nagios will process */
 #define MAX_INPUT_BUFFER                       1024    /* size in bytes of max. input buffer (for reading files, misc stuff) */
 #define MAX_COMMAND_BUFFER                      8192    /* max length of raw or processed command line */
-#define MAX_EXTERNAL_COMMAND_LENGTH             8192    /* max length of an external command */
+define MAX_EXTERNAL_COMMAND_LENGTH             16384    /* max length of an external command */

 #define MAX_DATETIME_LENGTH                    48

diff -rau nagios-3.2.3/include/nagios.h /root/nagios-3.2.3/include/nagios.h
--- nagios-3.2.3/include/nagios.h       2008-12-14 08:52:23.000000000 -0600
+++ /root/nagios-3.2.3/include/nagios.h 2011-06-02 15:15:44.000000000 -0500
@@ -43,7 +43,7 @@
    of MAX_EXTERNAL_COMMAND_LENGTH in common.h to allow for passive checks results received through the external
    command file. EG 10/19/07
 */
-#define MAX_PLUGIN_OUTPUT_LENGTH                8192    /* max length of plugin output (including perf data) */
+define MAX_PLUGIN_OUTPUT_LENGTH                16384    /* max length of plugin output (including perf data) */



[root@demo nagioscore]# cat apply-patches
#!/bin/sh

pkgname=$1


# Apply our patches
echo "Applying Nagios XI patches to Nagios Core..."

# Already in Nagios Core 3.2.3
#patch $pkgname/base/events.c < patches/nagios-schedulingstatus.patch

patch $pkgname/cgi/Makefile.in < patches/cgi-makefile.patch
patch $pkgname/base/checks.c < patches/nagios-passivehostcheckbroker.patch
patch $pkgname/base/checks.c < patches/nagios-passivehoststatusupdate.patch

patch -p0 < patches/output-length.patch

# Custom CGIs
cp patches/cgi/*.c $pkgname/cgi

[root@demo nagioscore]#