Question

SQL Query - bad interpretation in output

  • 2 April 2024
  • 0 replies
  • 14 views

Badge +1

Hi everybody !

I have created a service in order to check Oracle autoextended tablespaces.

A SQL custom query runs in order to retrieve the TB space utilization. Unfortunately, the result in UNKNOWN because some special caracters appears in the command output.
The query (in the command check):

--sql-statement="SELECT ddf.tablespace_name $ARG5$,round((ddf.bytes - sum(dfs.bytes)) / (ddf.maxbytes) * 100, 2) taux_occupation_tablespace FROM dba_free_space dfs,(select tablespace_name, sum(bytes) bytes, sum(decode(maxbytes, 0, bytes, maxbytes)) maxbytes FROM dba_data_files group by tablespace_name) ddf,dba_tablespaces dt WHERE dfs.tablespace_name (+) = ddf.tablespace_name AND dt.tablespace_name = dfs.tablespace_name AND dt.contents <> 'UNDO' GROUP BY ddf.tablespace_name, ddf.bytes, ddf.maxbytes ORDER BY $ARG5$" --warning=$ARG6$ --critical=$ARG7$

But in centreon, <*> appears in the output, just before ‘UNDO’:
UNKNOWN: Cannot execute query: ORA-00904: "UNDO" : identificateur non valide (DBD ERROR: error possibly near <*> indicator at char 443 in 'SELECT ddf.tablespace_name STRSAICIS68126P_INDEXTS,round((ddf.bytes - sum(dfs.bytes)) / (ddf.maxbytes) * 100, 2) taux_occupation_tablespace FROM dba_free_space dfs,(select tablespace_name, sum(bytes) bytes, sum(decode(maxbytes, 0, bytes, maxbytes)) maxbytes FROM dba_data_files group by tablespace_name) ddf,dba_tablespaces dt WHERE dfs.tablespace_name (+) = ddf.tablespace_name AND dt.tablespace_name = dfs.tablespace_name AND dt.contents <> <*>UNDO GROUP BY ddf.tablespace_name, ddf.bytes, ddf.maxbytes ORDER BY STRSAICIS68126P_INDEXTS')

If someone has an idea to remove the <*> it would be nice !

Kind regards,

Alexandre

 


0 replies

Be the first to reply!

Reply