Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import diamond.collector
- import urllib
- TO_PUBLISH = ['TotalAccesses', 'TotalkBytes', 'BusyWorkers', 'IdleWorkers']
- class ApacheCollector(diamond.collector.Collector):
- def get_default_config(self):
- config = super(ApacheCollector, self).get_default_config()
- config.update({
- 'URL': 'http://localhost/server-status'
- })
- return config
- def collect(self):
- content = urllib.urlopen(self.config['URL'] + '?auto')
- for line in content:
- line.rstrip()
- line = line.replace(' ', '')
- key, value = line.split(':')
- if key in TO_PUBLISH:
- self.publish(key, value)
- return None
Add Comment
Please, Sign In to add comment