Esempio n. 1
0
	def __init__(self, *args, **kargs):
		cengine.__init__(self, name=NAME, *args, **kargs)
		
		self.rotate_plan = {
			'PLAIN': 0,
			'TSC': 3,
		}
		self.point_per_dca = None
		
		self.storage = mongostore(mongo_collection='perfdata')
Esempio n. 2
0
	def __init__(self, *args, **kargs):
		cengine.__init__(self, name=NAME, *args, **kargs)
		
		self.create_queue = False
				
		self.beat_interval =  900
		
		self.resource = "sla"
		
		self.thd_warn_sla_timewindow = 98
		self.thd_crit_sla_timewindow = 95
		self.default_sla_timewindow = 60*60*24 # 1 day
		
		self.default_sla_output_tpl="{cps_pct_by_state_0}% Ok, {cps_pct_by_state_1}% Warning, {cps_pct_by_state_2}% Critical, {cps_pct_by_state_3}% Unknown"
		
		self.perfstorage = mongostore(mongo_collection='perfdata')
Esempio n. 3
0
	def test_1_Init(self):
		global myamqp
		myamqp = camqp()
		myamqp.add_queue(	queue_name = "unittest_alerts",
							routing_keys = "#",
							callback = on_alert,
							exchange_name = myamqp.exchange_name_alerts)
		myamqp.start()
		time.sleep(1)
		
		global storage
		storage = cstorage(caccount(user="******", group="root"), namespace='events', logging_level=logging.DEBUG)
		
		global perfstore
		perfstore = mongostore(mongo_collection='perfdata')
		
		clean()
Esempio n. 4
0
	msize = store.size()
	print "    + %.2f MB (%.2f MB/Year)" % ((msize / 1024.0 / 1024.0), ((msize / float(duration))/ 1024.0 / 1024.0) *  60*60*24*365)
	#nsize = mynode.size()
	#print "    + %.2f MB (%.2f MB/Year)" % ((nsize / 1024.0 / 1024.0), ((nsize / float(duration))/ 1024.0 / 1024.0) *  60*60*24*365)
	#print "    + Delta: %s B" % (msize - nsize)
	print "    + %s values in %s seconds" % ( nb, elapsed)
	print "    + %s values per second" % (int(nb/elapsed))
	print ""

	start = time.time()
	mynode = node('nagios.Central.check.service.localhost', storage=store)
	print "Get values between %s and %s" % (bench_start, bench_stop)
	values = mynode.metric_get_values(dn='load1', tstart=bench_start, tstop=bench_stop)
	nb = len(values)
	elapsed = time.time() - start
	print " + READ:"
	print "    + %s values in %s seconds" % ( nb, elapsed)
	print "    + %s values per second" % (int(nb/elapsed))
	print ""


print "Mongo Store"
storage = mongostore(mongo_safe=False)
mynode = node(node_id, storage=storage)
mynode.remove()

bench_store(	storage,
				interval=interval,
				duration=60*60*24*day,
				point_per_dca=point_per_dca)
Esempio n. 5
0
#import protection function
from libexec.auth import check_auth, get_account

# Modules
from pyperfstore import pmath
from pyperfstore import node
from pyperfstore import mongostore
from ctools import parse_perfdata

import ConfigParser
config = ConfigParser.RawConfigParser()
config.read(os.path.expanduser('~/etc/cstorage.conf'))

logger = logging.getLogger("perfstore")

perfstore = mongostore(mongo_collection='perfdata', mongo_host=config.get("master", "host"), mongo_port=config.getint("master", "port"))

config.read(os.path.expanduser('~/etc/webserver.conf'))
pyperfstore_aggregate			= True
pyperfstore_aggregate_maxpoints	= 500
pyperfstore_aggregate_method	= "MAX"
try:
	pyperfstore_aggregate			= config.getboolean('pyperfstore', "aggregate")
	pyperfstore_aggregate_maxpoints	= config.getint('pyperfstore', "aggregate_maxpoints")
	pyperfstore_aggregate_method	= config.get('pyperfstore', "aggregate_method")
except:
	pass
	
logger.debug(" + pyperfstore_aggregate: %s" % pyperfstore_aggregate)
logger.debug(" + pyperfstore_aggregate_maxpoints: %s" % pyperfstore_aggregate_maxpoints)
logger.debug(" + pyperfstore_aggregate_method: %s" % pyperfstore_aggregate_method)