Mercurial > hg > python
view nag.py @ 59:c22f83e049a9 simple
check0 works for nono10,
but is broken in that col 3 w/o the row 7 hit would find the row 3 hit
as satisfying the last (2nd) run, which isn't _necessarily_ correct
author | Henry Thompson <ht@markup.co.uk> |
---|---|
date | Sat, 03 Jun 2023 22:11:12 +0100 |
parents | fee51ab07d09 |
children |
line wrap: on
line source
#!/bin/python # Create a Clockwork object using your API key from clockwork import clockwork from sys import stdin from rfc822 import Message msg=Message(stdin,False) frm=msg.get('from') if (frm!="nagios@nagios2.skywalker.privatedns.com" and frm!='"Henry S. Thompson" <ht@inf.ed.ac.uk>'): print "SMS not from nagios: %s"%frm exit(1) api = clockwork.API("0a778e372c3582eeef36b5f7f580113067e82d76") message = clockwork.SMS( to = "447866471388", message = msg.fp.read(), from_name="Nagios") response = api.send(message) if response.success: print "SMS sent %s"%response.id else: print "SMS failed %s: %s"%(response.error_code,response.error_description) exit(2)