[NEW] refactoring of maintenance_server_monitoring in several modules
This commit is contained in:
2
maintenance_server_monitoring_ssh/.gitignore
vendored
Normal file
2
maintenance_server_monitoring_ssh/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*.*~
|
||||
*pyc
|
44
maintenance_server_monitoring_ssh/README.rst
Normal file
44
maintenance_server_monitoring_ssh/README.rst
Normal file
@@ -0,0 +1,44 @@
|
||||
======================================
|
||||
maintenance_server_monitoring_ssh
|
||||
======================================
|
||||
|
||||
Improve monitoring with ping test
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
Use Odoo normal module installation procedure to install
|
||||
``maintenance_server_monitoring_ssh``.
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
None yet.
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `our issues website <https://github.com/elabore-coop/maintenance-tools/issues>`_. In case of
|
||||
trouble, please check there if your issue has already been
|
||||
reported. If you spotted it first, help us smashing it by providing a
|
||||
detailed and welcomed feedback.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Clément Thomas
|
||||
|
||||
Funders
|
||||
-------
|
||||
|
||||
The development of this module has been financially supported by:
|
||||
* Elabore (https://elabore.coop)
|
||||
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
This module is maintained by Elabore.
|
3
maintenance_server_monitoring_ssh/__init__.py
Normal file
3
maintenance_server_monitoring_ssh/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
37
maintenance_server_monitoring_ssh/__manifest__.py
Normal file
37
maintenance_server_monitoring_ssh/__manifest__.py
Normal file
@@ -0,0 +1,37 @@
|
||||
# Copyright 2023 Stéphan Sainléger (Elabore)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "maintenance_server_monitoring_ssh",
|
||||
"version": "14.0.1.0.0",
|
||||
"author": "Elabore",
|
||||
"website": "https://elabore.coop",
|
||||
"maintainer": "Clément Thomas",
|
||||
"license": "AGPL-3",
|
||||
"category": "Tools",
|
||||
"summary": "Monitor ssh response on remote hosts",
|
||||
# any module necessary for this one to work correctly
|
||||
"depends": [
|
||||
"maintenance_server_monitoring",
|
||||
"maintenance_server_ssh"
|
||||
],
|
||||
"qweb": [
|
||||
# "static/src/xml/*.xml",
|
||||
],
|
||||
"external_dependencies": {
|
||||
"python": [],
|
||||
},
|
||||
# always loaded
|
||||
"data": [
|
||||
|
||||
],
|
||||
# only loaded in demonstration mode
|
||||
"demo": [],
|
||||
"js": [],
|
||||
"css": [],
|
||||
"installable": True,
|
||||
# Install this module automatically if all dependency have been previously
|
||||
# and independently installed. Used for synergetic or glue modules.
|
||||
"auto_install": False,
|
||||
"application": False,
|
||||
}
|
1
maintenance_server_monitoring_ssh/models/__init__.py
Normal file
1
maintenance_server_monitoring_ssh/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import maintenance_equipment
|
@@ -0,0 +1,31 @@
|
||||
from odoo import fields, models, api
|
||||
|
||||
class MaintenanceEquipment(models.Model):
|
||||
_inherit = 'maintenance.equipment'
|
||||
|
||||
ssh_ok = fields.Boolean("SSH ok", readonly=True)
|
||||
|
||||
def get_tests(self):
|
||||
res = super(MaintenanceEquipment, self).get_tests()
|
||||
res.append("ssh_ok")
|
||||
return res
|
||||
|
||||
def test_ssh_ok(self):
|
||||
"""
|
||||
test ssh with maintenance_server_ssh module
|
||||
|
||||
Returns:
|
||||
MonitoringTest: representing current test with :
|
||||
* result = False if error
|
||||
* result = ssh connection if no error
|
||||
* error = MonitoringTest.ERROR if connection failed
|
||||
* log file
|
||||
"""
|
||||
test = self.MonitoringTest("SSH OK")
|
||||
self.get_ssh_connection()
|
||||
try:
|
||||
# SSH connection ok : set ssh connection in result, converted in boolean (True) when set in ssh_ok field
|
||||
return test.test_ok(self.get_ssh_connection(), "SSH Connection OK") #ssh connection given by maintenance_server_ssh module
|
||||
except Exception as e:
|
||||
# SSH connection failed
|
||||
return test.test_error(False, "connection failed {e}")
|
Reference in New Issue
Block a user