-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathorgprobe-daemon
55 lines (44 loc) · 1.69 KB
/
orgprobe-daemon
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python
import argparse
import os
import sys
import configparser
import logging
from orgprobe import run, __version__
parser = argparse.ArgumentParser()
parser.add_argument('--config',
'-c',
default='config.ini',
help='path to config file')
parser.add_argument('--verbose',
'-v',
action='store_true',
help='Verbose operation')
parser.add_argument('--selftest',
action='store_true',
help='Run self-test and exit')
parser.add_argument('--version', '-V',
action='store_true',
help="Report version and exit")
parser.add_argument(dest='profile',
nargs='?',
help='Probe profile name. If unset then defaults to the first '
'probe profile definition in the config file.')
args = parser.parse_args()
logging.basicConfig(
level=logging.DEBUG if args.verbose else logging.INFO,
datefmt='[%Y-%m-%d %H:%M:%S]',
format='%(asctime)s\t%(levelname)s\t%(message)s')
logging.getLogger('urllib3.connectionpool').setLevel(logging.ERROR)
logging.getLogger('pika').setLevel(logging.ERROR)
logging.getLogger('requests.packages.urllib3.connectionpool').setLevel(logging.ERROR)
if args.version:
logging.getLogger().setLevel(logging.FATAL)
print(f"ORGProbe version {__version__}")
sys.exit(0)
config = configparser.ConfigParser(
interpolation=configparser.ExtendedInterpolation()
)
loaded = config.read(args.config)
logging.info("Loaded %s config files from %s", loaded, args.config)
sys.exit(run(config, args.profile, args.selftest))