Exemplo n.º 1
0
    def getInput(self):
        """
        function: 解析用户输入 
        args: 无
        return:无
        author: 翟鑫瑞
        """
        if self.result['code'] != 300:
            return
        self.product = self.input['product']
        self.monitorName = self.input['monitorname'].strip().replace(' ','')
        self.logPath = self.input['logpath'].strip().replace(' ','')
#        self.hostlist = zmonlib.strToList(self.input['hostlist'])
        self.serviceName = zmonlib.strToList(self.input['serviceName'])
        self.hostName = zmonlib.strToList(self.input['hostName'])
        self.grep = self.input['grep']
        self.grepv = self.input['grep-v']
        self.allfield = zmonlib.strToList(self.input['allfield'], ',')
        self.reList = {}
        self.nodeList = {}
        self.chartList = {}
        for key in self.input.keys():
            if key.startswith('re_name_'):
                re_name = key.replace('re_name_','').strip().replace(' ','')
                self.reList[re_name] = self.input[key]
                logging.debug("regular item : %s  %s\n" % (re_name,self.reList[re_name])) 
            elif key.startswith('node_name_'):
                node_name = key.replace('node_name_','').strip().replace(' ','')
                self.nodeList[node_name] = zmonlib.strToList(self.input[key], ',')
                logging.debug("tree node item : %s  %s\n" % (node_name,self.nodeList[node_name])) 
            elif key.startswith('chart_name_'):
                chart_name = key.replace('chart_name_','').strip().replace(' ','')
                self.chartList[chart_name] = self.input[key]
                logging.debug("tree chart item : %s  %s\n" % (chart_name,self.chartList[chart_name])) 
Exemplo n.º 2
0
 def getInput(self):
     """
     function: 解析用户输入 
     args: 无
     return:无
     author: 翟鑫瑞
     """
     if self.result['code'] != 300:
         return
     self.monitorId = self.input['monitorId']
     self.product = self.input['product']
     self.monitorName = self.input['monitorname'].strip().replace(' ', '')
     self.logPath = self.input['logpath'].strip().replace(' ', '')
     #        self.hostlist = zmonlib.strToList(self.input['hostlist'])
     self.serviceName = zmonlib.strToList(self.input['serviceName'])
     self.hostName = zmonlib.strToList(self.input['hostName'])
     self.grep = self.input['grep']
     self.grepv = self.input['grep-v']
     self.allfield = zmonlib.strToList(self.input['allfield'], ',')
     self.reList = {}
     self.nodeList = {}
     self.chartList = {}
     for key in self.input.keys():
         if key.startswith('re_name_'):
             re_name = key.replace('re_name_', '').strip().replace(' ', '')
             self.reList[re_name] = self.input[key]
             logging.debug("regular item : %s  %s\n" %
                           (re_name, self.reList[re_name]))
         elif key.startswith('node_name_'):
             node_name = key.replace('node_name_',
                                     '').strip().replace(' ', '')
             self.nodeList[node_name] = zmonlib.strToList(
                 self.input[key], ',')
             logging.debug("tree node item : %s  %s\n" %
                           (node_name, self.nodeList[node_name]))
         elif key.startswith('chart_name_'):
             chart_name = key.replace('chart_name_',
                                      '').strip().replace(' ', '')
             self.chartList[chart_name] = self.input[key]
             logging.debug("tree chart item : %s  %s\n" %
                           (chart_name, self.chartList[chart_name]))