Switched from JSON to ini files for configuration, lots of code adds, refactoring and even many design changes.
This commit is contained in:
parent
1797c37a1d
commit
779c2f0b48
58 changed files with 1227 additions and 649 deletions
65
bin/monipy
65
bin/monipy
|
|
@ -1,65 +0,0 @@
|
|||
#!/usr/bin/python3 -d
|
||||
|
||||
# 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
|
||||
|
||||
from logging import getLogger
|
||||
#from monipy.configuration import Configuration
|
||||
#from monipy.environment import Environment
|
||||
#from monipy.monipy import Monipy
|
||||
|
||||
"""
|
||||
According to: https://wiki.unixpeople.org/linux_kernel_version_numbering
|
||||
MAJOR.FEATURE.MINOR.FIXES
|
||||
MAJOR changes can change the API. The lesser, the better.
|
||||
FEATURE changes can, but should not break the API. New features are placed here. It expects a
|
||||
complete documentation.
|
||||
MINOR changes are "just-in-time" changes or small enhancements which should not affect the
|
||||
documentation.
|
||||
FIXES should never affect anything else then stability or security.
|
||||
"""
|
||||
__version__ = '0.1'
|
||||
__author__ = 'Johannes Findeisen <you@hanez.org>'
|
||||
|
||||
logger = getLogger('monipy')
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(
|
||||
description='monipy is a client for the monipyd infrastructure monitoring daemon.',
|
||||
epilog='author: ' + __author__,
|
||||
prog='monipy')
|
||||
|
||||
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()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
65
bin/monipyd
65
bin/monipyd
|
|
@ -1,46 +1,40 @@
|
|||
#!/usr/bin/python3 -d
|
||||
|
||||
# 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.
|
||||
"""
|
||||
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 monipy.configuration import Configuration
|
||||
from monipy.environment import Environment
|
||||
from monipy.monipyd import Monipyd
|
||||
|
||||
"""
|
||||
According to: https://wiki.unixpeople.org/linux_kernel_version_numbering
|
||||
MAJOR.FEATURE.MINOR.FIXES
|
||||
MAJOR changes can change the API. The lesser, the better.
|
||||
FEATURE changes can, but should not break the API. New features are placed here. It expects a
|
||||
complete documentation.
|
||||
MINOR changes are "just-in-time" changes or small enhancements which should not affect the
|
||||
documentation.
|
||||
FIXES should never affect anything else then stability or security.
|
||||
"""
|
||||
__version__ = '0.1'
|
||||
__author__ = 'Johannes Findeisen <you@hanez.org>'
|
||||
|
||||
logger = getLogger('monipy')
|
||||
logger = getLogger('monipyd')
|
||||
|
||||
|
||||
def parse_args():
|
||||
|
|
@ -60,6 +54,17 @@ def 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)
|
||||
|
||||
monipyd = Monipyd(configuration, environment)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue