Esempio n. 1
0
    def get_data(self, **params):
        data = {}
        hostname = params.get('hostname')
        hostuiname = ''
        order_by = params.get('order_by', '1')
        limit = params.get('limit', '50')
        from_date = params.get('from_date',
                               datetime.datetime.now().strftime('%Y-%m-%d'))
        to_date = params.get('to_date',
                             (datetime.datetime.now() +
                              datetime.timedelta(1)).strftime('%Y-%m-%d'))
        no_copy_ddl = params.get('no_copy_ddl', True)
        min_calls = params.get('min_calls', '3')

        if 'show' in params and hostname:
            data = reportdata.getStatStatements(hostname, from_date, to_date,
                                                order_by, limit, no_copy_ddl,
                                                min_calls)
            hostuiname = hosts.getHostUIShortnameByHostname(hostname)
        for d in data:
            d['query_short'] = d['query'][:60].replace('\n', ' ').replace(
                '\t', ' ') + ('...' if len(d['query']) > 60 else '')

        host_names = sorted(hosts.hosts.items(),
                            key=lambda h: h[1]['host_name'])
        return hostname, host_names, hostuiname, data, from_date, to_date, order_by, limit, no_copy_ddl, min_calls
Esempio n. 2
0
    def get_data(self, **params):
        data = []
        uishortname = params.get('uishortname', '')
        order_by = params.get('order_by', '1')
        limit = params.get('limit', '50')
        from_date = params.get('from_date', datetime.datetime.now().strftime('%Y-%m-%d'))
        to_date = params.get('to_date', (datetime.datetime.now() + datetime.timedelta(1)).strftime('%Y-%m-%d'))
        no_copy_ddl = params.get('no_copy_ddl', True)
        min_calls = params.get('min_calls', '3')

        if 'show' in params and uishortname:
            data = reportdata.getStatStatements(uishortname, from_date, to_date, order_by, limit, no_copy_ddl, min_calls)
        for d in data:
            d['query_short'] = d['query'][:60].replace('\n',' ').replace('\t',' ') + ('...' if len(d['query']) > 60 else '')

        uishortnames = hosts.getHostsWithFeatureAsShortnames('statStatementsGatherInterval')
        return uishortname, uishortnames, data, from_date, to_date, order_by, limit, no_copy_ddl, min_calls
Esempio n. 3
0
    def get_data(self, **params):
        data = {}
        hostname = params.get('hostname')
        hostuiname = ''
        order_by = params.get('order_by', '1')
        limit = params.get('limit', '50')
        from_date = params.get('from_date', datetime.datetime.now().strftime('%Y-%m-%d'))
        to_date = params.get('to_date', (datetime.datetime.now() + datetime.timedelta(1)).strftime('%Y-%m-%d'))

        if 'show' in params and hostname:
            data = reportdata.getStatStatements(hostname, from_date, to_date, order_by, limit)
            hostuiname = hosts.getHostUIShortnameByHostname(hostname)
        for d in data:
            d['query_short'] = d['query'][:60].replace('\n',' ').replace('\t',' ') + ('...' if len(d['query']) > 60 else '')

        host_names=sorted(hosts.hosts.items(), key = lambda h : h[1]['host_name'])
        return hostname, host_names, hostuiname, data, from_date, to_date, order_by, limit
Esempio n. 4
0
    def get_data(self, **params):
        data = []
        uishortname = params.get('uishortname', '')
        order_by = params.get('order_by', '1')
        limit = params.get('limit', '50')
        from_date = params.get('from_date',
                               datetime.datetime.now().strftime('%Y-%m-%d'))
        to_date = params.get('to_date',
                             (datetime.datetime.now() +
                              datetime.timedelta(1)).strftime('%Y-%m-%d'))
        no_copy_ddl = params.get('no_copy_ddl', True)
        min_calls = params.get('min_calls', '3')

        if 'show' in params and uishortname:
            data = reportdata.getStatStatements(uishortname, from_date,
                                                to_date, order_by, limit,
                                                no_copy_ddl, min_calls)
        for d in data:
            d['query_short'] = d['query'][:60].replace('\n', ' ').replace(
                '\t', ' ') + ('...' if len(d['query']) > 60 else '')

        uishortnames = hosts.getHostsWithFeatureAsShortnames(
            'statStatementsGatherInterval')
        return uishortname, uishortnames, data, from_date, to_date, order_by, limit, no_copy_ddl, min_calls