Module: check_mk
Branch: master
Commit: 2e0417f90642eeab54ba92f5aeb0c5d78f767f98
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2e0417f90642ee…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Feb 13 13:28:34 2012 +0100
mk_oracle (lnx+win): Fixed TEMP tablespace size calculations
---
ChangeLog | 1 +
agents/plugins/mk_oracle | 14 +++++++++++---
agents/windows/plugins/mk_oracle.bat | 6 +++---
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8548556..cc75d31 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,7 @@
on HP-UX.
* if/if64: inventory also picks up type 62 (fastEther). This
is needed on Cisco WLC 21xx series (thanks to Ralf Ertzinger)
+ * mk_oracle (lnx+win): Fixed TEMP tablespace size calculations
Multisite:
* Added several missing localization stringsw
diff --git a/agents/plugins/mk_oracle b/agents/plugins/mk_oracle
index eaeb49c..3f5ecb3 100755
--- a/agents/plugins/mk_oracle
+++ b/agents/plugins/mk_oracle
@@ -101,6 +101,11 @@ for SID in $SIDS; do
{
# Only execute checks when not filtered
+ if [ "$EXCLUDE" = "${EXCLUDE/oracle_version/}" ]; then
+ echo '<<<oracle_sessions>>>'
+ echo \"select banner from v\\\$version where banner like
'Oracle%';\" | sqlplus \"$SID\"
+ fi
+
if [ "$EXCLUDE" = "${EXCLUDE/oracle_sessions/}" ]; then
echo '<<<oracle_sessions>>>'
echo \"select count(*) from v\\\$session where status =
'ACTIVE';\" | sqlplus \"$SID\"
@@ -127,9 +132,12 @@ for SID in $SIDS; do
UNION
select f.file_name, f.tablespace_name, f.status, f.AUTOEXTENSIBLE,
f.blocks, f.maxblocks, f.USER_BLOCKS, f.INCREMENT_BY, 'TEMP',
- t.BLOCK_SIZE, t.status, 0
- from dba_temp_files f, dba_tablespaces t
- where f.tablespace_name = t.tablespace_name;
+ t.BLOCK_SIZE, t.status, sum(sh.blocks_free) free_blocks
+ from dba_temp_files f, dba_tablespaces t, v$temp_space_header sh
+ WHERE f.tablespace_name = t.tablespace_name and f.file_id = sh.file_id
+ GROUP BY th.instance, f.file_name, f.tablespace_name, f.status,
+ f.autoextensible, f.blocks, f.maxblocks, f.user_blocks, f.increment_by,
+ 'TEMP', t.block_size, t.status;
EOF
fi
} > $CACHE_FILE.new && mv $CACHE_FILE.new $CACHE_FILE || rm -f
$CACHE_FILE*
diff --git a/agents/windows/plugins/mk_oracle.bat b/agents/windows/plugins/mk_oracle.bat
index 1f3971d..fc80416 100644
--- a/agents/windows/plugins/mk_oracle.bat
+++ b/agents/windows/plugins/mk_oracle.bat
@@ -9,14 +9,14 @@ REM ; If you like to use a special auth parameter please change the line
below
SET AUTH=/ as sysdba
echo ^<^<^<oracle_version^>^>^>
-(echo.|set /p x=%ORACLE_SID%)
+(echo.|set /p x=%ORACLE_SID% )
(
echo set cmdsep on
echo set cmdsep '"'; --"
echo "set pages 0"
echo "set feedback off"
echo "set head off"
-echo "select * from v$version;"
+echo "select banner from v$version where banner like 'Oracle%%';"
) | sqlplus -S %AUTH%
echo ^<^<^<oracle_sessions^>^>^>
@@ -54,5 +54,5 @@ echo "set feedback off"
echo "set head off"
echo "column instance format a10"
echo "column file_name format a100"
-echo "select th.instance, f.file_name, f.tablespace_name, f.status,
f.AUTOEXTENSIBLE, f.blocks, f.maxblocks, f.USER_BLOCKS, f.INCREMENT_BY, f.ONLINE_STATUS,
t.BLOCK_SIZE, t.status, decode(sum(fs.blocks), NULL, 0, sum(fs.blocks)) free_blocks from
v$thread th, dba_data_files f, dba_tablespaces t, dba_free_space fs where
f.tablespace_name = t.tablespace_name and f.file_id = fs.file_id(+) group by th.instance,
f.file_name, f.tablespace_name, f.status, f.autoextensible, f.blocks, f.maxblocks,
f.user_blocks, f.increment_by, f.online_status, t.block_size, t.status UNION select
th.instance, f.file_name, f.tablespace_name, f.status, f.AUTOEXTENSIBLE, f.blocks,
f.maxblocks, f.USER_BLOCKS, f.INCREMENT_BY, 'TEMP', t.BLOCK_SIZE, t.status, 0 from
v$thread th, dba_temp_files f, dba_tablespaces t where f.tablespace_name =
t.tablespace_name;"
+echo "select th.instance, f.file_name, f.tablespace_name, f.status,
f.AUTOEXTENSIBLE, f.blocks, f.maxblocks, f.USER_BLOCKS, f.INCREMENT_BY, f.ONLINE_STATUS,
t.BLOCK_SIZE, t.status, decode(sum(fs.blocks), NULL, 0, sum(fs.blocks)) free_blocks from
v$thread th, dba_data_files f, dba_tablespaces t, dba_free_space fs where
f.tablespace_name = t.tablespace_name and f.file_id = fs.file_id(+) group by th.instance,
f.file_name, f.tablespace_name, f.status, f.autoextensible, f.blocks, f.maxblocks,
f.user_blocks, f.increment_by, f.online_status, t.block_size, t.status UNION SELECT
th.instance, f.file_name, f.tablespace_name, f.status, f.AUTOEXTENSIBLE, f.blocks,
f.maxblocks, f.USER_BLOCKS, f.INCREMENT_BY, 'TEMP', t.BLOCK_SIZE, t.status,
sum(sh.blocks_free) free_blocks FROM v$thread th, dba_temp_files f, dba_tablespaces t,
v$temp_space_header sh WHERE f.tablespace_name = t.tablespace_name and f.file_id =
sh.file_id GROUP BY th.instance, f.file_name, f.tablespace_name, f.status,
f.autoextensible, f.blocks, f.maxblocks, f.user_blocks, f.increment_by, 'TEMP',
t.block_size, t.status;"
) | sqlplus -S %AUTH%