Plugin works from command line, but fails in app



I am using the following shell script to check oracle tables spaces. (note: I’m not sure why the pastie is showing “<<-EOF” and “EOF” twice on the here-document query…the actual shell script isn’t like that.)

Line 212, the sqlplus command, seems to be the problem. From the command line the TEMP_FILE is created and contains all of the tablespaces in it…and the script then reports back tablespaces that have reached the limits for WARNING and CRITICAL (or “OK” if all is well).

From the app, the TEMP_FILE is empty and giving the error on line 237.

The Service Definition:

# Service definition
define service{
        use                             generic-service
        host_name                       belgian
        service_description             tablespaces
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              3
        normal_check_interval           5
        retry_check_interval            3
        contact_groups                  dba
        notification_interval           120
        notification_period             24x7
        notification_options            n
        check_command                   belgian-tablespaces

The Check Command:

# Tablespaces for 'qdev'
define command{
        command_name belgian-tablespaces
        command_line   /web/nagios/3.0/libexec/ -s qdev -w 95 -c 98 -d .*

I can copy/paste the check command to the prompt and it works fine. It’s running from the web front end that fails.

Can someone shed some light on what’s wrong? I feel like I’m staring at a wall now and need some fresh eyes.

Nagios Server - Ubuntu 7.10, Nagios 3.0, Oracle Instant Client 10gr2
Oracle Server - RedHat EL 5, Oracle Database




For a start, refer to these 2 topics: … .php?11770 )
and … .php?12211

If that doesn’t solve your problem, could you paste your ? ( doesn’t seem to work right now).

Hope this helps


I think I have absolute paths everywhere. I was hoping that sleeping on it would help, but it hasn’t. :frowning:

Here’s the shell script:


Nagios plugin to check Oracle tablespace usage.

$Id:,v 1.6 2006/11/10 08:16:26 kivimaki Exp $

Copyright © 2006 Hannu Kivim


Well…I tried to have a look at it… but I’m not able to find an error just like that :slight_smile:

What you could do:
modify the script to add “> /tmp/my_log.log” for each “echo …” line, and then run the script via nagios, with the “-v” option (verbose).

You should probably find something interesting (my guess would be that you may have a problem with the ORACLE_HOME or other ORACLE variables …).


I’ll give your idea a go tomorrow. Thanks for you time on this…it is appreciated.


Ok, figured it out. Since I’m using the Oracle Instant Client, I needed to add LD_LIBRARY_PATH to the script. Around line 169ish I added this immediately below where ORACLE_HOME is set:


Running manually from the shell, the script was picking up the LD_LIBRARY_PATH from /etc/profile when I logged in…nagios doesn’t use /etc/profile.

Thanks again, Loose, for the attempt. :frowning: