[Nagiosplug-devel] Patch for check_oracle.sh

Florian Gleixner flo at bier.homeip.net
Thu Aug 17 11:12:02 CEST 2006


OOps, one forgot one NVL()!


@@ -244,13 +244,14 @@
     result=`sqlplus -s ${3}/${4}@${2} << EOF
 set pagesize 0
 set numf '9999999.99'
-select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc
+select NVL(b.free,0.0),a.total,100 - trunc(NVL(b.free,0.0)/a.total *
1000) / 10 prc
 from (
 select tablespace_name,sum(bytes)/1024/1024 total
-from dba_data_files group by tablespace_name) A,
+from dba_data_files group by tablespace_name) A
+LEFT OUTER JOIN
 ( select tablespace_name,sum(bytes)/1024/1024 free
 from dba_free_space group by tablespace_name) B
-where a.tablespace_name=b.tablespace_name and a.tablespace_name='${5}';
+ON a.tablespace_name=b.tablespace_name WHERE a.tablespace_name='${5}';
 EOF`

     if [ -n "`echo $result | grep ORA-`" ] ; then


Florian Gleixner wrote:
> Hi,
> 
> check_oracle gives
> 
> /usr/local/nagios/libexec/check_oracle: [: : integer expression expected
> /usr/local/nagios/libexec/check_oracle: [: : integer expression expected
> /usr/local/nagios/libexec/check_oracle: [: : integer expression expected
> 
> if the table dba_free_space does not contain any free segment -> the
> tablespace is 100% full. I changed the query so that it returns 100% in
> this condition.
> 
> Here's the patch:
> 
> diff -ud check_oracle.sh check_oracle
> --- check_oracle_v14.sh 2006-08-17 10:57:29.605426000 +0200
> +++ check_oracle        2006-08-17 10:59:16.006634000 +0200
> @@ -244,13 +244,14 @@
>      result=`sqlplus -s ${3}/${4}@${2} << EOF
>  set pagesize 0
>  set numf '9999999.99'
> -select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc
> +select b.free,a.total,100 - trunc(NVL(b.free,0.0)/a.total * 1000) / 10 prc
>  from (
>  select tablespace_name,sum(bytes)/1024/1024 total
> -from dba_data_files group by tablespace_name) A,
> +from dba_data_files group by tablespace_name) A
> +LEFT OUTER JOIN
>  ( select tablespace_name,sum(bytes)/1024/1024 free
>  from dba_free_space group by tablespace_name) B
> -where a.tablespace_name=b.tablespace_name and a.tablespace_name='${5}';
> +ON a.tablespace_name=b.tablespace_name WHERE a.tablespace_name='${5}';
>  EOF`
> 
>      if [ -n "`echo $result | grep ORA-`" ] ; then
> 
> 
> 
> Florian Gleixner
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________________
> Nagios Plugin Development Mailing List Nagiosplug-devel at lists.sourceforge.net
> Unsubscribe at https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
> ::: Please include plugins version (-v) and OS when reporting any issue. 
> ::: Messages without supporting info will risk being sent to /dev/null





More information about the Devel mailing list