Page 1 of 2
Nagios Output file
Posted: Wed Jun 18, 2014 2:57 am
by amitdaniel
Hey Guys ,
Need you professional help again.
I created my own script to nagios with HUGE output (That's fine for me) But nagios Email notification cut the output after the first new line.
This is the example for the output :
Code: Select all
Job glowing-indexer-494:bqjob_r4ff798991b23117b_00000146ac7f8634_1
Job Type State Start Time Duration Bytes Processed
---------- --------- ----------------- ---------- -----------------
load FAILURE 18 Jun 01:03:04 0:00:00
Errors encountered during job execution. Not found: Google Storage File gs://XXXXXXXXXXXXXXXXXXXXXX.log
info about jobID : bqjob_r603d97f34ad153bf_00000146abac004d_1
Job glowing-indexer-494:bqjob_r603d97f34ad153bf_00000146abac004d_1
Do you think it's possible to send all this to the output ?
Thanks guys !!
Re: Nagios Output file
Posted: Wed Jun 18, 2014 4:36 am
by chris.fixter
Re: Nagios Output file
Posted: Wed Jun 18, 2014 4:11 pm
by slansing
As Chris mentioned,
You are going to need to switch from using the normal output macro's to longoutput as shown in Case 3. If you need help with that let us know.
Re: Nagios Output file
Posted: Thu Jun 19, 2014 1:17 am
by amitdaniel
Thanks for your help but still i can't see my full output .
let me explain what i'm doing (Maybe i have mistakes)
1. Added this file nagios-4.0.7/include/nagios.h
2. Change this variable to this value : #define MAX_PLUGIN_OUTPUT_LENGTH 20192
After that Re-compile the nagios :
1
./configure --with-command-group=nagcmd
2
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
Start the nagios.
If i run the script using nagios user this is the output :
[nagios@nagios libexec]$ python check_cloud_watch_test.py
This is the output :
Code: Select all
CRITICAL - There is Alarms in Virginia & Europe Regions Please check and fix them => Fusionx_latency ,awselb-fusionx-convfunnel-High-Average-Latency ,
2014-06-18 14:13:08.465651
CRITICAL - There is Alarms in Virginia & Europe Regions Please check and fix them => awselb-fusionx-convfunnel-High-Average-Latency ,
2014-06-18 14:14:48.643213
CRITICAL - There is Alarms in Virginia & Europe Regions Please check and fix them => awselb-fusionx-convfunnel-High-Average-Latency ,
2014-06-18 14:16:28.835511
OK - No Alarms in Virginia & Europe Regions , Everything is Fine !! 2014-06-18 14:18:09.011817
OK - No Alarms in Virginia & Europe Regions , Everything is Fine !! 2014-06-18 14:19:48.174949
OK - No Alarms in Virginia & Europe Regions , Everything is Fine !! 2014-06-18 14:21:28.300730
OK - No Alarms in Virginia & Europe Regions , Everything is Fine !! 2014-06-18 14:23:08.486223
OK - No Alarms in Virginia & Europe Regions , Everything is Fine !! 2014-06-18 14:24:48.776008
OK - No Alarms in Virginia & Europe Regions , Everything is Fine !! 2014-06-18 14:26:29.093319
OK - No Alarms in Virginia & Europe Regions , Everything is Fine !! 2014-06-18 14:28:08.437110
OK - No Alarms in Virginia & Europe Regions , Everything is Fine !! 2014-06-18 14:29:48.694743
OK - No Alarms in Virginia & Europe Regions , Everything is Fine !! 2014-06-18 14:31:28.871091
But in the UI & Email this is what i'm getting :
2014-06-18 14:09:28.765395 (Only the first line)
Thanks for your amazing help like always !!!
Re: Nagios Output file
Posted: Thu Jun 19, 2014 2:49 pm
by sreinhardt
As slansing mentioned, this isn't totally a size issue, but more of after a newline in standard output, the rest is only returned if you request longoutput to be appended to your commands. I would suggest by adding $LONGSERVICEOUTPUT$ to your notification command so that the data after is correctly added to your emails.
Re: Nagios Output file
Posted: Sat Jun 21, 2014 2:13 pm
by amitdaniel
Hey ,
Thanks for your answer but i didn't understand it.
Can you explain to me exactly what i need to change ?
Thanks !!!
Re: Nagios Output file
Posted: Sun Jun 22, 2014 8:27 pm
by chris.fixter
Can you paste your command definition here ?
Re: Nagios Output file
Posted: Mon Jun 23, 2014 9:35 am
by amitdaniel
NP
Code: Select all
define command{
command_name check_cloud_watch_test
command_line /usr/bin/python /usr/local/nagios/libexec/check_cloud_watch_test.py
}
Let me know if something is wrong ( This is how i define all my commands)
Thanks
Re: Nagios Output file
Posted: Mon Jun 23, 2014 4:56 pm
by tmcdonald
I believe sreinhardt was talking about your notify-service-by-email and notify-host-by-email commands in commands.cfg, and adding the $LONGHOSTOUTPUT$ and $LONGSERVICEOUTPUT$ macros in place of the normal $HOSTOUTPUT$ and $SERVICEOUTPUT$ macros.
Re: Nagios Output file
Posted: Tue Jun 24, 2014 5:38 am
by amitdaniel
You want to see how i define the service ?
This will help you to help me solved this issue ?