Skip to content

Instantly share code, notes, and snippets.

@paddycarey
Created June 26, 2013 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paddycarey/5867599 to your computer and use it in GitHub Desktop.
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/
#!/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