Пример #1
0
    def index(self, **params):
        data = []
        #data.append({'host_name':'Host1','schema_name':'schema1','table_name':'table1','day':'2013-08-20'})
        #print(tplE.env.globals['hosts'])
        if 'show' in params:
            data = reportdata.getTablePerformanceIssues(
                params['hostname'], params['from'], params['to'])

        interval = {}
        if 'from' in params and 'to' in params:
            interval['from'] = params['from']
            interval['to'] = params['to']
            interval['hostname'] = params['hostname']
        else:
            interval['from'] = (
                datetime.datetime.now() -
                datetime.timedelta(days=3)).strftime('%Y-%m-%d')
            interval['to'] = (datetime.datetime.now()).strftime('%Y-%m-%d')
            interval['hostname'] = 'all'
        table = tplE.env.get_template('perf_tables.html')
        host_names = sorted(hosts.hosts.items(),
                            key=lambda h: h[1]['host_name'])
        return table.render(data=data,
                            interval=interval,
                            host_names=host_names)
Пример #2
0
    def get_data(self, **params):
        data = []
        if 'show' in params:
            data = reportdata.getTablePerformanceIssues(params['hostname'], params['from'], params['to'])
            for d in data:
                d['hostuiname'] = hosts.hostIdToUiShortname(d['host_id'])

        interval = {}
        if 'from' in params and 'to' in params:
            interval['from'] = params['from']
            interval['to'] = params['to']
            interval['hostname'] = params['hostname']
        else:
            interval['from'] = (datetime.datetime.now() - datetime.timedelta(days=3)).strftime('%Y-%m-%d')
            interval['to'] = (datetime.datetime.now()).strftime('%Y-%m-%d')
            interval['hostname'] = 'all'
        host_names = sorted(hosts.hosts.items(), key = lambda h : h[1]['host_name'])
        return data, interval, host_names
Пример #3
0
    def get_data(self, **params):
        data = []
        if 'show' in params:
            data = reportdata.getTablePerformanceIssues(params['hostname'], params['from'], params['to'])
            for d in data:
                d['hostuiname'] = hosts.hostIdToUiShortname(d['host_id'])

        interval = {}
        if 'from' in params and 'to' in params:
            interval['from'] = params['from']
            interval['to'] = params['to']
            interval['hostname'] = params['hostname']
        else:
            interval['from'] = (datetime.datetime.now() - datetime.timedelta(days=3)).strftime('%Y-%m-%d')
            interval['to'] = (datetime.datetime.now()).strftime('%Y-%m-%d')
            interval['hostname'] = 'all'
        host_names = sorted(hosts.hosts.items(), key = lambda h : h[1]['host_name'])
        return data, interval, host_names
Пример #4
0
    def get_data(self, **params):
        data = []
        if 'show' in params:
            uishortname = params.get('uishortname')
            if uishortname == 'all':
                uishortname = None
            data = reportdata.getTablePerformanceIssues(uishortname, params['from'], params['to'])

        interval = {}
        if 'from' in params and 'to' in params:
            interval['from'] = params['from']
            interval['to'] = params['to']
            interval['uishortname'] = params['uishortname']
        else:
            interval['from'] = (datetime.datetime.now() - datetime.timedelta(days=3)).strftime('%Y-%m-%d')
            interval['to'] = (datetime.datetime.now()).strftime('%Y-%m-%d')
            interval['uishortname'] = 'all'

        return data, interval, hosts.getAllHostUinamesSorted()
Пример #5
0
    def index(self,**params):
        data = []
        #data.append({'host_name':'Host1','schema_name':'schema1','table_name':'table1','day':'2013-08-20'})
        #print(tplE.env.globals['hosts'])
        if 'show' in params:            
            data = reportdata.getTablePerformanceIssues(params['hostname'], params['from'], params['to'])

        interval = {}
        if 'from' in params and 'to' in params:
            interval['from'] = params['from']
            interval['to'] = params['to']
            interval['hostname'] = params['hostname']
        else:
            interval['from'] = (datetime.datetime.now() - datetime.timedelta(days=3)).strftime('%Y-%m-%d')
            interval['to'] = (datetime.datetime.now()).strftime('%Y-%m-%d')
            interval['hostname'] = 'all'
        table = tplE.env.get_template('perf_tables.html')
        host_names = sorted(hosts.hosts.items(), key = lambda h : h[1]['host_name'])
        return table.render(data=data, interval=interval, host_names=host_names)
Пример #6
0
    def get_data(self, **params):
        data = []
        if 'show' in params:
            uishortname = params.get('uishortname')
            if uishortname == 'all':
                uishortname = None
            data = reportdata.getTablePerformanceIssues(
                uishortname, params['from'], params['to'])

        interval = {}
        if 'from' in params and 'to' in params:
            interval['from'] = params['from']
            interval['to'] = params['to']
            interval['uishortname'] = params['uishortname']
        else:
            interval['from'] = (
                datetime.datetime.now() -
                datetime.timedelta(days=3)).strftime('%Y-%m-%d')
            interval['to'] = (datetime.datetime.now()).strftime('%Y-%m-%d')
            interval['uishortname'] = 'all'

        return data, interval, hosts.getAllHostUinamesSorted()