]> git.ipfire.org Git - collecty.git/blob - collectyd
colletcyd: Some code cleanup and commenting.
[collecty.git] / collectyd
1 #!/usr/bin/python
2
3 import os
4 import sys
5
6 import optparse
7
8 import collecty
9
10 c = collecty.Collecty()
11
12 # Parse command line options
13 op = optparse.OptionParser(usage="usage: %prog [options] <configfile1> ... <configfileN>")
14 op.add_option("-d", "--daemon", action="store_true", default=False,
15 help="Run as a daemon in background.")
16 (options, configfiles) = op.parse_args()
17
18 if configfiles:
19 for file in configfiles:
20 c.read_config(file)
21 else:
22 # Load default config file
23 c.read_config("/etc/collecty/collecty.conf")
24
25 if not c.instances:
26 print >>sys.stderr, "Error: No instances were configured."
27 sys.exit(1)
28
29 c.run()