orabbix外掛程式監控oracle資料表空間問題

來源:互聯網
上載者:User

標籤:nod   sed   highlight   order by   記錄   外掛程式   conf   bytes   file   

 我們安裝好orabbix外掛程式後,查看Tablespaces監控項是發項值為none,第一反應是沒監控成功,其實不然。

1、我們開啟orabbix監控項參數的路徑,下面為Tablespaces的sql代碼

[[email protected] ~]# vim /opt/orabbix/conf/query.propsselect ‘- Tablespace ->‘,t.tablespace_name ktablespace,        ‘- Type->‘,substr(t.contents, 1, 1) tipo,        ‘- Used(MB)->‘,trunc((d.tbs_size-nvl(s.free_space, 0))/1024/1024) ktbs_em_uso,        ‘- ActualSize(MB)->‘,trunc(d.tbs_size/1024/1024) ktbs_size,        ‘- MaxSize(MB)->‘,trunc(d.tbs_maxsize/1024/1024) ktbs_maxsize,        ‘- FreeSpace(MB)->‘,trunc(nvl(s.free_space, 0)/1024/1024) kfree_space,        ‘- Space->‘,trunc((d.tbs_maxsize - d.tbs_size + nvl(s.free_space, 0))/1024/1024) kspace,        ‘- Perc->‘,decode(d.tbs_maxsize, 0, 0, trunc((d.tbs_size-nvl(s.free_space, 0))*100/d.tbs_maxsize)) kperc from   ( select SUM(bytes) tbs_size,            SUM(decode(sign(maxbytes - bytes), -1, bytes, maxbytes)) tbs_maxsize, tablespace_name tablespace     from ( select nvl(bytes, 0) bytes, nvl(maxbytes, 0) maxbytes, tablespace_name     from dba_data_files     union all     select nvl(bytes, 0) bytes, nvl(maxbytes, 0) maxbytes, tablespace_name     from dba_temp_files     )     group by tablespace_name     ) d,     ( select SUM(bytes) free_space,     tablespace_name tablespace     from dba_free_space     group by tablespace_name     ) s,     dba_tablespaces t     where t.tablespace_name = d.tablespace(+) and     t.tablespace_name = s.tablespace(+)     order by 8)     where kperc > 93     and tipo <>‘T‘     and tipo <>‘U‘tbl_space.NoDataFound=none

這個SQL會返回93%滿的資料表空間資訊,而對應這個監控項,orabbix也定義了觸發器,因為監控項的傳回值是文本,而沒有滿足條件的記錄時返回字串“none“,所以監控項對應的觸發器會檢查傳回值開頭是不是none,如果不是,就警示,這樣,使用者除了收到預警資訊,還能從傳回值的具體值中看到具體時哪個資料表空間快滿了。

改為3%後測試結果:

當然,大部分時間監控項會返回none,所以我們無法畫出正常未滿的資料表空間的空間佔用時間曲線。只有超過93%慢時,我們才知道具體的佔用情況。

如果想收集並保留更多資訊,就需要使用自訂查詢,方法就是在query.props檔案中加入你想檢查的SQL,比如我們想瞭解資料表空間資訊,就加以下SQL:

customtbl.Query=select ‘TBL:‘||a.tablespace_name||‘,‘ TBL, ‘Total Size:‘||trunc(sum(a.tots) / 1024 / 1024, 2)||‘,‘ Tot_Size_mb, ‘Free MB:‘||round(sum(a.sumb) / 1024 / 1024, 2)||‘,‘ Tot_Free_mb, ‘PCT Free:‘||round(sum(a.sumb) * 100 / sum(a.tots), 2)||‘,‘ Pct_Free, ‘Max Free MB:‘||round(sum(a.largest) / 1024 / 1024, 2)||‘,‘ Max_Free_mb, ‘Chunks Free:‘||sum(a.chunks)||‘,‘ Chunks_Free from (select tablespace_name, 0 tots, sum(bytes) sumb, max(bytes) largest, count(*) chunks from dba_free_space a group by tablespace_name union select tablespace_name, sum(bytes) tots, 0, 0, 0 from dba_data_files group by tablespace_name) a group by a.tablespace_namecustomtbl.NoDataFound=none

 

 



 

orabbix外掛程式監控oracle資料表空間問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.