Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # libraries you import here, must be present on the target node.
- import sys
- import re
- import subprocess
- def main():
- try:
- result = subprocess.check_output(['df', '-h'])
- lines = result.decode('utf-8').split('\n')
- capa = []
- totalOut = []
- for line in lines:
- tmp = line.split(' ')
- tmp = list(filter(None, tmp))
- for z in tmp:
- if re.match("^(\\d[75-99]|100)%$", z):
- totalOut.append(line)
- capa.append(z)
- print("\n".join(totalOut))
- except Exception as e:
- sys.stderr.write("Error: %s" % str(e))
- exit(1)
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement