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
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
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()
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()
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()
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))
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)
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))
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()
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()
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()
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()
# ######################################################## 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,
def rotate_process(_ids): raise('TODO') import pyperfstore2 manager = pyperfstore2.manager()
# # 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' },
def rotate_process(_ids): import pyperfstore2 manager = pyperfstore2.manager() for _id in _ids: manager.rotate(_id=_id)
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()
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()
def rotate(account=None, owner=None): my_manager = manager() my_manager.rotateAll()
def load(): global manager manager = pyperfstore2.manager(logging_level=logging.INFO)
# # 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"]))
def pre_run(self): import logging self.manager = pyperfstore2.manager(logging_level=logging.INFO)
# # 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"]
def load(): global logger global manager manager = pyperfstore2.manager(logging_level='DEBUG')
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()
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()
def rotate(account=None, owner=None): manager = pyperfstore2.manager() manager.rotateAll()