本文整理汇总了Python中shinken.objects.module.Module.module_type方法的典型用法代码示例。如果您正苦于以下问题:Python Module.module_type方法的具体用法?Python Module.module_type怎么用?Python Module.module_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shinken.objects.module.Module
的用法示例。
在下文中一共展示了Module.module_type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Module
# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import module_type [as 别名]
#
# This file is used to test reading and processing of config files
#
import os
from shinken_test import unittest, ShinkenTest
from shinken.log import logger
from shinken.objects.module import Module
from shinken.modules import memcache_retention_scheduler
from shinken.modules.memcache_retention_scheduler import get_instance
modconf = Module()
modconf.module_name = "MemcacheRetention"
modconf.module_type = memcache_retention_scheduler.properties['type']
modconf.properties = memcache_retention_scheduler.properties.copy()
class TestConfig(ShinkenTest):
# setUp is inherited from ShinkenTest
def test_memcache_retention(self):
print self.conf.modules
# get our modules
modconf.server = 'localhost'
modconf.port = '11211'
mod = memcache_retention_scheduler.Memcache_retention_scheduler(modconf)
sl = get_instance(mod)
print "Instance", sl
示例2: Module
# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import module_type [as 别名]
import os, sys, string, time
from multiprocessing import Queue
from shinken_test import unittest, ShinkenTest
from shinken.objects.module import Module
from shinken.modulesctx import modulesctx
npcdmod_broker = modulesctx.get_module('npcdmod')
Npcd_broker = npcdmod_broker.Npcd_broker
sys.setcheckinterval(10000)
modconf = Module()
modconf.module_name = "ncpd"
modconf.module_type = npcdmod_broker.properties['type']
modconf.modules = []
modconf.properties = npcdmod_broker.properties.copy()
class TestNpcd(ShinkenTest):
def add(self, b):
self.broks[b.id] = b
def fake_check(self, ref, exit_status, output="OK"):
print "fake", ref
now = time.time()
ref.schedule()
check = ref.actions.pop()
self.sched.add(check) # check is now in sched.checks[]
示例3: Module
# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import module_type [as 别名]
# Special Livestatus module opening since the module rename
#from shinken.modules.livestatus import module as livestatus_broker
livestatus_broker = modulesctx.get_module('livestatus')
LiveStatus_broker = livestatus_broker.LiveStatus_broker
LiveStatus = livestatus_broker.LiveStatus
LiveStatusRegenerator = livestatus_broker.LiveStatusRegenerator
LiveStatusQueryCache = livestatus_broker.LiveStatusQueryCache
Logline = livestatus_broker.Logline
LiveStatusLogStoreMongoDB = modulesctx.get_module('logstore-mongodb').LiveStatusLogStoreMongoDB
LiveStatusLogStoreSqlite = modulesctx.get_module('logstore-sqlite').LiveStatusLogStoreSqlite
livestatus_modconf = Module()
livestatus_modconf.module_name = "livestatus"
livestatus_modconf.module_type = livestatus_broker.properties['type']
livestatus_modconf.properties = livestatus_broker.properties.copy()
class ShinkenModulesTest(ShinkenTest):
def do_load_modules(self):
self.modules_manager.load_and_init()
self.log.log("I correctly loaded the modules: [%s]" % (','.join([inst.get_name() for inst in self.modules_manager.instances])))
def update_broker(self, dodeepcopy=False):
# The brok should be manage in the good order
ids = self.sched.brokers['Default-Broker']['broks'].keys()
示例4: Module
# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import module_type [as 别名]
#
import os
import time
from shinken_test import unittest, ShinkenTest
from shinken.log import logger
from shinken.objects.module import Module
from shinken.modules import pickle_retention_file_scheduler
from shinken.modules.pickle_retention_file_scheduler import get_instance
modconf = Module()
modconf.module_name = "PickleRetention"
modconf.module_type = pickle_retention_file_scheduler.properties['type']
modconf.modules = []
modconf.properties = pickle_retention_file_scheduler.properties.copy()
class TestConfig(ShinkenTest):
#setUp is in shinken_test
#Change ME :)
def test_pickle_retention(self):
print self.conf.modules
now = time.time()
#get our modules
mod = pickle_retention_file_scheduler.Pickle_retention_scheduler(modconf, 'tmp/retention-test.dat')
try :
os.unlink(mod.path)
示例5: Module
# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import module_type [as 别名]
import os, time, platform
from shinken_test import unittest, ShinkenTest
from shinken.objects.module import Module
from shinken.modulesctx import modulesctx
named_pipe = modulesctx.get_module('named_pipe')
Named_Pipe_arbiter = named_pipe.Named_Pipe_arbiter
get_instance = named_pipe.get_instance
modconf = Module()
modconf.module_name = "NamedPipe"
modconf.module_type = named_pipe.properties['type']
modconf.properties = named_pipe.properties.copy()
class TestModuleNamedPipe(ShinkenTest):
# setUp is inherited from ShinkenTest
def test_read_named_pipe(self):
# Ok, windows do not have named pipe, we know...
# cygwin cannot write from two sides at the same time
if os.name == 'nt' or platform.system().startswith('CYGWIN'):
return
now = int(time.time())
示例6: Module
# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import module_type [as 别名]
import os
import copy
from shinken_test import unittest, ShinkenTest
from shinken.daemons.arbiterdaemon import Arbiter
from shinken.objects.module import Module
from shinken.modulesctx import modulesctx
pickle_retention_file_generic = modulesctx.get_module('pickle_retention_file_generic')
get_instance = pickle_retention_file_generic.get_instance
modconf = Module()
modconf.module_name = "PickleRetentionGeneric"
modconf.module_type = pickle_retention_file_generic.properties['type']
modconf.properties = pickle_retention_file_generic.properties.copy()
class TestPickleRetentionArbiter(ShinkenTest):
# setUp is inherited from ShinkenTest
def test_pickle_retention(self):
# get our modules
mod = pickle_retention_file_generic.Pickle_retention_generic(
modconf, 'tmp/retention-test.dat')
try:
os.unlink(mod.path)
except:
pass
示例7: Module
# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import module_type [as 别名]
"""
Test Nagios retention
"""
from shinken_test import unittest, ShinkenTest
from shinken.objects.module import Module
from shinken.modulesctx import modulesctx
nagios_retention_file_scheduler = modulesctx.get_module('retention_nagios')
get_instance = nagios_retention_file_scheduler.get_instance
modconf = Module()
modconf.module_name = "NagiosRetention"
modconf.module_type = nagios_retention_file_scheduler.properties['type']
modconf.properties = nagios_retention_file_scheduler.properties.copy()
class TestNagiosRetention(ShinkenTest):
# setUp is inherited from ShinkenTest
def test_pickle_retention(self):
# get our modules
mod = nagios_retention_file_scheduler.Nagios_retention_scheduler(
modconf, 'etc/module_nagios_retention/retention.dat')
sl = get_instance(mod)
# Hack here :(
sl.properties = {}
sl.properties['to_queue'] = None
示例8: Module
# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import module_type [as 别名]
#
import os
from Queue import Empty
from multiprocessing import Queue, Manager, active_children
from shinken_test import *
from shinken.log import logger
from shinken.objects.module import Module
from shinken.modules.booster_nrpe import module as nrpe_poller
from shinken.modules.booster_nrpe.module import get_instance
from shinken.message import Message
modconf = Module()
modconf.module_name = "NrpePoller"
modconf.module_type = nrpe_poller.properties['type']
modconf.properties = nrpe_poller.properties.copy()
class TestNrpePoller(ShinkenTest):
# Uncomment this is you want to use a specific configuration
# for your test
#def setUp(self):
# self.setup_with_file('etc/nagios_module_hack_cmd_poller_tag.cfg')
def test_nrpe_poller(self):
if os.name == 'nt':
return
mod = nrpe_poller.Nrpe_poller(modconf)
示例9: Module
# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import module_type [as 别名]
# This file is used to test reading and processing of config files
#
import os
from shinken_test import unittest, ShinkenTest
from shinken.log import logger
from shinken.objects.module import Module
from shinken.modules import redis_retention_scheduler
from shinken.modules.redis_retention_scheduler import get_instance
modconf = Module()
modconf.module_name = "RedisRetention"
modconf.module_type = redis_retention_scheduler.properties['type']
modconf.properties = redis_retention_scheduler.properties.copy()
class TestConfig(ShinkenTest):
#setUp is in shinken_test
#Change ME :)
def test_redis_retention(self):
print self.conf.modules
#get our modules
mod = redis_retention_scheduler.Redis_retention_scheduler(modconf, 'localhost')
sl = get_instance(mod)
print "Instance", sl
#Hack here :(
示例10: Module
# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import module_type [as 别名]
"""
Test the named pipe arbiter module.
"""
import os, time, platform
from shinken_test import unittest, ShinkenTest
from shinken.objects.module import Module
from shinken.modules.named_pipe import module as named_pipe
from shinken.modules.named_pipe.module import Named_Pipe_arbiter, get_instance
modconf = Module()
modconf.module_name = "NamedPipe"
modconf.module_type = named_pipe.properties["type"]
modconf.properties = named_pipe.properties.copy()
class TestModuleNamedPipe(ShinkenTest):
# setUp is inherited from ShinkenTest
def test_read_named_pipe(self):
# Ok, windows do not have named pipe, we know...
# cygwin cannot write from two sides at the same time
if os.name == "nt" or platform.system().startswith("CYGWIN"):
return
now = int(time.time())
示例11: Module
# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import module_type [as 别名]
Test Mongodb retention.
"""
from shinken_test import unittest, ShinkenTest
from shinken.objects.module import Module
from shinken.modulesctx import modulesctx
mongodb_retention = modulesctx.get_module('retention_mongodb')
get_instance = mongodb_retention.get_instance
modconf = Module()
modconf.module_name = "MongodbRetention"
modconf.uri = 'mongodb://127.0.0.1:27017'
modconf.database = 'test'
modconf.module_type = mongodb_retention.properties['type']
modconf.properties = mongodb_retention.properties.copy()
class TestMongodbRetention(ShinkenTest):
# setUp is inherited from ShinkenTest
def test_mongodb_retention(self):
# get our modules
sl = mongodb_retention.Mongodb_retention_scheduler(modconf, 'localhost', 'test', '')
# sl = get_instance(mod)
# Hack here :(
sl.properties = {}
sl.properties['to_queue'] = None
sl.init()
示例12: Module
# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import module_type [as 别名]
# Need to use the real time-functions as we are reading timestamps
# from the filesystem.
time.time = original_time_time
time.sleep = original_time_sleep
from shinken.objects.module import Module
from shinken.modulesctx import modulesctx
hot_dependencies_arbiter = modulesctx.get_module('hot_dependencies')
Hot_dependencies_arbiter = hot_dependencies_arbiter.Hot_dependencies_arbiter
get_instance = hot_dependencies_arbiter.get_instance
modconf = Module()
modconf.module_name = "PickleRetention"
modconf.module_type = hot_dependencies_arbiter.properties['type']
modconf.modules = []
modconf.properties = hot_dependencies_arbiter.properties.copy()
try:
import json
except ImportError:
# For old Python version, load
# simple json (it can be hard json?! It's 2 functions guy!)
try:
import simplejson as json
except ImportError:
print "Error: you need the json or simplejson module for this script"
raise SystemExit(0)
示例13: SkipTest
# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import module_type [as 别名]
if not sys.version_info > (2, 5):
if SkipTest:
raise SkipTest("bah, i am 2.4.x")
else:
raise SystemExit(0)
from shinken.objects.module import Module
from shinken.modules import passwd_ui
from shinken.modules.passwd_ui import get_instance
from shinken.log import logger
if sys.version_info > (2, 5):
modconf = Module()
modconf.module_name = "PasswdUI"
modconf.module_type = passwd_ui.properties['type']
modconf.properties = passwd_ui.properties.copy()
class TestPasswdUI(ShinkenTest):
# setUp is inherited from ShinkenTest
def test_check_auth(self):
# get our modules
modconf.passwd = 'libexec/htpasswd.users'
mod = passwd_ui.get_instance(modconf)
sl = get_instance(mod)
# Hack here :(
sl.properties = {}
sl.properties['to_queue'] = None
示例14: Module
# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import module_type [as 别名]
try:
import unittest2 as unittest
except ImportError:
import unittest
from shinken.objects.module import Module
from shinken.message import Message
import booster_nrpe
modconf = Module()
modconf.module_name = "NrpePoller"
modconf.module_type = booster_nrpe.properties['type']
modconf.properties = booster_nrpe.properties.copy()
class NrpePollerTestMixin(object):
def setUp(self):
super(NrpePollerTestMixin, self).setUp()
logger.setLevel(logging.DEBUG)
def _setup_nrpe(self, modconf):
mod = booster_nrpe.Nrpe_poller(modconf)
inst = booster_nrpe.get_instance(mod)
inst.init()
return inst
示例15: SystemExit
# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import module_type [as 别名]
else:
raise SystemExit(0)
from shinken.objects.module import Module
from shinken.modulesctx import modulesctx
passwd_ui = modulesctx.get_module("auth_htpasswd")
get_instance = passwd_ui.get_instance
from shinken.log import logger
if sys.version_info > (2, 5):
modconf = Module()
modconf.module_name = "PasswdUI"
modconf.module_type = passwd_ui.properties["type"]
modconf.properties = passwd_ui.properties.copy()
class TestPasswdUI(ShinkenTest):
# setUp is inherited from ShinkenTest
def test_check_auth(self):
# get our modules
modconf.passwd = "libexec/htpasswd.users"
mod = passwd_ui.get_instance(modconf)
sl = get_instance(mod)
# Hack here :(
sl.properties = {}
sl.properties["to_queue"] = None