Quote:
Originally Posted by rde-actinux
Ok, I worked a bit on my tablespace monitoring.
I wrote a request for getting my table space percent usage
Code:
ALTER SESSION SET NLS_NUMERIC_CHARACTERS=".,";
SELECT
a.tablespace_name AS name,
ROUND(100* b.bytes / a.bytes,1) AS percent_free
FROM
(SELECT tablespace_name, sum(bytes) bytes from SYS.DBA_DATA_FILES
GROUP BY tablespace_name) a,
(SELECT tablespace_name, sum(bytes) bytes from SYS.DBA_FREE_SPACE
GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name;
|
For what i've seen is impossible parse this kind of output inside zabbix, is more easy do something like this:
select * from (
SELECT
a.tablespace_name AS name,
ROUND(100* b.bytes / a.bytes,1) AS percent_free
FROM
(SELECT tablespace_name, sum(bytes) bytes from SYS.DBA_DATA_FILES
GROUP BY tablespace_name) a,
(SELECT tablespace_name, sum(bytes) bytes from SYS.DBA_FREE_SPACE
GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name
)
where percent_free > 80
and simply do a trigger that become red when there is a sorta of output,
so you are going to see always green when you don't have nothing that has more than 80 % space used.
Consider that "system" tablespace is often fully used.
I hope this will help you.
Consider also this:
if USERS tblspace is made by 2 datafiles and ONE of this has autoextend this query return a wrong value, because don't consider autoextend and maxsize of datafiles. (this is what i mean for trouble with tablespaces query).