Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import json
- import httplib
- from socket import gethostname;
- import sys
- import os
- import commands
- import string
- host = gethostname()
- host = host[0:host.find(".")]
- checkkernlog = commands.getstatusoutput("cat /var/log/syslog |grep -c 'ASIC hang happened'")
- #print checkkernlog
- hasBadGpu = int(checkkernlog[1])
- if hasBadGpu > 0:
- container = {}
- container['host'] = host
- container['error'] = str(hasBadGpu) + " gpu(s) froze."
- con = httplib.HTTPConnection("myhostname.com", 80)
- con.request("GET", "/reporting/error.php", json.dumps(container))
- response = con.getresponse().read()
- print response
- # reboot system
- commands.getstatusoutput("/sbin/shutdown -r now")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement