usr bin env python import sys import os import subprocess msg sys argv

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#!/usr/bin/env python
import sys
import os
import subprocess
msg = sys.argv[1].replace(" ", "_")
cell = sys.argv[2]
testargs = sys.argv[3:]
subprocess.call("""/usr/bin/lynx -source 'http://www.inforu.co.il/inforufrontend/webinterface/sendmessagebynumber.aspx?username=a&password=b&cellnumber=%s&messagestring=%s'""" % (cell, msg), shell=True)
myfile = open("/tmp/nagios.txt","w")
myfile.write(msg + "\n" + cell + "\n" + str(os.getuid()) + "\n" + str(testargs) + "\n")
myfile.close()
sys.exit(0)