Created
June 26, 2013 14:01
-
-
Save paddycarey/5867599 to your computer and use it in GitHub Desktop.
Nagios Plugin to check appengine's current system status by scraping https://code.google.com/status/appengine/
This file contains 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
#!/usr/bin/env python | |
# stdlib imports | |
import sys | |
# third-party imports | |
import requests | |
from bs4 import BeautifulSoup | |
def fetch_status(): | |
url = 'https://code.google.com/status/appengine/' | |
return requests.get(url).content | |
def parse_status(html): | |
soup = BeautifulSoup(html) | |
statuses = soup.find_all(class_='ae-trust-col-now-prod') | |
return set([x.text.strip() for x in statuses]) | |
if __name__ == '__main__': | |
if len(parse_status(fetch_status())) > 1: | |
print "Appengine service interruption: https://code.google.com/status/appengine/" | |
sys.exit(2) | |
print "Appengine operating normally" | |
sys.exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment