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


Python ZCmdBase.ZCmdBase类代码示例

本文整理汇总了Python中Products.ZenUtils.ZCmdBase.ZCmdBase的典型用法代码示例。如果您正苦于以下问题:Python ZCmdBase类的具体用法?Python ZCmdBase怎么用?Python ZCmdBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __init__

 def __init__(self, Klass):
     ZCmdBase.__init__(self, False, False, False)
     # It's super annoying to try to figure out how to get the
     # zenhub service to drop into debug mode.  Use the following.
     setLogLevel(logging.DEBUG)
     logging.basicConfig()
     self.service = Klass(self.dmd, self.options.monitor)
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:7,代码来源:ServiceTester.py

示例2: __init__

    def __init__(self, *args, **kwargs):
        ZCmdBase.__init__(self, *args, **kwargs)
        self.defaults = {}

        self.collectorNames = self.dmd.Monitors.getPerformanceMonitorNames()

        self.loader = self.dmd.DeviceLoader.loadDevice

        self.fqdn = socket.getfqdn()
        self.baseEvent = dict(
            device=self.fqdn,
            component='',
            agent='zenbatchload',
            monitor='localhost',
            manager=self.fqdn,
            severity=SEVERITY_ERROR,
            # Note: Change_Add events get sent to history by the event class' Zen property
            eventClass=Change_Add,
        )

        # Create the list of options we want people to know about
        self.loader_args = dict.fromkeys( self.loader.func_code.co_varnames )
        unsupportable_args = [
            'REQUEST', 'device', 'self', 'xmlrpc', 'e', 'handler',
        ]
        for opt in unsupportable_args:
            if opt in self.loader_args:
                del self.loader_args[opt]
开发者ID:SteelHouseLabs,项目名称:zenoss-prodbin,代码行数:28,代码来源:BatchDeviceLoader.py

示例3: buildOptions

    def buildOptions(self):
        """
        Add our command-line options to the basics
        """
        ZCmdBase.buildOptions(self)

        self.parser.add_option('--root',
             dest = "root", default = "",
             help = "Set the root Device Path to dump (eg: /Devices/Servers "
                    "or /Devices/Network/Cisco/Nexus; default: /Devices)")

        self.parser.add_option('-o', '--outFile',
             dest = 'outFile', default = sys.__stdout__,
             help = "Specify file to which zenbatchdump will write output")

        self.parser.add_option('--regex',
             dest = 'regex', default = '.*',
             help = "Specify include filter for device objects")

        self.parser.add_option('--prune',
             dest = 'prune', default = False,
             action = 'store_true',
             help = "Should DeviceClasses only be dumped if part of root path")

        self.parser.add_option('--allzprops',
             dest = 'allzprops', default = False,
             action = 'store_true',
             help = "Should z properties (including acquired values) be dumped?")

        self.parser.add_option('--noorganizers',
             dest = 'noorganizers', default = False,
             action = 'store_true',
             help = "Should organizers (device classes, groups, etc) be dumped?")
开发者ID:cparlette,项目名称:ZenossImportExportScripts,代码行数:33,代码来源:BatchDeviceDumper-withZProps2x.py

示例4: buildOptions

    def buildOptions(self):
        """basic options setup sub classes can add more options here"""
        ZCmdBase.buildOptions(self)

        self.parser.add_option("-i", "--infile", dest="infile", help="Input file for import. The default is stdin")
        print "Build option infile"

        self.parser.add_option(
            "-x",
            "--commitCount",
            dest="commitCount",
            default=20,
            type="int",
            help="How many lines should be loaded before a database commit",
        )

        self.parser.add_option(
            "--noindex",
            dest="noindex",
            action="store_true",
            default=False,
            help="Do not try to index data that was just loaded",
        )

        self.parser.add_option(
            "-n",
            "--noCommit",
            dest="noCommit",
            action="store_true",
            default=0,
            help="Do not store changes to the Dmd (for debugging)",
        )
开发者ID:damilare,项目名称:zenoss-prodbin,代码行数:32,代码来源:ImportDevices.py

示例5: __init__

    def __init__(self):
        ZCmdBase.__init__(self)

        self.current = IDLE
        self.currentStart = 0
        self.numCalls = 0
        try:
            self.log.debug("establishing SIGUSR2 signal handler")
            signal.signal(signal.SIGUSR2, self.sighandler_USR2)
        except ValueError:
            # If we get called multiple times, this will generate an exception:
            # ValueError: signal only works in main thread
            # Ignore it as we've already set up the signal handler.
            pass

        self.zem = self.dmd.ZenEventManager
        loadPlugins(self.dmd)
        self.pid = os.getpid()
        self.services = {}
        factory = ReconnectingPBClientFactory()
        self.log.debug("Connecting to %s:%d",
                       self.options.hubhost,
                       self.options.hubport)
        reactor.connectTCP(self.options.hubhost, self.options.hubport, factory)
        self.log.debug("Logging in as %s", self.options.username)
        c = credentials.UsernamePassword(self.options.username,
                                         self.options.password)
        factory.gotPerspective = self.gotPerspective
        def stop(*args):
            reactor.callLater(0, reactor.stop)
        factory.clientConnectionLost = stop
        factory.startLogin(c)
开发者ID:c0ns0le,项目名称:zenoss-4,代码行数:32,代码来源:zenhubworker.py

示例6: buildOptions

 def buildOptions(self):
     """
     Command-line options specific to this command
     """
     ZCmdBase.buildOptions(self)
     self.parser.add_option('-i', '--infile', dest='infile',
                            help='Input file for import. Default is stdin'
                            )
     self.parser.add_option('--noindex', dest='noindex',
                            action='store_true', default=False,
                            help='Do not try to index the freshly loaded objects.'
                            )
     self.parser.add_option('--chunksize', dest='chunk_size',
                            help='Number of objects to commit at a time.',
                            type='int',
                            default=100
                            )
     self.parser.add_option(
         '-n',
         '--noCommit',
         dest='noCommit',
         action='store_true',
         default=0,
         help='Do not store changes to the DMD (ie for debugging purposes)',
         )
开发者ID:bbc,项目名称:zenoss-prodbin,代码行数:25,代码来源:ImportRM.py

示例7: buildOptions

    def buildOptions(self):
        """
        Add our command-line options to the basics
        """
        ZCmdBase.buildOptions(self)

        self.parser.add_option('--show_options',
            dest="show_options", default=False,
            action="store_true",
            help="Show the various options understood by the loader")

        self.parser.add_option('--sample_configs',
            dest="sample_configs", default=False,
            action="store_true",
            help="Show an example configuration file.")

        self.parser.add_option('--showModelOutput',
            dest="showModelOutput", default=True,
            action="store_false",
            help="Show modelling activity")

        self.parser.add_option('--nocommit',
            dest="nocommit", default=False,
            action="store_true",
            help="Don't commit changes to the ZODB. Use for verifying config file.")

        self.parser.add_option('--nomodel',
            dest="nomodel", default=False,
            action="store_true",
            help="Don't model the remote devices. Must be able to commit changes.")
开发者ID:Hackman238,项目名称:ZenPacks.zenoss.Puppet,代码行数:30,代码来源:BatchDeviceLoader.py

示例8: buildOptions

 def buildOptions(self):
     """Options, mostly to find where zenhub lives
     These options should be passed (by file) from zenhub.
     """
     ZCmdBase.buildOptions(self)
     self.parser.add_option('--hubhost',
                            dest='hubhost',
                            default='localhost',
                            help="Host to use for connecting to ZenHub")
     self.parser.add_option('--hubport',
                            dest='hubport',
                            type='int',
                            help="Port to use for connecting to ZenHub",
                            default=PB_PORT)
     self.parser.add_option('--username',
                            dest='username',
                            help="Login name to use when connecting to ZenHub",
                            default='zenoss')
     self.parser.add_option('--password',
                            dest='password',
                            help="password to use when connecting to ZenHub",
                            default='zenoss')
     self.parser.add_option('--calllimit',
                            dest='calllimit',
                            type='int',
                            help="Maximum number of remote calls before restarting worker",
                            default=200)
开发者ID:c0ns0le,项目名称:zenoss-4,代码行数:27,代码来源:zenhubworker.py

示例9: buildOptions

 def buildOptions(self):
     """Add optparse options to the options parser."""
     ZCmdBase.buildOptions(self)
     self.parser.add_option(
         '--hubhost', dest='hubhost', default='localhost',
         help="Host to use for connecting to ZenHub",
     )
     self.parser.add_option(
         '--hubport', dest='hubport', type='int', default=PB_PORT,
         help="Port to use for connecting to ZenHub",
     )
     self.parser.add_option(
         '--hubusername', dest='hubusername', default='admin',
         help="Login name to use when connecting to ZenHub",
     )
     self.parser.add_option(
         '--hubpassword', dest='hubpassword', default='zenoss',
         help="password to use when connecting to ZenHub",
     )
     self.parser.add_option(
         '--call-limit', dest='call_limit', type='int', default=200,
         help="Maximum number of remote calls before restarting worker",
     )
     self.parser.add_option(
         '--profiling', dest='profiling',
         action='store_true', default=False, help="Run with profiling on",
     )
     self.parser.add_option(
         '--monitor', dest='monitor', default='localhost',
         help='Name of the performance monitor this hub runs on',
     )
     self.parser.add_option(
         '--workerid', dest='workerid', type='int', default=0,
         help=SUPPRESS_HELP,
     )
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:35,代码来源:zenhubworker.py

示例10: buildOptions

 def buildOptions(self):
     ZCmdBase.buildOptions(self)
     self.parser.add_option('--commit',
                            dest="commit",
                            action='store_true',
                            default=False,
                            help="Commit changes to the database")
     self.parser.add_option('--name',
                            dest="name",
                            default='Test',
                            help="Root name for test devices, etc.")
     self.parser.add_option('--repeat',
                            dest="repeat",
                            type="int",
                            default=1,
                            help="Number of devices to create")
     self.parser.add_option('--everywhere',
                            dest="everywhere",
                            default=False,
                            action='store_true',
                            help="Create device(s) for every existing"
                                 " event class")
     self.parser.add_option('--onlyleafclasses',
                            dest="onlyleafclasses",
                            default=False,
                            action='store_true',
                            help="If --everywhere then only create devices"
                                 " on leaf nodes of the device class tree.")
开发者ID:SteelHouseLabs,项目名称:zenoss-prodbin,代码行数:28,代码来源:devicePopulator.py

示例11: __init__

 def __init__(self):
     """
     Initializer that creates an output file, or if nothing is specified
     with the command-line option --outfile, sends to stdout.
     """
     ZCmdBase.__init__(self)
     if not self.options.outfile:
         self.outfile = sys.stdout
     else:
         self.outfile = open(self.options.outfile, 'w')
开发者ID:SteelHouseLabs,项目名称:zenoss-prodbin,代码行数:10,代码来源:ExportRM.py

示例12: buildOptions

 def buildOptions(self):
     ZCmdBase.buildOptions(self)
     self.parser.add_option('-f', '--force', dest='force', 
                            action='store_true', default=0,
                            help="Load all reports, overwriting any existing reports.")
     self.parser.add_option('-d', '--dir', dest='dir',
                            default="reports",
                            help="Directory from which to load reports: default '%default'")
     self.parser.add_option('-p', '--zenpack', dest='zenpack',
                            default='',
                            help="ZenPack from which to load reports")
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:11,代码来源:ReportLoader.py

示例13: __init__

    def __init__(self, noopts=0, app=None, keeproot=False):
        """
        Initializer

        @param noopts: don't use sys.argv for command-line options
        @type noopts: boolean
        @param app: app
        @type app: object
        @param keeproot: keeproot
        @type keeproot: boolean
        """
        ZCmdBase.__init__(self, noopts, app, keeproot)
        ContentHandler.__init__(self)
开发者ID:bbc,项目名称:zenoss-prodbin,代码行数:13,代码来源:ImportRM.py

示例14: buildOptions

    def buildOptions(self):
        ZCmdBase.buildOptions(self)
        self.parser.add_option('-x', '--commitCount',
                    dest='commitCount',
                    default=20,
                    type="int",
                    help='how many lines should be loaded before commit')

        self.parser.add_option('-n', '--noCommit',
                    dest='noCommit',
                    action="store_true",
                    default=0,
                    help='Do not store changes to the Dmd (for debugging)')
开发者ID:SteelHouseLabs,项目名称:zenoss-prodbin,代码行数:13,代码来源:FixIps.py

示例15: buildOptions

    def buildOptions(self):
        """
        Command-line options setup
        """
        ZCmdBase.buildOptions(self)

        self.parser.add_option('-o', '--outfile',
                    dest="outfile",
                    help="Output file for exporting XML objects. Default is stdout")

        self.parser.add_option('--ignore', action="append",
                    dest="ignorerels", default=[],
                    help="Relations that should be ignored.  Every relation to" + \
               " ignore must be specified with a separate --ignorerels option." )
开发者ID:SteelHouseLabs,项目名称:zenoss-prodbin,代码行数:14,代码来源:ExportRM.py


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