Newer
Older
icinga-plugins / flightradar / check_fr24feed
paulchen on 8 Nov 616 bytes added plugins for flight trackers
#!/usr/bin/python3

import json, requests, time, sys, datetime as dt

try:
    resp = requests.get(url='http://localhost:8754/monitor.json')
except requests.exceptions.ConnectionError as e:
    print("Error fetching status URL")
    sys.exit(3)

data = json.loads(resp.text)

last_send_time = int(data['feed_last_ac_sent_time'])
age = int(time.time()) - last_send_time

hour = dt.datetime.today().hour
warning = 900
critical = 1800
if hour < 6 or hour > 21:
    warning = 5400
    critical = 7200

print("Last update sent %s seconds ago" % age)
if age > critical:
    sys.exit(2)
if age > warning:
    sys.exit(1)