summaryrefslogtreecommitdiffstats
path: root/src/sbin/bcfg2-report-collector
blob: f7d922d13d2295551deed06a37d314081651d970 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python
""" Daemon that runs to collect logs from the LocalFilesystem
Reporting transport object and add them to the Reporting storage
backend """

import sys
import logging
import Bcfg2.Logger
import Bcfg2.Options
import Bcfg2.DBSettings
from Bcfg2.Reporting.Collector import ReportingCollector, ReportingError


def main():
    parser = Bcfg2.Options.get_parser(description="Collect Bcfg2 report data",
                                      components=[ReportingCollector])
    parser.parse()
    logger = logging.getLogger('bcfg2-report-collector')

    # run collector
    try:
        ReportingCollector().run()
    except ReportingError:
        msg = sys.exc_info()[1]
        logger.error(msg)
        raise SystemExit(1)
    except KeyboardInterrupt:
        raise SystemExit(1)


if __name__ == '__main__':
    sys.exit(main())