Skip to content

Instantly share code, notes, and snippets.

@tarnfeld
Created August 26, 2011 15:44
Show Gist options
  • Save tarnfeld/1173708 to your computer and use it in GitHub Desktop.
Save tarnfeld/1173708 to your computer and use it in GitHub Desktop.
import simplejson, urllib
from sys import argv
class PHPFPM:
def __init__(self, agent_config, checksLogger, rawConfig):
self.agent_config = agent_config
self.checks_logger = checksLogger
self.raw_config = rawConfig
self.status_url = "http://127.0.0.1/status"
if 'fpm_status_url' in rawConfig['Main']:
self.status_url = rawConfig['Main']['fpm_status_url'] + "?json"
self.checks_logger.info('Setup FPM URL: ' + self.status_url)
def run(self):
try:
json = urllib.urlopen(self.status_url).read()
parsed = simplejson.loads(json)
self.checks_logger.debug('Parsed JSON: ' + json)
except Exception as e:
self.checks_logger.info('Failed to get FPM status ' + e.__str__())
return False
return parsed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment