Page 1 of 1

No output returned from plugin

Posted: Thu Mar 06, 2014 5:01 am
by arenist
Hi folks,

there's a problem with a nagios check. All other checks have a status information except service "Tablespace VPSTAB EASTPROD". See attached jpg.

The script is defined as
command[check_east_vpstab]=/usr/local/nagios/libexec/check_tablespace.bsh -d EASTPROD -t VPSTAB -w 85 -c 90
in nrpe.cfg.
At the end of the shell script check_tablespace.bsh there are some echos and exitsatus:

Code: Select all

...
ECHO="/bin/echo -e"
...
sqlplus / as sysdba @/usr/local/nagios/libexec/belegung_tablespaces.sql
ZEILEN=$(awk -v TS="${TABLESPACE}" -v W="${WARNING}" 'match($0,TS) {if ($NF > W) print $NF}' /tmp/belegung_tablespace.txt|awk -F"." '{print $1}')
if [ -z ${ZEILEN} ];then
  # Tablespace ist weniger als ${WARNING}% belegt -> alles OK
  $ECHO "Tablespace ${TABLESPACE} der Instanz ${DATABASE} hat noch genug Platz.\n"
  exitstatus=$STATE_OK
else
  if [ ${ZEILEN} -gt ${CRIT} ];then
    # Tablespace ist ueber 90% belegt -> kritisch
    $ECHO "Tablespace ${TABLESPACE} der Instanz ${DATABASE} hat nicht mehr genug Platz.\n"
    exitstatus=$STATE_CRITICAL
  else
    # Tablespace ist zwischen ${WARNING}% und ${CRIT}% belegt -> Warnung
    $ECHO "Tablespace ${TABLESPACE} der Instanz ${DATABASE} muss vergroessert werden.\n"
    exitstatus=$STATE_WARNING
  fi
fi

exit ${exitstatus}
Running the script in CLI on the nagios server:

Code: Select all

nagios@madpbk51:/usr/local/nagios/libexec> ./check_nrpe -H veastdb11 -c check_east_vpstab

SQL*Plus: Release 11.2.0.3.0 Production on Thu Mar 6 10:51:47 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


TABLESPACE_NAME         MB_USED    MB_FREE PERCENT_USED
-------------------- ---------- ---------- ------------
VPSTAB                   272377      48510        82.19
SYSTEM                     1400        272        80.57
SYSAUX                     1300        298        77.06
USERS                       500        193        61.31
UNDOTBS1                   4096       4008        02.16
PSTAB                     20480      20272        01.01

6 rows selected.

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Tablespace VPSTAB der Instanz EASTPROD hat noch genug Platz.
I think, the last line of output should be the status information.
Tablespace VPSTAB der Instanz EASTPROD hat noch genug Platz.

Do you have an idea why it is not?

Regards arenist

Re: No output returned from plugin

Posted: Thu Mar 06, 2014 11:08 am
by abrist
How much of that output is stdout vs stderr?

Re: No output returned from plugin

Posted: Fri Mar 21, 2014 3:11 am
by arenist
Hi abrist,

sorry for my answer took so much time. I'm not sure if I understand what you mean. No information goes to stderr. All echo commands print to stdout. There is no redirection form stdout to stderr.

Regards arenist

PS: You have an interesting signature... ;)

Re: No output returned from plugin

Posted: Fri Mar 21, 2014 1:43 pm
by tmcdonald
Can you stick in an echo that does not sit inside an if statement? Just echo "DEBUG" or something in the first line of the script. I want to see if it can output anything at all.

Re: No output returned from plugin

Posted: Wed Mar 26, 2014 7:43 am
by arenist
Hi tmcdonald,

I put an "$ECHO "Script is running"" in front of the if block an there is an output.

I copied the Service State Information of this process:

Code: Select all

Current Status:	
  WARNING  
 (for 1d 19h 22m 40s)
Status Information:	Script is running
SQL*Plus: Release 11.2.0.3.0 Production on Wed Mar 26 13:38:00 2014
\nCopyright (c) 1982, 2011, Oracle. All rights reserved.
\n
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
\n
TABLESPACE_NAME MB_USED MB_FREE PERCENT_USED
-------------------- ---------- ---------- ------------
VPSTAB 277497 40162 85.53
SYSTEM 1400 264 81.14
SYSAUX 1300 287 77.94
USERS 500 193 61.31
UNDOTBS1 4096 4043 01.30
PSTAB 20480 20262 01.06
\n6 rows selected.
\nDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Tablespace VPSTAB der Instanz EASTPROD muss vergroessert werden.
Performance Data:	
Current Attempt:	3/3  (HARD state)
Last Check Time:	26-03-2014 13:38:00
Check Type:	ACTIVE
Check Latency / Duration:	0,000 / 0,000 seconds
Next Scheduled Check:  	26-03-2014 14:38:00
Last State Change:	24-03-2014 18:16:13
Last Notification:	26-03-2014 10:20:19 (notification 11)
Is This Service Flapping?	
  NO  
 (0,00% state change)
In Scheduled Downtime?	
  NO  
Last Update:	26-03-2014 13:38:49  ( 0d 0h 0m 4s ago)
Active Checks:	
  ENABLED  
Passive Checks:	
  ENABLED  
Obsessing:	
  ENABLED  
Notifications:	
  ENABLED  
Event Handler:	
  ENABLED  
Flap Detection:	
  ENABLED  
As you can see the line "Script is running" appears in the output.

Regards Arenist

Re: No output returned from plugin

Posted: Wed Mar 26, 2014 2:12 pm
by scottwilkerson
The "Status Information" column in the table you showed only shows what is on the first line of output. In you example:
Running the script in CLI on the nagios server:

Code: Select all

nagios@madpbk51:/usr/local/nagios/libexec> ./check_nrpe -H veastdb11 -c check_east_vpstab

SQL*Plus: Release 11.2.0.3.0 Production on Thu Mar 6 10:51:47 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


TABLESPACE_NAME         MB_USED    MB_FREE PERCENT_USED
-------------------- ---------- ---------- ------------
VPSTAB                   272377      48510        82.19
SYSTEM                     1400        272        80.57
SYSAUX                     1300        298        77.06
USERS                       500        193        61.31
UNDOTBS1                   4096       4008        02.16
PSTAB                     20480      20272        01.01

6 rows selected.

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Tablespace VPSTAB der Instanz EASTPROD hat noch genug Platz.
The first line is blank as seen directly under the command

Code: Select all

nagios@madpbk51:/usr/local/nagios/libexec> ./check_nrpe -H veastdb11 -c check_east_vpstab

This is why nothing is displayed in the table.

Re: No output returned from plugin

Posted: Thu Mar 27, 2014 7:06 am
by arenist
Hi scottwilkerson,

that looked like a very good idea. I changed my script so that I get now exactly one line of output.

Code: Select all

[root@veastdb11 libexec]# ./check_nrpe -H localhost -c check_east_vpstab
Tablespace VPSTAB der Instanz EASTPROD muss vergroessert werden.
The check by nagios works now:

Code: Select all

Current Status:	  WARNING  (for 2d 18h 40m 6s)
Status Information:	Tablespace VPSTAB der Instanz EASTPROD muss vergroessert werden.
Performance Data:	
Current Attempt:	3/3  (HARD state)
Last Check Time:	27-03-2014 12:56:00
Check Type:	ACTIVE
Check Latency / Duration:	0,000 / 0,000 seconds
Next Scheduled Check:  	27-03-2014 13:56:00
Last State Change:	24-03-2014 18:16:13
Last Notification:	27-03-2014 10:38:09 (notification 17)
Is This Service Flapping?	NO  (0,00% state change)
In Scheduled Downtime?	  NO  
Last Update:	27-03-2014 12:56:13  ( 0d 0h 0m 6s ago)
Thanks for your investigation! Thread can be closed.

Best regards, Arenist