├── thriftup.png ├── README.md └── ThriftUp.py /thriftup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srs81/sd-plugin-thriftup/master/thriftup.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ServerDensity plugin for Thrift uptime 2 | ====================================== 3 | 4 | ServerDensity plugin that monitors whether Thrift server is running or not (on port 9090). 5 | 6 | This is a simple ServerDensity Thrift uptime plugin that returns 1 is Thrift is running, and 0 if it is not. -------------------------------------------------------------------------------- /ThriftUp.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # Author: Suman Srinivasan 4 | # Last release: Sep 25, 2012 5 | # License: GPL v3 6 | 7 | # Modified from https://github.com/cwholt/sd-plugin-resque/blob/master/Resque.py 8 | 9 | import socket 10 | 11 | class ThriftUp: 12 | def __init__(self, agent_config, checks_logger, raw_config): 13 | self.agent_config = agent_config 14 | self.checks_logger = checks_logger 15 | self.raw_config = raw_config 16 | 17 | def run(self): 18 | stats = {} 19 | stats['thrift_up'] = 0 20 | s = socket.socket() 21 | address = '127.0.0.1' 22 | port = 9090 23 | try: 24 | s.connect((address, port)) 25 | stats['thrift_up'] = 1 26 | except Exception, e: 27 | stats['thrift_up'] = 0 28 | return stats 29 | 30 | if __name__ == '__main__': 31 | thrift = ThriftUp(None, None, None) 32 | print thrift.run() 33 | --------------------------------------------------------------------------------