|
|
@ -12,22 +12,17 @@ import time |
|
|
|
import requests |
|
|
|
import requests |
|
|
|
|
|
|
|
|
|
|
|
# 此为企业的ID号 |
|
|
|
# 此为企业的ID号 |
|
|
|
CorpID = '' |
|
|
|
CorpID = 'wwa1dc8236066bab50' |
|
|
|
|
|
|
|
|
|
|
|
# 应用的ID |
|
|
|
# 应用的ID |
|
|
|
Agentid = 1000004 |
|
|
|
Agentid = 1000005 |
|
|
|
|
|
|
|
|
|
|
|
# 认证信息,企业ID+认证信息可获取tokent,获取之后向此tokent发送内容 |
|
|
|
# 认证信息,企业ID+认证信息可获取tokent,获取之后向此tokent发送内容 |
|
|
|
Secret = '' |
|
|
|
Secret = 'CRzsnYigkQy_9qoHErXG94am81AUuXabY0A8-N7LW_4' |
|
|
|
|
|
|
|
|
|
|
|
localtime = time.strftime("[%H:%M:%S]", time.localtime()) |
|
|
|
localtime = time.strftime("[%H:%M:%S]", time.localtime()) |
|
|
|
class Tencent(object): |
|
|
|
class Tencent(object): |
|
|
|
def __init__(self,user,title): |
|
|
|
def __init__(self,user,title, msg): |
|
|
|
import subprocess |
|
|
|
|
|
|
|
a=subprocess.getoutput("free -h |awk 'NR==2{print $4}'") |
|
|
|
|
|
|
|
b=subprocess.getoutput("df -Th |awk 'NR==2{print $5}'") |
|
|
|
|
|
|
|
c= subprocess.getoutput("uptime |awk -F ':' '{print $NF}'") |
|
|
|
|
|
|
|
msg =a+b+c |
|
|
|
|
|
|
|
# 格式化输出内容:标题+内容 |
|
|
|
# 格式化输出内容:标题+内容 |
|
|
|
self.MSG = f'{title}\n{msg}\n{localtime}' |
|
|
|
self.MSG = f'{title}\n{msg}\n{localtime}' |
|
|
|
self.User = user |
|
|
|
self.User = user |
|
|
@ -60,6 +55,6 @@ class Tencent(object): |
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
if __name__ == '__main__': |
|
|
|
# 创建对象 |
|
|
|
# 创建对象 |
|
|
|
send_obj = Tencent('xxxxx','我就是我,不一样的烟火') |
|
|
|
send_obj = Tencent(sys.argv[1],str(sys.argv[2]), str(sys.argv[3])) |
|
|
|
# 调用发送函数 |
|
|
|
# 调用发送函数 |
|
|
|
send_obj.send_message() |
|
|
|
send_obj.send_message() |
|
|
|