# Path: amonagent/modules/core.py
# def get_cpu_info():
# def get_ip_address():	
# def get_uptime():
# def get_memory_info():
# 	def parse_output(self, df_output):
# 		def keep_device(device):
# 	def _is_number(self, a_string):
# 	def _check_blocks(self, blocks):
# 	def _is_real_device(self, device):
# 	def _flatten_devices(self, devices):
# 	def check(self):
# def get_network_traffic():
# def get_load_average():
# def get_cpu_utilization():
# 	MINUTE  = 60
# 	HOUR    = MINUTE * 60
# 	DAY     = HOUR * 24
# class DiskCheck(object):
# 
# Path: amonagent/modules/processes.py
# class ProcessesDataCollector(object):
# 	def __init__(self):
# 	def collect(self):
# 
# Path: amonagent/modules/distro.py
# def get_distro():
#     distro = {}
#     try:
#        f = Facts()
#     except:
#         f = False
# 
# 
#     if f:
#         facts_filter = [
#             'distribution_version', 
#             'distribution',
#         ]
#         replaced_names = {
#             'distribution_version': 'version',
#             'distribution' : 'name'
#         }
#         if type(f.facts) is dict:
# 
#             for key, fact in f.facts.items():
#                 if key in facts_filter:
#                     reported_key = replaced_names[key]
#                     distro[reported_key] = fact
#             
# 
#     return distro
# 
# Path: amonagent/modules/plugins.py
# def discover_plugins(plugin_paths=[]):
# 	""" Discover the plugin classes contained in Python files, given a
# 		list of directory names to scan. Return a list of plugin classes.
# 		
# 		For now this method will look only in /etc/amonagent/plugins with possible 
# 		future extension which will permit searching for plugins in 
# 		user defined directories
# 	"""
# 
# 	if os.path.exists(ENABLED_PLUGINS_PATH):
# 		# Find all enabled plugins
# 		for filename in os.listdir(ENABLED_PLUGINS_PATH):
# 			plugin_name, ext = os.path.splitext(filename)
# 			if ext == ".conf":
# 				
# 				# Configuration file OK, load the plugin				
# 				plugin_path = find_plugin_path(plugin_name=plugin_name) # path or False
# 
# 				if plugin_path:
# 					for filename in os.listdir(plugin_path):
# 						modname, extension = os.path.splitext(filename)
# 						if extension == '.py':
# 							
# 							fp, path, descr = imp.find_module(modname, [plugin_path])
# 							if fp:
# 								# Loading the module registers the plugin in
# 								if modname not in ['base', '__init__']:
# 									mod = imp.load_module(modname, fp, path, descr)
# 								fp.close()
# 			
# 	return AmonPlugin.plugins
# 
# Path: amonagent/settings.py
# class Settings(object):
# 	def __init__(self):


import requests
import time
import sys
from amonagent.modules.core import (
	get_uptime,
	get_memory_info,
	get_cpu_utilization,
	get_load_average,
	disk_check,
	get_network_traffic,
	get_ip_address,
	get_cpu_info
)
from amonagent.modules.processes import processes_data_collector
from amonagent.modules.distro import get_distro
from amonagent.modules.plugins import discover_plugins
from amonagent.settings import settings
		message = 'Fail'
		color = FAIL

	print "Load collector: {color}{message}{end}".format(color=color, message=message, end=ENDC)
	print_data(info=info, message=message)

	info = get_cpu_utilization()
	if len(info) > 0:
		message = 'OK'
		color = OKGREEN
	else:
		message = 'Fail'
		color = FAIL

	print "CPU collector: {color}{message}{end}".format(color=color, message=message, end=ENDC)
	print_data(info=info, message=message)

	info = processes_data_collector.collect()
	if len(info) > 0:
		message = 'OK'
		color = OKGREEN
	else:
		message = 'Fail'
		color = FAIL

	print "Process collector: {color}{message}{end}".format(color=color, message=message, end=ENDC)
	print_data(info=info, message=message)




# Path: amonagent/modules/core.py
# def get_cpu_info():
# def get_ip_address():	
# def get_uptime():
# def get_memory_info():
# 	def parse_output(self, df_output):
# 		def keep_device(device):
# 	def _is_number(self, a_string):
# 	def _check_blocks(self, blocks):
# 	def _is_real_device(self, device):
# 	def _flatten_devices(self, devices):
# 	def check(self):
# def get_network_traffic():
# def get_load_average():
# def get_cpu_utilization():
# 	MINUTE  = 60
# 	HOUR    = MINUTE * 60
# 	DAY     = HOUR * 24
# class DiskCheck(object):
# 
# Path: amonagent/modules/processes.py
# class ProcessesDataCollector(object):
# 	def __init__(self):
# 	def collect(self):
# 
# Path: amonagent/modules/distro.py
# def get_distro():
#     distro = {}
#     try:
#        f = Facts()
#     except:
#         f = False
# 
# 
#     if f:
#         facts_filter = [
#             'distribution_version', 
#             'distribution',
#         ]
#         replaced_names = {
#             'distribution_version': 'version',
#             'distribution' : 'name'
#         }
#         if type(f.facts) is dict:
# 
#             for key, fact in f.facts.items():
#                 if key in facts_filter:
#                     reported_key = replaced_names[key]
#                     distro[reported_key] = fact
#             
# 
#     return distro
# 
# Path: amonagent/modules/plugins.py
# def discover_plugins(plugin_paths=[]):
# 	""" Discover the plugin classes contained in Python files, given a
# 		list of directory names to scan. Return a list of plugin classes.
# 		
# 		For now this method will look only in /etc/amonagent/plugins with possible 
# 		future extension which will permit searching for plugins in 
# 		user defined directories
# 	"""
# 
# 	if os.path.exists(ENABLED_PLUGINS_PATH):
# 		# Find all enabled plugins
# 		for filename in os.listdir(ENABLED_PLUGINS_PATH):
# 			plugin_name, ext = os.path.splitext(filename)
# 			if ext == ".conf":
# 				
# 				# Configuration file OK, load the plugin				
# 				plugin_path = find_plugin_path(plugin_name=plugin_name) # path or False
# 
# 				if plugin_path:
# 					for filename in os.listdir(plugin_path):
# 						modname, extension = os.path.splitext(filename)
# 						if extension == '.py':
# 							
# 							fp, path, descr = imp.find_module(modname, [plugin_path])
# 							if fp:
# 								# Loading the module registers the plugin in
# 								if modname not in ['base', '__init__']:
# 									mod = imp.load_module(modname, fp, path, descr)
# 								fp.close()
# 			
# 	return AmonPlugin.plugins
# 
# Path: amonagent/settings.py
# class Settings(object):
# 	def __init__(self):


# Path: amonagent/check.py
import requests
import time
import sys
from amonagent.modules.core import (
	get_uptime,
	get_memory_info,
	get_cpu_utilization,
	get_load_average,
	disk_check,
	get_network_traffic,
	get_ip_address,
	get_cpu_info
)
from amonagent.modules.processes import processes_data_collector
from amonagent.modules.distro import get_distro
from amonagent.modules.plugins import discover_plugins
from amonagent.settings import settings

		message = 'Fail'
		color = FAIL

	print "Load collector: {color}{message}{end}".format(color=color, message=message, end=ENDC)
	print_data(info=info, message=message)

	info = get_cpu_utilization()
	if len(info) > 0:
		message = 'OK'
		color = OKGREEN
	else:
		message = 'Fail'
		color = FAIL

	print "CPU collector: {color}{message}{end}".format(color=color, message=message, end=ENDC)
	print_data(info=info, message=message)

	info = processes_data_collector.collect()
	if len(info) > 0:
		message = 'OK'
		color = OKGREEN
	else:
		message = 'Fail'
		color = FAIL

	print "Process collector: {color}{message}{end}".format(color=color, message=message, end=ENDC)
	print_data(info=info, message=message)




	url = "{0}/api/test/{1}".format(settings.HOST, settings.SERVER_KEY)