pythonscript
if you want to send email if / is more than 20% then it will send it in python
server1:/ #cat t44.py
#!/usr/bin/python3
import os
import datetime
import subprocess
data=os.popen("df -gt").readlines()
for line in data:
sp_line=line.split()
if sp_line[-1]=='/':
x=int(float(sp_line[-2].rstrip('%')))
if x>20:
print('test')
cmd='echo "Hello Team capacity is greater then 20%" | mailx -s "Monitor" jatin_sethi@optum.com'
subprocess.run(cmd, shell=True)
Comments
Post a Comment