70 lines
2.4 KiB
Python
Executable file
70 lines
2.4 KiB
Python
Executable file
#!/usr/bin/python3 -d
|
|
|
|
"""
|
|
This file is part of Linspector (https://linspector.org/)
|
|
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is furnished
|
|
to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice (including the next
|
|
paragraph) shall be included in all copies or substantial portions of the
|
|
Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
|
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
|
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
"""
|
|
|
|
import argparse
|
|
import sys
|
|
|
|
from logging import getLogger
|
|
|
|
from linspector.core.configuration import Configuration
|
|
from linspector.core.environment import Environment
|
|
from linspector.core.linspector import Linspector
|
|
|
|
__version__ = '0.1'
|
|
__author__ = 'Johannes Findeisen <you@hanez.org>'
|
|
|
|
logger = getLogger('linspector')
|
|
|
|
|
|
def parse_args():
|
|
parser = argparse.ArgumentParser(
|
|
description='linspector is a infrastructure monitoring daemon and toolchain.',
|
|
epilog='author: ' + __author__,
|
|
prog='linspector')
|
|
|
|
parser.add_argument('configuration_path', metavar='CONFIGURATION_PATH',
|
|
help='the configuration path to use')
|
|
|
|
parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + str(__version__))
|
|
|
|
return parser.parse_args()
|
|
|
|
|
|
def main():
|
|
args = parse_args()
|
|
|
|
try:
|
|
configuration = Configuration(args.configuration_path)
|
|
configuration.dump_to_ini()
|
|
except Exception as err:
|
|
logger.error(str('[uplink] configuration error: {0}'.format(err)))
|
|
sys.exit(1)
|
|
|
|
environment = Environment(configuration)
|
|
linspector = Linspector(configuration, environment)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|