#!/usr/bin/env python
# -*- coding:utf-8 -*-
__author__ = 'Jipu FANG'
version = 0.1
import cx_Oracle
def value():
db_conn = cx_Oracle.connect("user/Passwd@IP/SID")
cur = db_conn.cursor()
sql = r"select group_number,name,total_mb,free_mb from v$asm_diskgroup"
cur.execute(sql)
res = cur.fetchall()
cur.close()
db_conn.close()
return res
a=[]
for i in value():
if float(i[3])/float(i[2]) < 0.2:
a.append('200')
else:
a.append('100')
# 剩余空间低于20%时,输出200,可以结合zabbix报警。
if '200' in a:
print 200
else:
print 100