def test_basic_config():
        """
            Test basic function for grouping tail.
        """
        from pretaweb.collectd.groupingtail.plugin import configure, read
        config = CollectdConfig('root', (), (
            ('File', more_small_log_file, (
                ('Instance', 'my_stats', ()),
                ('GroupBy', group_by, ()),
                ('Match', (), (
                    ('Instance', 'requests', ()),
                    ('Regex', '.', ()),
                    ('DSType', 'CounterInc', ()),
                    ('Type', 'counter', ()),
                )),
                ('Match', (), (
                    ('Instance', 'tx', ()),
                    ('Regex', '^\\S+ \\S+ ([0-9]+)', ()),
                    ('DSType', 'CounterSumInt', ()),
                    ('Type', 'counter', ()),
                )),
            )),
        ))

        configure(config)
        read()
    def test_counter_sum_config():
        from pretaweb.collectd.groupingtail.plugin import configure, read
        new_log = tempfile.NamedTemporaryFile()

        config = CollectdConfig('root', (), (
            ('File', new_log.name, (
                ('Instance', 'my_stats', ()),
                ('GroupBy', group_by, ()),
                ('Match', (), (
                    ('Instance', 'tx', ()),
                    ('Regex', '^\\S+ \\[\\S+ \"[^\"]*\" \"[^\"]*\"[^]]*] \\S+ \\S+ .+ HTTP\\S+ [0-9]+ ([0-9]+) ', ()),
                    ('DSType', 'CounterSumInt', ()),
                    ('Type', 'counter', ()),
                )),
            )),
        ))

        configure(config)
        copy_lines(BASIC_SMALL_LOG_FILE, new_log)

        read()
Пример #3
0
    def test_counter_sum_config():
        from pretaweb.collectd.groupingtail.plugin import configure, read
        new_log = tempfile.NamedTemporaryFile()

        config = CollectdConfig('root', (), (('File', new_log.name, (
            ('Instance', 'my_stats', ()),
            ('GroupBy', group_by, ()),
            ('Match', (), (
                ('Instance', 'tx', ()),
                ('Regex',
                 '^\\S+ \\[\\S+ \"[^\"]*\" \"[^\"]*\"[^]]*] \\S+ \\S+ .+ HTTP\\S+ [0-9]+ ([0-9]+) ',
                 ()),
                ('DSType', 'CounterSumInt', ()),
                ('Type', 'counter', ()),
            )),
        )), ))

        configure(config)
        copy_lines(BASIC_SMALL_LOG_FILE, new_log)

        read()
Пример #4
0
    def test_basic_config():
        """
            Test basic function for grouping tail.
        """
        from pretaweb.collectd.groupingtail.plugin import configure, read
        config = CollectdConfig('root', (), (('File', more_small_log_file, (
            ('Instance', 'my_stats', ()),
            ('GroupBy', group_by, ()),
            ('Match', (), (
                ('Instance', 'requests', ()),
                ('Regex', '.', ()),
                ('DSType', 'CounterInc', ()),
                ('Type', 'counter', ()),
            )),
            ('Match', (), (
                ('Instance', 'tx', ()),
                ('Regex', '^\\S+ \\S+ ([0-9]+)', ()),
                ('DSType', 'CounterSumInt', ()),
                ('Type', 'counter', ()),
            )),
        )), ))

        configure(config)
        read()