Nagios Output file

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
amitdaniel
Posts: 25
Joined: Mon Jul 01, 2013 9:17 am

Nagios Output file

Post 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 !!
chris.fixter
Posts: 22
Joined: Wed Jun 18, 2014 4:15 am

Re: Nagios Output file

Post by chris.fixter »

Does case 3 here http://nagios.sourceforge.net/docs/3_0/pluginapi.html described your case ?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Nagios Output file

Post 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.
amitdaniel
Posts: 25
Joined: Mon Jul 01, 2013 9:17 am

Re: Nagios Output file

Post 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 !!!
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Nagios Output file

Post 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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
amitdaniel
Posts: 25
Joined: Mon Jul 01, 2013 9:17 am

Re: Nagios Output file

Post 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 !!!
chris.fixter
Posts: 22
Joined: Wed Jun 18, 2014 4:15 am

Re: Nagios Output file

Post by chris.fixter »

Can you paste your command definition here ?
amitdaniel
Posts: 25
Joined: Mon Jul 01, 2013 9:17 am

Re: Nagios Output file

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios Output file

Post 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.
Former Nagios employee
amitdaniel
Posts: 25
Joined: Mon Jul 01, 2013 9:17 am

Re: Nagios Output file

Post by amitdaniel »

You want to see how i define the service ?
This will help you to help me solved this issue ?
Locked