diff --git a/TODO b/TODO index e69de29..201810a 100644 --- a/TODO +++ b/TODO @@ -0,0 +1,12 @@ +Things to do in no particular order: + +- Implement error handling at all needed places! currently nearly no error handling is done! +- Configure the logger +- Make use of the logger wherever it us useful! and be informative when information really helps debugging the application! +- Multicore support when scheduling jobs with APScheduler +- Parent alerting (escalation) +- Core error alerting to [linspector]->members on internal errors +- Hostgroup parents (example: if the hostgroup "network" is down, don't alert for the hosts in that network) +- Add more services +- Add more tasks e.g. storage in mongodb or mariadb and some more notifications like XMPP and SMS +- Check for all required configuration options and set defaults in services. diff --git a/bin/linspector b/bin/linspector index b4b4b20..b82d862 100755 --- a/bin/linspector +++ b/bin/linspector @@ -1,5 +1,4 @@ #!/usr/bin/python3 -d - """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. @@ -22,11 +21,6 @@ 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. """ - -# TODO: implement error handling at all needed places! currently nearly no error handling is done! -# TODO: make use of the logger wherever it us useful! and be verbose when information really helps -# debugging the application! - import argparse import sys diff --git a/etc/linspector.conf b/etc/linspector.conf index f135d1d..f661a25 100644 --- a/etc/linspector.conf +++ b/etc/linspector.conf @@ -14,10 +14,18 @@ plugins = Lish,HTTPServer ; monitor and the monitor can add tasks to the global settings... need to think about it. ; tasks separated by ','. no whitespaces allowed tasks = SQLite -notification = SMS +notifications = SMS ; maybe the run_mode is obsolete because this will be a daemon but maybe it is useful for one time execution? ; in uplink the available run_modes were cron, daemon and foreground run_mode = cron +; members to send notifications to if something internally in Linspector went wrong. +members = superadmin@example.com,developers@example.com + +; hostgroup parents; if the hostgroup "group1" is down, don't alert for the hosts in group2. see TODO for more +; information. +[hostgroupparents] +; hostgroup group1 is parent of group2 +group1 = group2 ; a flexible way to define groups of hosts which can be used by monitors as target for monitoring for easily monitor ; groups without adding a monitor for each host. for some more information see the "hosts" section in gateway.conf. @@ -29,13 +37,20 @@ group1 = host1,host2,host3 group2 = 192.168.1.1>192.168.1.127 ; add a combination of hosts and ranges group3 = host1,host2,host3,192.168.1.1>192.168.1.127 +; using groups inside groups. but need to take care about recursive dependencies. +group4 = host10,host11,host12,@group3 + +; member groups to define recipients for notifications. see hostgroups for more details. +[membergroups] +admins = admin1@example.com,admin2@example.com,admin3@example.com +developers = hanez@example.com ; just an idea taken from the old Linspector design. not tried but seems a good idea to add global options to monitor ; groups. no idea of an implementation yet. [monitorgroups] ; members of monitors to automatically send notifications to all without need to set them in each monitor. members can ; be added to monitors in the configuration of each monitor though. -network1_members = admin1@example.com,admin2@example.com,admin3@example.com +network1_members = admin@example.com,@admins ; every notification can be configured in it's own configuration file in etc/notifications; there no notification ; name as prefix is needed. see email example. @@ -58,9 +73,11 @@ email_resend = 10 speedtest_interval = 3600 speedtest_url = https://go.microsoft.com/fwlink/?Linkid=850641 +; tasks executed at the end of each monitor execution. this is for storing data for longtime analysis. not every task +; is storing results and this feature is fully optional. Linspector must run even without activated tasks! [tasks] mariadb_database = linspector mariadb_host = 10.0.0.254 mariadb_password = PASSWORD -mariadb_port": 3306 +mariadb_port = 3306 mariadb_user = USER \ No newline at end of file diff --git a/etc/monitors/network1/gateway.conf b/etc/monitors/network1/gateway.conf index 597928d..0aecc1b 100644 --- a/etc/monitors/network1/gateway.conf +++ b/etc/monitors/network1/gateway.conf @@ -9,7 +9,7 @@ notifications = sMs,EmaiL ; email_receivers separated by ','. no whitespaces allowed email_receivers = admin@example.com,fallback@example.com ; sms_receivers separated by ','. no whitespaces allowed -sms_receivers = +329084320984,+39804932409 +sms_receivers = +number1,+number2 ; setting to None fails. just do not set this option. currently i get an error when tasks is not set here. need to be ; fixed. setting it like below works but is no good design for optional options. same for notifications. tasks = redis @@ -21,4 +21,6 @@ tasks = redis hosts = 192.168.0.1,192.168.23.24,@group1,@testgroup1 user = USERNAME password = PASSWORD -info = Cable Provider \ No newline at end of file +info = Cable Provider +; only alert when the error reaches the threshold +threshold = 3 \ No newline at end of file diff --git a/etc/monitors/network2/gateway.conf b/etc/monitors/network2/gateway.conf index a2813a7..ffd346b 100644 --- a/etc/monitors/network2/gateway.conf +++ b/etc/monitors/network2/gateway.conf @@ -4,7 +4,7 @@ service = Net.FritzboxUplink interval = 60 notifications = Email email_receivers = admin@example.com,fallback@example.com -sms_receivers = +329084320984,+39804932409 +sms_receivers = ++number1,+number2 tasks = MariaDB,FileLogger hosts = 192.168.1.1 user = USERNAME diff --git a/linspector/core/configuration.py b/linspector/core/configuration.py index 302f99d..0651253 100644 --- a/linspector/core/configuration.py +++ b/linspector/core/configuration.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ import configparser import glob diff --git a/linspector/core/daemon.py b/linspector/core/daemon.py index 65bd5cf..142a0f7 100644 --- a/linspector/core/daemon.py +++ b/linspector/core/daemon.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ import atexit import os diff --git a/linspector/core/environment.py b/linspector/core/environment.py index 1db4104..af59bb5 100644 --- a/linspector/core/environment.py +++ b/linspector/core/environment.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger diff --git a/linspector/core/linspector.py b/linspector/core/linspector.py index e917c7f..d8d9900 100644 --- a/linspector/core/linspector.py +++ b/linspector/core/linspector.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ import importlib diff --git a/linspector/core/linspectord.py b/linspector/core/linspectord.py index eb5f276..b201e8e 100644 --- a/linspector/core/linspectord.py +++ b/linspector/core/linspectord.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger diff --git a/linspector/core/logger.py b/linspector/core/logger.py index 7caef19..7f2887f 100644 --- a/linspector/core/logger.py +++ b/linspector/core/logger.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger diff --git a/linspector/core/model.py b/linspector/core/model.py index 965f06f..39e3726 100644 --- a/linspector/core/model.py +++ b/linspector/core/model.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger diff --git a/linspector/core/monitor.py b/linspector/core/monitor.py index d17a048..c30b9cd 100644 --- a/linspector/core/monitor.py +++ b/linspector/core/monitor.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ import importlib @@ -36,6 +19,7 @@ class Monitor: self.__identifier = identifier self.__monitor_configuration = monitor_configuration self.__notification_list = [] + self.__service = None self.__notifications = notifications self.__services = services self.__task_list = [] # put tasks for the dedicated job here. @@ -60,24 +44,21 @@ class Monitor: self.__notification_list = notification_list.split(',') for notification_option in notification_list.split(','): - #print(__file__ + ' (64): ' + str(notification_option)) if notification_option not in notifications: notification_package = 'linspector.notifications.' + notification_option.lower() notification_module = importlib.import_module(notification_package) notification = notification_module.get(configuration, environment) notifications[notification_option.lower()] = notification - #print(__file__ + ' (70): ' + str(notifications)) - #print(__file__ + ' (72): ' + str(monitor_configuration)) if self.__monitor_configuration.get('monitor', 'service'): if monitor_configuration.get('monitor', 'service') not in services: service_package = 'linspector.services.' + \ monitor_configuration.get('monitor', 'service').lower() service_module = importlib.import_module(service_package) + self.__service = monitor_configuration.get('monitor', 'service').lower() service = service_module.get(configuration, environment) services[monitor_configuration.get('monitor', 'service').lower()] = service - #print(__file__ + ' (81): ' + str(services)) #service.execute(self) @@ -100,14 +81,11 @@ class Monitor: for task_option in task_list.split(','): if task_option not in tasks: - #print(__file__ + ' (104): ' + str(task_option)) task_package = 'linspector.tasks.' + task_option.lower() task_module = importlib.import_module(task_package) task = task_module.get(configuration, environment) tasks[task_option.lower()] = task - #print(__file__ + ' (110): ' + str(tasks)) - def get_identifier(self): return self.__identifier diff --git a/linspector/core/monitors.py b/linspector/core/monitors.py index 130daa3..1d01971 100644 --- a/linspector/core/monitors.py +++ b/linspector/core/monitors.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ import configparser import copy diff --git a/linspector/core/notification.py b/linspector/core/notification.py index f48a284..fdfcb4b 100644 --- a/linspector/core/notification.py +++ b/linspector/core/notification.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger diff --git a/linspector/core/plugin.py b/linspector/core/plugin.py index ad60fe7..cf0805b 100644 --- a/linspector/core/plugin.py +++ b/linspector/core/plugin.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger diff --git a/linspector/core/service.py b/linspector/core/service.py index d04ec33..a97be7f 100644 --- a/linspector/core/service.py +++ b/linspector/core/service.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger diff --git a/linspector/core/task.py b/linspector/core/task.py index 5d00aa8..4cfb720 100644 --- a/linspector/core/task.py +++ b/linspector/core/task.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger diff --git a/linspector/notifications/call.py b/linspector/notifications/call.py index f0c0540..42cd94c 100644 --- a/linspector/notifications/call.py +++ b/linspector/notifications/call.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger diff --git a/linspector/notifications/email.py b/linspector/notifications/email.py index f1bf916..a6e947b 100644 --- a/linspector/notifications/email.py +++ b/linspector/notifications/email.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger diff --git a/linspector/notifications/sms.py b/linspector/notifications/sms.py index a46e7b1..8bd7905 100644 --- a/linspector/notifications/sms.py +++ b/linspector/notifications/sms.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger diff --git a/linspector/notifications/twitter.py b/linspector/notifications/twitter.py index 6108725..d70f4f2 100644 --- a/linspector/notifications/twitter.py +++ b/linspector/notifications/twitter.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger diff --git a/linspector/notifications/xmpp.py b/linspector/notifications/xmpp.py index 90b130b..2dc0fea 100644 --- a/linspector/notifications/xmpp.py +++ b/linspector/notifications/xmpp.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger diff --git a/linspector/plugins/httpserver.py b/linspector/plugins/httpserver.py index cc3ba33..51a9195 100644 --- a/linspector/plugins/httpserver.py +++ b/linspector/plugins/httpserver.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ import cherrypy import json diff --git a/linspector/plugins/lish.py b/linspector/plugins/lish.py index 82a59c6..b28c211 100644 --- a/linspector/plugins/lish.py +++ b/linspector/plugins/lish.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger diff --git a/linspector/services/http/httpkeyword.py b/linspector/services/http/httpkeyword.py index 22b72de..6aba6e6 100644 --- a/linspector/services/http/httpkeyword.py +++ b/linspector/services/http/httpkeyword.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger @@ -31,10 +14,12 @@ def get(configuration, environment): return HTTPKeywordService(configuration, environment) -# TODO: check for all required configuration options and set defaults if needed. class HTTPKeywordService(Service): def __init__(self, configuration, environment): super().__init__(configuration, environment) self.__configuration = configuration self.__environment = environment + + def execute(self): + return diff --git a/linspector/services/misc/dummy.py b/linspector/services/misc/dummy.py index dc60bb2..1d11455 100644 --- a/linspector/services/misc/dummy.py +++ b/linspector/services/misc/dummy.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger @@ -31,10 +14,12 @@ def get(configuration, environment): return DummyService(configuration, environment) -# TODO: check for all required configuration options and set defaults if needed. class DummyService(Service): def __init__(self, configuration, environment): super().__init__(configuration, environment) self.__configuration = configuration self.__environment = environment + + def execute(self): + return diff --git a/linspector/services/misc/random.py b/linspector/services/misc/random.py index 81c656a..adc49b3 100644 --- a/linspector/services/misc/random.py +++ b/linspector/services/misc/random.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger @@ -31,10 +14,12 @@ def get(configuration, environment): return RandomService(configuration, environment) -# TODO: check for all required configuration options and set defaults if needed. class RandomService(Service): def __init__(self, configuration, environment): super().__init__(configuration, environment) self.__configuration = configuration self.__environment = environment + + def execute(self): + return diff --git a/linspector/services/net/fritzboxuplink.py b/linspector/services/net/fritzboxuplink.py index 0b14773..a7975eb 100644 --- a/linspector/services/net/fritzboxuplink.py +++ b/linspector/services/net/fritzboxuplink.py @@ -1,25 +1,9 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT) """ +from fritzconnection.lib.fritzstatus import FritzStatus from logging import getLogger from linspector.core.service import Service @@ -31,7 +15,6 @@ def get(configuration, environment): return FritzboxUplinkService(configuration, environment) -# TODO: check for all required configuration options and set defaults if needed. class FritzboxUplinkService(Service): def __init__(self, configuration, environment): @@ -39,5 +22,6 @@ class FritzboxUplinkService(Service): self.__configuration = configuration self.__environment = environment - #def execute(self): - # print(__file__ + ' (37): ' + 'test...') + def execute(self): + print('huhu') + return diff --git a/linspector/services/net/ping.py b/linspector/services/net/ping.py index dc03056..75af871 100644 --- a/linspector/services/net/ping.py +++ b/linspector/services/net/ping.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger @@ -31,10 +14,12 @@ def get(configuration, environment): return PingService(configuration, environment) -# TODO: check for all required configuration options and set defaults if needed. class PingService(Service): def __init__(self, configuration, environment): super().__init__(configuration, environment) self.__configuration = configuration self.__environment = environment + + def execute(self): + return diff --git a/linspector/services/net/port.py b/linspector/services/net/port.py index a092883..854a65d 100644 --- a/linspector/services/net/port.py +++ b/linspector/services/net/port.py @@ -1,25 +1,10 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ +import socket + from logging import getLogger from linspector.core.service import Service @@ -31,10 +16,28 @@ def get(configuration, environment): return PortService(configuration, environment) -# TODO: check for all required configuration options and set defaults if needed. class PortService(Service): def __init__(self, configuration, environment): super().__init__(configuration, environment) self.__configuration = configuration self.__environment = environment + + def execute(self, execution): + + error_code = 0 + msg = "Connection successful established" + + try: + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + except socket.error as err: + error_code = 2 + msg = "Could not create socket" + + try: + sock.connect((execution.get_host_name(), self.port)) + except socket.error as err: + error_code = 1 + msg = "Could not establish connection" + + sock.close() diff --git a/linspector/services/net/shell.py b/linspector/services/net/shell.py deleted file mode 100644 index ac40831..0000000 --- a/linspector/services/net/shell.py +++ /dev/null @@ -1,40 +0,0 @@ -""" -This file is part of Linspector (https://linspector.org/) -Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. -""" -from logging import getLogger - -from linspector.core.service import Service - -logger = getLogger('linspector') - - -def get(configuration, environment): - return ShellService(configuration, environment) - - -# TODO: check for all required configuration options and set defaults if needed. -class ShellService(Service): - - def __init__(self, configuration, environment): - super().__init__(configuration, environment) - self.__configuration = configuration - self.__environment = environment diff --git a/linspector/services/net/speedtest.py b/linspector/services/net/speedtest.py index b7c2358..77e0338 100644 --- a/linspector/services/net/speedtest.py +++ b/linspector/services/net/speedtest.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ import calendar import requests @@ -35,7 +18,6 @@ def get(configuration, environment): return SpeedtestService(configuration, environment) -# TODO: check for all required configuration options and set defaults if needed. class SpeedtestService(Service): def __init__(self, configuration, environment): diff --git a/linspector/services/net/ssh.py b/linspector/services/net/ssh.py index 9a8e7f1..5be4bd7 100644 --- a/linspector/services/net/ssh.py +++ b/linspector/services/net/ssh.py @@ -1,25 +1,13 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ +import os +import paramiko +import pprint + + from logging import getLogger from linspector.core.service import Service @@ -31,10 +19,26 @@ def get(configuration, environment): return SSHService(configuration, environment) -# TODO: check for all required configuration options and set defaults if needed. class SSHService(Service): def __init__(self, configuration, environment): super().__init__(configuration, environment) self.__configuration = configuration self.__environment = environment + + def execute(self): + path = os.path.join(os.environ['HOME'], '.ssh', 'id_rsa') + key = paramiko.RSAKey.from_private_key_file(path) + + client = paramiko.SSHClient() + client.get_host_keys().add('hanez.org', 'ssh-rsa', key) + pprint.pprint(client._host_keys) + + client.connect('hanez.org', username='hanez') + + #self.command.call() ist dann das: + stdin, stdout, stderr = client.exec_command('ls') + for line in stdout: + print('... ' + line.strip('\n')) + client.close() + diff --git a/linspector/services/net/tcpconnect.py b/linspector/services/net/tcpconnect.py index f204095..77dde56 100644 --- a/linspector/services/net/tcpconnect.py +++ b/linspector/services/net/tcpconnect.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger @@ -38,3 +21,6 @@ class TCPConnectService(Service): super().__init__(configuration, environment) self.__configuration = configuration self.__environment = environment + + def execute(self): + return diff --git a/linspector/services/snmp/get.py b/linspector/services/snmp/get.py new file mode 100644 index 0000000..8278c7a --- /dev/null +++ b/linspector/services/snmp/get.py @@ -0,0 +1,26 @@ +""" +This file is part of Linspector (https://linspector.org/) +Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. +See LICENSE (MIT license) +""" +from logging import getLogger +from pysnmp.entity.rfc3413.oneliner import cmdgen + +from linspector.core.service import Service + +logger = getLogger('linspector') + + +def get(configuration, environment): + return GetService(configuration, environment) + + +class GetService(Service): + + def __init__(self, configuration, environment): + super().__init__(configuration, environment) + self.__configuration = configuration + self.__environment = environment + + def execute(self): + return diff --git a/linspector/services/snmp/snmpget.py b/linspector/services/snmp/snmpget.py deleted file mode 100644 index 09a4a22..0000000 --- a/linspector/services/snmp/snmpget.py +++ /dev/null @@ -1,40 +0,0 @@ -""" -This file is part of Linspector (https://linspector.org/) -Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. -""" -from logging import getLogger - -from linspector.core.service import Service - -logger = getLogger('linspector') - - -def get(configuration, environment): - return SNMPGetService(configuration, environment) - - -# TODO: check for all required configuration options and set defaults if needed. -class SNMPGetService(Service): - - def __init__(self, configuration, environment): - super().__init__(configuration, environment) - self.__configuration = configuration - self.__environment = environment diff --git a/linspector/services/ssh/__init__.py b/linspector/services/ssh/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/linspector/services/ssh/tcpconnect.py b/linspector/services/ssh/tcpconnect.py deleted file mode 100644 index f204095..0000000 --- a/linspector/services/ssh/tcpconnect.py +++ /dev/null @@ -1,40 +0,0 @@ -""" -This file is part of Linspector (https://linspector.org/) -Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. -""" -from logging import getLogger - -from linspector.core.service import Service - -logger = getLogger('linspector') - - -def get(configuration, environment): - return TCPConnectService(configuration, environment) - - -# TODO: check for all required configuration options and set defaults if needed. -class TCPConnectService(Service): - - def __init__(self, configuration, environment): - super().__init__(configuration, environment) - self.__configuration = configuration - self.__environment = environment diff --git a/linspector/services/sys/shell.py b/linspector/services/sys/shell.py new file mode 100644 index 0000000..2e902ea --- /dev/null +++ b/linspector/services/sys/shell.py @@ -0,0 +1,26 @@ +""" +This file is part of Linspector (https://linspector.org/) +Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. +See LICENSE (MIT license) +""" +from logging import getLogger + +from linspector.core.service import Service + +logger = getLogger('linspector') + + +def get(configuration, environment): + return ShellService(configuration, environment) + + +class ShellService(Service): + + def __init__(self, configuration, environment): + super().__init__(configuration, environment) + self.__configuration = configuration + self.__environment = environment + + def execute(self): + return + diff --git a/linspector/services/sys/uptime.py b/linspector/services/sys/uptime.py index ad5f02d..e42f11f 100644 --- a/linspector/services/sys/uptime.py +++ b/linspector/services/sys/uptime.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger @@ -31,10 +14,12 @@ def get(configuration, environment): return UptimeService(configuration, environment) -# TODO: check for all required configuration options and set defaults if needed. class UptimeService(Service): def __init__(self, configuration, environment): super().__init__(configuration, environment) self.__configuration = configuration self.__environment = environment + + def execute(self): + return diff --git a/linspector/tasks/filelogger.py b/linspector/tasks/filelogger.py index 239057f..c6b9843 100644 --- a/linspector/tasks/filelogger.py +++ b/linspector/tasks/filelogger.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger diff --git a/linspector/tasks/mariadb.py b/linspector/tasks/mariadb.py index f2d101b..5030826 100644 --- a/linspector/tasks/mariadb.py +++ b/linspector/tasks/mariadb.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger diff --git a/linspector/tasks/redis.py b/linspector/tasks/redis.py index 666136f..fd6303b 100644 --- a/linspector/tasks/redis.py +++ b/linspector/tasks/redis.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger diff --git a/linspector/tasks/sqlite.py b/linspector/tasks/sqlite.py index a5e51ea..45ed5b0 100644 --- a/linspector/tasks/sqlite.py +++ b/linspector/tasks/sqlite.py @@ -1,24 +1,7 @@ """ This file is part of Linspector (https://linspector.org/) Copyright (c) 2022 Johannes Findeisen . All Rights Reserved. - -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. +See LICENSE (MIT license) """ from logging import getLogger diff --git a/requirements.txt b/requirements.txt index 31fb96c..c7d9f9a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ CherryPy~=18.8.0 # used by httpserver plugin -requests~=2.28.1 # used by speedtest service \ No newline at end of file +requests~=2.28.1 # used by speedtest service