Openfaclon篇-Oracle监控

#一、 环境准备

  • cx_Oracle 对应你的python版本,下载地址https://qa.debian.org/watch/sf.php/cx-oracle
  • oracle-oracle-instantclient-basic 对应你要监控的oracle版本
  • oracle-instantclient-devel 对应你要监控的oracle版本

#二、 使用方法

self.username = 'xxx'
self.password = 'xxx'
self.address = '1.1.1.1'
self.database = 'xxx'

替换成你要监控的oracle的用户名、密码、IP地址、SID即可。

#三、 监控指标

('check_active','GAUGE'),
('rcachehit','GAUGE'),
('dsksortratio','GAUGE'),
('activeusercount','GAUGE'),
('dbsize','GAUGE'),
('dbfilesize','GAUGE'),
('commits','GAUGE'),
('rollbacks','GAUGE'),
('deadlocks','GAUGE'),
('redowrites','GAUGE'),
('tblscans','GAUGE'),
('tblrowsscans','GAUGE'),
('indexffs','GAUGE'),
('hparsratio','GAUGE'),
('netroundtrips','GAUGE'),
('logonscurrent','GAUGE'),
('lastarclog','GAUGE'),
('lastapplarclog','GAUGE'),
('bufbusywaits','GAUGE'),
('logswcompletion','GAUGE'),
('logfilesync','GAUGE'),
('logprllwrite','GAUGE'),
('enqueue','GAUGE'),
('dbseqread','GAUGE'),
('dbscattread','GAUGE'),
('dbsnglwrite','GAUGE'),
('dbprllwrite','GAUGE'),
('directread','GAUGE'),
('directwrite','GAUGE'),
('latchfree','GAUGE'),
('query_lock','GAUGE'),
('query_redologs','GAUGE'),
('query_rollbacks','GAUGE'),
('query_sessions','GAUGE'),
('fra_use','GAUGE')
  • 其中tablespacestablespaces_tempasm等空间监控会在main()函数初始化的使用,通过 self.get_tablespaces_add_monitlist()self.get_tablespaces_temp_add_monitlist()self.get_asm_add_monitlist()等方法自动计算出监控指标并追加到monit_keys列表中
  • 然后通过post方法直接将结果提交到transfer机器上
method = "POST"
handler = urllib2.HTTPHandler()
opener = urllib2.build_opener(handler)
url = 'http://172.18.14.5:6060/api/push'
request = urllib2.Request(url, data=json.dumps(p) )
request.add_header("Content-Type",'application/json')
request.get_method = lambda: method
try:
		pass
		connection = opener.open(request)
except urllib2.HTTPError,e:
		connection = e

if connection.code == 200:
		print connection.read()
else:
		print '{"err":1,"msg":"%s"}' % connection

#三、 地址
https://github.com/babywd/Openfaclon-Oralce

发布了15 篇原创文章 · 获赞 0 · 访问量 820
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 1024 设计师: 上身试试

分享到微信朋友圈

×

扫一扫,手机浏览