当前位置: 首页>>代码示例>>Python>>正文


Python Module.properties方法代码示例

本文整理汇总了Python中shinken.objects.module.Module.properties方法的典型用法代码示例。如果您正苦于以下问题:Python Module.properties方法的具体用法?Python Module.properties怎么用?Python Module.properties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在shinken.objects.module.Module的用法示例。


在下文中一共展示了Module.properties方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Module

# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import properties [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
        # Hack here :(
开发者ID:BaniaHP,项目名称:shinken,代码行数:33,代码来源:test_module_memcache_retention.py

示例2: Module

# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import properties [as 别名]
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[]
        # fake execution
        check.check_time = now
开发者ID:David-,项目名称:shinken,代码行数:32,代码来源:test_npcdmod.py

示例3: Module

# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import properties [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()
        ids.sort()
开发者ID:HubLot,项目名称:shinken,代码行数:33,代码来源:shinken_modules.py

示例4: Module

# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import properties [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)
        except :
            pass
开发者ID:Morkxy,项目名称:shinken,代码行数:33,代码来源:test_module_pickle_retention.py

示例5: Module

# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import properties [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())

        host0 = self.sched.conf.hosts.find_by_name('test_host_0')
开发者ID:David-,项目名称:shinken,代码行数:33,代码来源:test_module_named_pipe_arbiter.py

示例6: Module

# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import properties [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

        sl = get_instance(mod)
开发者ID:David-,项目名称:shinken,代码行数:33,代码来源:test_module_pickle_retention_arbiter.py

示例7: Module

# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import properties [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
        sl.init()
开发者ID:David-,项目名称:shinken,代码行数:33,代码来源:test_module_nagios_retention.py

示例8: Module

# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import properties [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)
开发者ID:Thibautg16,项目名称:shinken,代码行数:31,代码来源:test_modules_nrpe_poller.py

示例9: Module

# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import properties [as 别名]
#

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 :(
        sl.properties = {}
开发者ID:Dabg,项目名称:shinken,代码行数:33,代码来源:test_module_redis_retention.py

示例10: Module

# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import properties [as 别名]
"""

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()
开发者ID:David-,项目名称:shinken,代码行数:32,代码来源:test_module_mongodb_retention.py

示例11: Module

# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import properties [as 别名]
# 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)


class TestModuleHotDep(ShinkenTest):
开发者ID:David-,项目名称:shinken,代码行数:33,代码来源:test_module_hot_dependencies_arbiter.py

示例12: SkipTest

# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import properties [as 别名]
    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
        sl.init()
开发者ID:Denetariko,项目名称:shinken,代码行数:33,代码来源:test_module_passwd_ui.py

示例13: Module

# 需要导入模块: from shinken.objects.module import Module [as 别名]
# 或者: from shinken.objects.module.Module import properties [as 别名]
    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

开发者ID:jfpik,项目名称:mod-booster-nrpe,代码行数:31,代码来源:test_simple.py


注:本文中的shinken.objects.module.Module.properties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。