Last active
March 22, 2022 03:36
-
-
Save stevehenderson/2fee04f3482ad27ac4a4e75905dcc96f to your computer and use it in GitHub Desktop.
UptimeBot Heartbeat Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import time | |
def contact_monitor(): | |
print("Calling the monitor...") | |
r= requests.get("https://heartbeat.uptimerobot.com/m11111111-11111111111111111111111111") | |
while 1==1: | |
time.sleep(30) | |
try: | |
r = requests.get("https://mysite.onlyreachable.insi.de") | |
if r.text == "What my service returns normally": | |
contact_monitor() | |
except Exception as e: | |
print("Exception while monitoring {}".format(e)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run this under pm2: