1、[root@localhost libexec]# cat check_hadoop_dfs.py
'''
Created on 20131101
@author: yangyang.feng
'''
#!/usr/bin/env python
import commands
import sys
from optparse import OptionParser
import urllib
import re
def get_dfs_free_percent():
urlItem = urllib.urlopen("http://192.168.20.201:50070/dfshealth.jsp")
html = urlItem.read()
urlItem.close()
return float(re.findall('.+<td id="col1"> DFS Remaining%<td id="col2"> :<td id="col3">\\s+(.+)%<tr class="rowNormal">.+', html)[0])
if __name__ == '__main__':
parser = OptionParser(usage="%prog [-w] [-c]", version="%prog 1.0") <
'''
Created on 20131101
@author: yangyang.feng
'''
#!/usr/bin/env python
import commands
import sys
from optparse import OptionParser
import urllib
import re
def get_dfs_free_percent():
urlItem = urllib.urlopen("http://192.168.20.201:50070/dfshealth.jsp")
html = urlItem.read()
urlItem.close()
return float(re.findall('.+<td id="col1"> DFS Remaining%<td id="col2"> :<td id="col3">\\s+(.+)%<tr class="rowNormal">.+', html)[0])
if __name__ == '__main__':
parser = OptionParser(usage="%prog [-w] [-c]", version="%prog 1.0") <