# Path: amonagent/settings.py
# class Settings(object):
# 	def __init__(self):


import imp
import os
import re
import logging
	import json
	import simplejson as json
from decimal import Decimal
from datetime import timedelta, datetime
from amonagent.settings import settings
	### Used in PostgreSQL, Mysql, Mongo
	def normalize_row_value(self, value):
		if type(value) is Decimal:
			value = round(value, 2)
		elif type(value) is timedelta:
			value = value.total_seconds()
		elif type(value) is datetime:
			value =  str(value)
		elif type(value) is dict:
			to_str = ', '.join("%s=%r" % (key,val) for (key,val) in value.iteritems())
			value = to_str
		if value == None or value is False:
			value = ""
		
		return value
	### UTILS end
	
		
	def collect(self):
		raise NotImplementedError

	def error(self, error_msg):
		self.result['error'] = str(error_msg)


def find_plugin_path(plugin_name=None):

	path = False

	default_location = "{0}/{1}".format(settings.DEFAULT_PLUGINS_PATH, plugin_name)

# Path: amonagent/settings.py
# class Settings(object):
# 	def __init__(self):


# Path: amonagent/modules/plugins.py
import imp
import os
import re
import logging
	import json
	import simplejson as json
from decimal import Decimal
from datetime import timedelta, datetime
from amonagent.settings import settings

	### Used in PostgreSQL, Mysql, Mongo
	def normalize_row_value(self, value):
		if type(value) is Decimal:
			value = round(value, 2)
		elif type(value) is timedelta:
			value = value.total_seconds()
		elif type(value) is datetime:
			value =  str(value)
		elif type(value) is dict:
			to_str = ', '.join("%s=%r" % (key,val) for (key,val) in value.iteritems())
			value = to_str
		if value == None or value is False:
			value = ""
		
		return value
	### UTILS end
	
		
	def collect(self):
		raise NotImplementedError

	def error(self, error_msg):
		self.result['error'] = str(error_msg)


def find_plugin_path(plugin_name=None):

	path = False

	default_location = "{0}/{1}".format(settings.DEFAULT_PLUGINS_PATH, plugin_name)

	custom_location = "{0}/{1}".format(settings.CUSTOM_PLUGINS_PATH, plugin_name)