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


Python ZenScriptBase.ZenScriptBase类代码示例

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


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

示例1: buildOptions

 def buildOptions(self):
     """
     add some additional options
     """
     ZenScriptBase.buildOptions(self)
     
     self.parser.add_option('--mode',
                 dest="mode", default=None,
                 help="Specify operating mode:\neval = evaluate an existing "\
                     "threshold against a specific device\ntest = create a " \
                     "test threshold and evaluate it against a device")
     self.parser.add_option('--device', "-d",
                 dest="device", type="str", default=None, 
                 help="Specfiy a device for threshold evaluation (eval & test mode)")
     self.parser.add_option('--template_path', '-p', type="str",
                 dest="tpath", default=None,
                 help="Specify the path to a template path i.e. /zport/dmd/Devices/rrdTemplates/Device (eval mode)")
     self.parser.add_option('--min', '-i', type="str",
                 dest="min", default=None,
                 help="Specify a minimum value to be used for the threshold (eval mode)")
     self.parser.add_option('--max', '-a', type="str",
                 dest="max", default=None,
                 help="Specify a maximum value to be used for the threshold (eval mode)")
     self.parser.add_option('--value', type="str",
                 dest="value", default=None,
                 help="Specify an artificial value to use for threshold evaluation (eval mode)")
开发者ID:cholden,项目名称:ZenossScripts,代码行数:26,代码来源:thresholdtester.py

示例2: buildOptions

 def buildOptions(self):
     ZenScriptBase.buildOptions(self)
     self.parser.add_option("-f", "--file", dest="filename",
                            help="write json to FILE", metavar="FILE")
     self.parser.add_option("-z", "--zenpack", dest="zenpack",
                            help="ZenPack to Dump Templates From",
                            metavar="ZenPack")
开发者ID:SteelHouseLabs,项目名称:ZenPackGenerator,代码行数:7,代码来源:ExportTemplateToJson.py

示例3: buildOptions

 def buildOptions(self):
     ZenScriptBase.buildOptions(self)
     self.parser.add_option('--collector', dest='collectorId', default='localhost', metavar='COLLECTOR_ID',
         help="Name of specific collector on which to run the command")
     self.parser.add_option('--timeout', dest='timeout',
                        default=60, type="int",
                        help="Kill the process after this many seconds.")
开发者ID:bbc,项目名称:zenoss-prodbin,代码行数:7,代码来源:RunCommand.py

示例4: processResults

  def processResults(self, cmd, result):
    """
    Process the results for command "lsdrive -delim :".
    """
    update = False
    datapointMap = dict([(dp.id, dp) for dp in cmd.points])
    devname = cmd.deviceConfig.device

    # returned from datasource component field with ${here/id}
    componentid = cmd.component

    rresult = Utils.cmdParser(cmd.result.output,'id','DRIVE_ID')
    # specific component device
    rresult = rresult[componentid] 


    # drive status raise event
    if rresult['status']!='online': 
      result.events.append(Utils.getEvent(cmd,"Drive status not online",clear=False))
      update = True

    # drive error sequence number
    if rresult['error_sequence_number']!='': 
      result.events.append(Utils.getEvent(cmd,"Drive error sequence number: "+rresult['error_sequence_number'],clear=False))
      update = True
  
    # update current component if needed
    if update:
      scriptbase = ZenScriptBase(noopts = 1, connect = True)
      device = scriptbase.findDevice(devname)
      component = device.drives.findObjectsById(componentid)[0]
      component.drive_status=rresult['status']
      component.error_sequence_number=rresult['error_sequence_number']
      commit()
开发者ID:emcrispim,项目名称:ZenPacks.community.IBMV7000,代码行数:34,代码来源:parserDrive.py

示例5: buildOptions

 def buildOptions(self):
     self.parser.add_option('--step',
                            action='append',
                            dest="steps",
                            help="Run the specified step.  This option "
                                 'can be specified multiple times to run '
                                 'more than one step.')
     # NB: The flag for this setting indicates a false value for the setting.
     self.parser.add_option('--dont-commit',
                            dest="commit",
                            action='store_false',
                            default=True,
                            help="Don't commit changes to the database")
     self.parser.add_option('--list',
                            action='store_true',
                            default=False,
                            dest="list",
                            help="List all the steps")
     self.parser.add_option('--level',
                            dest="level",
                            type='string',
                            default=None,
                            help="Run the steps for the specified level "
                                 ' and above.')
     self.parser.add_option('--newer',
                             dest='newer',
                             action='store_true',
                             default=False,
                             help='Only run steps with versions higher '
                                     'than the current database version.'
                                     'Usually if there are no newer '
                                     'migrate steps the current steps '
                                     'are rerun.')
     ZenScriptBase.buildOptions(self)
开发者ID:SteelHouseLabs,项目名称:zenoss-prodbin,代码行数:34,代码来源:Migrate.py

示例6: buildOptions

 def buildOptions(self):
     ZenScriptBase.buildOptions(self)
     self.parser.add_option(
         "--age", dest="age", type="int", default=1, help="Number of days old to consider fresh (default=1)"
     )
     self.parser.add_option(
         "--all",
         dest="all",
         action="store_true",
         default=False,
         help="Check all data points. Not just ones used in graphs",
     )
     self.parser.add_option(
         "--pathcache",
         dest="pathcache",
         action="store_true",
         default=False,
         help="Cache the full list of RRD file paths in the model",
     )
     self.parser.add_option(
         "--devicesonly",
         dest="devicesonly",
         action="store_true",
         default=False,
         help="Only check for device files. Not components",
     )
     self.parser.add_option("--collector", dest="collector", help="Name of specific collector to check (optional)")
     self.parser.add_option("-o", "--file", dest="file", help="Output filename")
     self.parser.add_option(
         "--sendevent",
         dest="sendevent",
         action="store_true",
         default=False,
         help="Send an event with statistics per collector",
     )
开发者ID:jpeacock-zenoss,项目名称:zenoss-prodbin,代码行数:35,代码来源:ZenCheckRRD.py

示例7: __init__

 def __init__(self, connect=False):
     ZenScriptBase.__init__(self)
     if connect is True:
         self.connect()
     self.status = 0
     self.message = ""
     self.exitStatusMap = {"OK": 0, "WARNING": 1, "CRITICAL": 2}
开发者ID:j053ph4,项目名称:ZenPacks.community.ConstructionKit,代码行数:7,代码来源:CustomCheckCommand.py

示例8: __init__

    def __init__(self):
        """
        create object and and coonect to the db
        """
        ZenScriptBase.__init__(self, connect=True)
        self.log = logging.getLogger("EventModder")
	    self.api = getFacade("event")
开发者ID:cholden,项目名称:ZenossScripts,代码行数:7,代码来源:eventQueryAndLowerSevertiy.py

示例9: buildOptions

 def buildOptions(self):
     ZenScriptBase.buildOptions(self)
     self.parser.add_option('--url', '-u',
                            dest='url',
                            default=None,
                            help='URL of report to send')
     self.parser.add_option('--reportFileType', '-r',
                            dest='reportFileType',
                            default='PDF',
                            help='report file type (%s)' % "|".join(gValidReportFileTypes))
     self.parser.add_option('--user', '-U',
                            dest='user',
                            default='admin',
                            help="User to log into Zenoss")
     self.parser.add_option('--passwd', '-p',
                            dest='passwd',
                            help="Password to log into Zenoss")
     self.parser.add_option('--address', '-a',
                            dest='addresses',
                            default=[],
                            action='append',
                            help='Email address destination '
                            '(may be given more than once).  Default value'
                            "comes from the user's profile.")
     self.parser.add_option('--subject', '-s',
                            dest='subject',
                            default='',
                            help='Subject line for email message.'
                            'Default value is the title of the html page.')
     self.parser.add_option('--from', '-f',
                            dest='fromAddress',
                            default='[email protected]',
                            help='Origination address')
开发者ID:bbc,项目名称:zenoss-prodbin,代码行数:33,代码来源:ReportMail.py

示例10: getmysqlcreds

def getmysqlcreds():
    """Fetch the mysql creds from the object database and store them
    in the global file for use in later commands.

    returns True on success, False on failure
    """
    pids = os.popen('pgrep -f zeo.py').read().split('\n')
    pids = [int(p) for p in pids if p]
    if len(pids) < 1:
        log.warning('zeo is not running')
        return False
    log.debug("Fetching mysql credentials")
    mysqlpass = 'zenoss'
    mysqluser = 'zenoss'
    mysqlport = '3306'
    mysqlhost = 'localhost'
    sys.path.insert(0, os.path.join(zenhome, 'lib/python'))
    try:
        import Globals
        from Products.ZenUtils.ZenScriptBase import ZenScriptBase
        zsb = ZenScriptBase(noopts=True, connect=True)
        zsb.getDataRoot()
        dmd = zsb.dmd
        mysqlpass = dmd.ZenEventManager.password
        mysqluser = dmd.ZenEventManager.username
        mysqlport = dmd.ZenEventManager.port
        mysqlhost = dmd.ZenEventManager.host
    except Exception, ex:
        log.exception("Unable to open the object database for "
                      "mysql credentials")
开发者ID:cparlette,项目名称:ZenossImportExportScripts,代码行数:30,代码来源:zendiag.py

示例11: buildOptions

 def buildOptions(self):
     self.parser.add_option('--list',
                            dest='list',
                            default=False,
                            action='store_true',
                            help='List the names of ZenPack-supplied daemons'
                            )
     ZenScriptBase.buildOptions(self)
开发者ID:SteelHouseLabs,项目名称:zenoss-prodbin,代码行数:8,代码来源:ZenPackDaemons.py

示例12: __init__

 def __init__(self):
     ZenScriptBase.__init__(self, connect=True)
     self.profiles = self.dmd.Profiles
     self.rulesets = self.profiles.getAllRulesets()
     self.rulesetfile = 'profiles-rulesets-export.txt'
     self.rulefile = 'profiles-rules-export.txt'
     self.exportrulesets = []
     self.exportrules = []
开发者ID:j053ph4,项目名称:ZenPacks.community.zenAppProfiler,代码行数:8,代码来源:profiles-export.py

示例13: parseOptions

    def parseOptions(self):
        ZenScriptBase.parseOptions(self)
        if not self.options.filename:
            print "Required option output file is missing. Exiting..."
            sys.exit(1)

        if not self.options.zenpack:
            print "Required option source zenpack is missing. Exiting..."
            sys.exit(1)
开发者ID:SteelHouseLabs,项目名称:ZenPackGenerator,代码行数:9,代码来源:ExportObjects.py

示例14: buildOptions

 def buildOptions(self):
     self.parser.add_option('--newid',
                            dest='newid',
                            default=None,
                            help='Specify a new name for this ZenPack. '
                             'It must contain at least three package names '
                             'separated by periods, the first one being '
                             '"ZenPacks"')
     ZenScriptBase.buildOptions(self)
开发者ID:SteelHouseLabs,项目名称:zenoss-prodbin,代码行数:9,代码来源:EggifyZenPack.py

示例15: buildOptions

 def buildOptions(self):
     ZenScriptBase.buildOptions(self)
     self.parser.add_option('--collector', dest='collector',
         help="Name of specific collector on which to run the command")
     self.parser.add_option('--timeout', dest='timeout',
                        default=60, type="int",
                        help="Kill the process after this many seconds.")
     self.parser.add_option('-n', '--useprefix', action='store_false',
                            dest='useprefix', default=True,
                        help="Prefix the collector name for remote servers")
开发者ID:SteelHouseLabs,项目名称:zenoss-prodbin,代码行数:10,代码来源:RunCommand.py


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