Created
August 26, 2011 15:44
-
-
Save tarnfeld/1173708 to your computer and use it in GitHub Desktop.
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
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