예제 #1
0
    def pre_run(self):
        self.listened_event_type = ['check', 'selector', 'eue', 'sla', 'log']
        #self.manager = pyperfstore2.manager(logging_level=self.logging_level)
        self.manager = pyperfstore2.manager()

        self.selectors_name = []
        self.last_resolv = 0
예제 #2
0
	def pre_run(self):
		self.listened_event_type = ['check','selector','eue','sla', 'log']
		#self.manager = pyperfstore2.manager(logging_level=self.logging_level)	
		self.manager = pyperfstore2.manager()	
		
		self.selectors_name = []
		self.last_resolv = 0
예제 #3
0
	def pre_run(self):
		self.manager = pyperfstore2.manager(logging_level=logging.INFO)
		self.redis = self.manager.store.redis

		if not self.redis.exists(self.kplan):
			self.build_rotate_plan()

		self.beat()
예제 #4
0
    def test_01_Init(self):
        global manager

        manager = pyperfstore2.manager(
            mongo_collection="unittest_perfdata2", dca_min_length=50, logging_level=logging.DEBUG
        )

        manager.store.drop()
예제 #5
0
    def pre_run(self):
        self.manager = pyperfstore2.manager(logging_level=logging.INFO)
        self.redis = self.manager.store.redis

        if not self.redis.exists(self.kplan):
            self.build_rotate_plan()

        self.beat()
예제 #6
0
    def test_01_Init(self):
        global manager

        manager = pyperfstore2.manager(mongo_collection='unittest_perfdata2',
                                       dca_min_length=50,
                                       logging_level=logging.DEBUG)

        manager.store.drop()
예제 #7
0
    def pre_run(self):
        import logging

        self.manager = pyperfstore2.manager(logging_level=logging.INFO)

        now = int(time.time())
        self.rotate_period = 86400
        self.rotate_time = now - (now % self.rotate_period) + self.rotate_period

        self.logger.info("Next rotate: %s UTC (%s)" % (datetime.utcfromtimestamp(self.rotate_time), self.rotate_time))
예제 #8
0
    def __init__(self, *args, **kargs):
        self.metrics_list = {}
        self.timestamps = {}
        self.records = {}
        self.default_interval = 60

        self.thd_warn_sec_per_evt = 8
        self.thd_crit_sec_per_evt = 10

        self.manager = pyperfstore2.manager(logging_level=logging.INFO)
        cengine.__init__(self, name=NAME, *args, **kargs)
예제 #9
0
	def __init__(self, *args, **kargs):
		self.metrics_list = {}
		self.timestamps = {} 
		self.records = {} 
		self.default_interval = 60

		self.thd_warn_sec_per_evt = 8
		self.thd_crit_sec_per_evt = 10

		self.manager = pyperfstore2.manager(logging_level=logging.INFO)	
		cengine.__init__(self, name=NAME, *args, **kargs)
예제 #10
0
    def pre_run(self):
        import logging
        self.manager = pyperfstore2.manager(logging_level=logging.INFO)

        now = int(time.time())
        self.rotate_period = 86400
        self.rotate_time = now - (now %
                                  self.rotate_period) + self.rotate_period

        self.logger.info(
            'Next rotate: %s UTC (%s)' %
            (datetime.utcfromtimestamp(self.rotate_time), self.rotate_time))
예제 #11
0
    def pre_run(self):
        import logging
        self.manager = pyperfstore2.manager(logging_level=logging.INFO)

        self.internal_amqp = camqp(logging_level=logging.INFO,
                                   logging_name="%s-internal-amqp" % self.name)
        self.internal_amqp.add_queue(queue_name=INTERNAL_QUEUE,
                                     routing_keys=["#"],
                                     callback=self.on_internal_event,
                                     no_ack=True,
                                     exclusive=False,
                                     auto_delete=False)

        self.internal_amqp.start()
예제 #12
0
	def pre_run(self):
		import logging
		self.manager = pyperfstore2.manager(logging_level=logging.INFO)

		self.internal_amqp = camqp(logging_level=logging.INFO, logging_name="%s-internal-amqp" % self.name)
		self.internal_amqp.add_queue(
			queue_name=INTERNAL_QUEUE,
			routing_keys=["#"],
			callback=self.on_internal_event,
			no_ack=True,
			exclusive=False,
			auto_delete=False
		)

		self.internal_amqp.start()
예제 #13
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 = pyperfstore2.manager(logging_level=logging.DEBUG)

        clean()
예제 #14
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 = pyperfstore2.manager(logging_level=logging.DEBUG)

        clean()
예제 #15
0
파일: cps_bench.py 프로젝트: moas/canopsis
#
########################################################

AMQP_HOST = "localhost"

logging.basicConfig(
    level=logging.INFO,
    format='%(asctime)s %(name)s %(levelname)s %(message)s',
)

logger = logging.getLogger("bench")
amqp = camqp()

storage = get_storage(namespace='events',
                      account=caccount(user="******", group="root"))
manager = pyperfstore2.manager(logging_level=logging.INFO)

base_component_event = cevent.forger(
    connector='bench',
    connector_name="engine",
    event_type="check",
    source_type="component",
    component="component-",
    state=0,
    state_type=1,
    output="Output",
    long_output="",
    #perf_data =			None,
    perf_data_array=[{
        'metric': 'metric1',
        'value': 0.25,
예제 #16
0
파일: manager.py 프로젝트: Anhmike/canopsis
def rotate_process(_ids):
	raise('TODO')
	import pyperfstore2
	manager = pyperfstore2.manager()
예제 #17
0
#
#   Configuration
#
########################################################

AMQP_HOST = "localhost"

logging.basicConfig(level=logging.INFO,
                    format='%(asctime)s %(name)s %(levelname)s %(message)s',
                    )

logger = logging.getLogger("bench")
amqp = camqp()

storage = get_storage(namespace='events', account=caccount(user="******", group="root"))
manager = pyperfstore2.manager(logging_level=logging.INFO)

base_component_event = cevent.forger(
					connector =			'bench',
					connector_name =	"engine",
					event_type =		"check",
					source_type =		"component",
					component =			"component-",
					state =				0,
					state_type =		1,
					output =			"Output",
					long_output =		"",
					#perf_data =			None,
					perf_data_array =	[
						{'metric': 'metric1', 'value': 0.25, 'unit': None, 'min': None, 'max': None, 'warn': None, 'crit': None, 'type': 'GAUGE' },
						{'metric': 'metric2',   'value': 0.16, 'unit': None, 'min': None, 'max': None, 'warn': None, 'crit': None, 'type': 'GAUGE' },
예제 #18
0
def rotate_process(_ids):
    import pyperfstore2
    manager = pyperfstore2.manager()

    for _id in _ids:
        manager.rotate(_id=_id)
예제 #19
0
파일: sla.py 프로젝트: moas/canopsis
 def pre_run(self):
     self.storage = get_storage(namespace='object',
                                account=caccount(user="******", group="root"))
     self.manager = pyperfstore2.manager(logging_level=self.logging_level)
     self.beat()
예제 #20
0
파일: bench.py 프로젝트: EzanLTD/canopsis
import random
import logging


logging.basicConfig(level=logging.INFO,
	format='%(name)s %(levelname)s %(message)s',
)


import pyperfstore2

interval = 300
day = 30

name = 'nagios.Central.check.service.localhost'
manager = pyperfstore2.manager(mongo_collection='bench_perfdata2')
manager.store.drop()

def bench_store(interval=60, duration=60*60*24):
	print "Start Bench ..."
	
	msize = manager.store.size()
	
	# 1 value / 5 min = 8928 values/month = 107136 values/year
	timestamp = int(time.time())
	bench_start = timestamp
	
	nb = duration / interval
	print " + write %s loop" % nb
	
	start = time.time()
예제 #21
0
def rotate(account=None, owner=None):
    my_manager = manager()
    my_manager.rotateAll()
예제 #22
0
파일: perfstore.py 프로젝트: moas/canopsis
def load():
	global manager
	manager = pyperfstore2.manager(logging_level=logging.INFO)
예제 #23
0
#
# Canopsis is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Canopsis.  If not, see <http://www.gnu.org/licenses/>.
# ---------------------------------

import logging
import pyperfstore2

logger = None

manager = pyperfstore2.manager(logging_level=logging.DEBUG)


def init():
    logger.info(" + Drop 'pyperfstore2' collections")
    manager.store.drop()


def update():
    # tweak: rename all 'stat' metrics
    metrics = manager.find(mfilter={"co": "stat", "me": {"$regex": "^cps_.*"}})

    for metric in metrics:
        logger.info(" + Move '%s.%s.%s' to '%s.%s.%s'" %
                    (metric["co"], metric["re"], metric["me"], metric["re"],
                     "selector", metric["me"]))
예제 #24
0
파일: perfstore2.py 프로젝트: moas/canopsis
 def pre_run(self):
     import logging
     self.manager = pyperfstore2.manager(logging_level=logging.INFO)
예제 #25
0
#
# Canopsis is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Canopsis.  If not, see <http://www.gnu.org/licenses/>.
# ---------------------------------

import logging
import pyperfstore2

logger = None

manager = pyperfstore2.manager(logging_level=logging.DEBUG)

def init():
	logger.info(" + Drop 'pyperfstore2' collections")
	manager.store.drop()

def update():
	# tweak: rename all 'stat' metrics
	metrics = manager.find(mfilter={"co": "stat", "me": {"$regex": "^cps_.*"}})

	for metric in metrics:
		logger.info(" + Move '%s.%s.%s' to '%s.%s.%s'" % (metric["co"], metric["re"], metric["me"], metric["re"], "selector", metric["me"]))
		
		old_id = metric["_id"]
		del metric["_id"]
예제 #26
0
def load():
    global logger
    global manager
    manager = pyperfstore2.manager(logging_level='DEBUG')
예제 #27
0
파일: manager.py 프로젝트: linkdd/canopsis
def rotate_process(_ids):
	import pyperfstore2
	manager = pyperfstore2.manager()

	for _id in _ids:
		manager.rotate(_id=_id)
예제 #28
0
	def pre_run(self):
		self.storage = get_storage(namespace='object', account=caccount(user="******", group="root"))
		self.manager = pyperfstore2.manager(logging_level=self.logging_level)
		self.load_consolidation()
		self.beat()
예제 #29
0
	def pre_run(self):
		self.storage = get_storage(namespace='object', account=caccount(user="******", group="root"))
		self.manager = pyperfstore2.manager(logging_level=logging.INFO)
				
		self.beat()
예제 #30
0
	def pre_run(self):
		import logging
		self.manager = pyperfstore2.manager(logging_level=logging.INFO)
예제 #31
0
def load():
	global logger
	global manager
	manager = pyperfstore2.manager(logging_level='DEBUG')
예제 #32
0
def rotate(account=None, owner=None):
	manager = pyperfstore2.manager()
	manager.rotateAll()