[MIG] maintenance_service_http_monitoring: Migration to 18.0
This commit is contained in:
@@ -1,58 +0,0 @@
|
|||||||
======================================
|
|
||||||
maintenance_service_http_monitoring
|
|
||||||
======================================
|
|
||||||
|
|
||||||
Module that allows monitoring of different services by checking their HTTP 200 responses:
|
|
||||||
|
|
||||||
- Uses the `maintenance_server_data` service for each device.
|
|
||||||
|
|
||||||
If the service has a URL, a request is made.
|
|
||||||
- Adds maintenance mode for a device:
|
|
||||||
|
|
||||||
- Allows disabling HTTP checks for a specified time (defined in the cron job).
|
|
||||||
|
|
||||||
## Logic:
|
|
||||||
If a request fails and a maintenance task has already been created for the same day,
|
|
||||||
no new task is added.
|
|
||||||
|
|
||||||
The default values for the cron jobs are located in `data/cron.xml`.
|
|
||||||
|
|
||||||
|
|
||||||
Installation
|
|
||||||
============
|
|
||||||
|
|
||||||
Use Odoo normal module installation procedure to install
|
|
||||||
``maintenance_service_http_monitoring``.
|
|
||||||
|
|
||||||
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
|
|
||||||
------------
|
|
||||||
|
|
||||||
* Boris Gallet
|
|
||||||
|
|
||||||
Funders
|
|
||||||
-------
|
|
||||||
|
|
||||||
The development of this module has been financially supported by:
|
|
||||||
* Elabore (https://elabore.coop)
|
|
||||||
|
|
||||||
|
|
||||||
Maintainer
|
|
||||||
----------
|
|
||||||
|
|
||||||
This module is maintained by Elabore.
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "maintenance_service_http_monitoring",
|
"name": "maintenance_service_http_monitoring",
|
||||||
"version": "16.0.1.0.0",
|
"version": "18.0.1.0.0",
|
||||||
"author": "Elabore",
|
"author": "Elabore",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"category": "Tools",
|
"category": "Tools",
|
||||||
|
|||||||
@@ -7,8 +7,6 @@
|
|||||||
<field name="code">model.cron_check_http_services()</field>
|
<field name="code">model.cron_check_http_services()</field>
|
||||||
<field name="interval_number">15</field>
|
<field name="interval_number">15</field>
|
||||||
<field name="interval_type">minutes</field>
|
<field name="interval_type">minutes</field>
|
||||||
<field name="numbercall">-1</field>
|
|
||||||
<field name="doall">False</field>
|
|
||||||
</record>
|
</record>
|
||||||
<record id="ir_cron_maintenance_mode_expiry" model="ir.cron">
|
<record id="ir_cron_maintenance_mode_expiry" model="ir.cron">
|
||||||
<field
|
<field
|
||||||
@@ -22,7 +20,5 @@
|
|||||||
<field name="code">model.cron_deactivate_expired_maintenance_mode()</field>
|
<field name="code">model.cron_deactivate_expired_maintenance_mode()</field>
|
||||||
<field name="interval_number">15</field>
|
<field name="interval_number">15</field>
|
||||||
<field name="interval_type">minutes</field>
|
<field name="interval_type">minutes</field>
|
||||||
<field name="numbercall">-1</field>
|
|
||||||
<field name="doall">False</field>
|
|
||||||
</record>
|
</record>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class ServiceInstance(models.Model):
|
|||||||
now = fields.Datetime.now()
|
now = fields.Datetime.now()
|
||||||
url = rec.service_url
|
url = rec.service_url
|
||||||
if not url.lower().startswith("https://"):
|
if not url.lower().startswith("https://"):
|
||||||
url = "https://" + url.lstrip("http://")
|
url = "https://" + url.removeprefix("http://").removeprefix("HTTP://")
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, timeout=HTTP_CHECK_TIMEOUT)
|
response = requests.get(url, timeout=HTTP_CHECK_TIMEOUT)
|
||||||
status_code = response.status_code
|
status_code = response.status_code
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<div
|
<div
|
||||||
class="alert alert-warning"
|
class="alert alert-warning"
|
||||||
role="alert"
|
role="alert"
|
||||||
attrs="{'invisible': [('maintenance_mode', '=', False)]}"
|
invisible="not maintenance_mode"
|
||||||
>
|
>
|
||||||
Mode maintenance actif — Vérifications HTTP désactivées.<br />
|
Mode maintenance actif — Vérifications HTTP désactivées.<br />
|
||||||
Fin prévue : <field name="maintenance_mode_end" readonly="1" />
|
Fin prévue : <field name="maintenance_mode_end" readonly="1" />
|
||||||
@@ -20,14 +20,14 @@
|
|||||||
name="action_activate_maintenance_mode"
|
name="action_activate_maintenance_mode"
|
||||||
type="object"
|
type="object"
|
||||||
string="Activer le mode maintenance"
|
string="Activer le mode maintenance"
|
||||||
attrs="{'invisible': [('maintenance_mode', '=', True)]}"
|
invisible="maintenance_mode"
|
||||||
class="oe_highlight"
|
class="oe_highlight"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
name="action_deactivate_maintenance_mode"
|
name="action_deactivate_maintenance_mode"
|
||||||
type="object"
|
type="object"
|
||||||
string="Désactiver le mode maintenance"
|
string="Désactiver le mode maintenance"
|
||||||
attrs="{'invisible': [('maintenance_mode', '=', False)]}"
|
invisible="not maintenance_mode"
|
||||||
/>
|
/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//notebook" position="inside">
|
<xpath expr="//notebook" position="inside">
|
||||||
@@ -43,11 +43,11 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
<record id="view_equipment_tree_http_monitoring" model="ir.ui.view">
|
<record id="view_equipment_tree_http_monitoring" model="ir.ui.view">
|
||||||
<field name="name">maintenance.equipment.tree.http.monitoring</field>
|
<field name="name">maintenance.equipment.list.http.monitoring</field>
|
||||||
<field name="model">maintenance.equipment</field>
|
<field name="model">maintenance.equipment</field>
|
||||||
<field name="inherit_id" ref="maintenance.hr_equipment_view_tree" />
|
<field name="inherit_id" ref="maintenance.hr_equipment_view_tree" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//tree" position="inside">
|
<xpath expr="//list" position="inside">
|
||||||
<field name="maintenance_mode" optional="hide" />
|
<field name="maintenance_mode" optional="hide" />
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<!-- Inherit from base tree view to add HTTP monitoring fields -->
|
<!-- Inherit from base list view to add HTTP monitoring fields -->
|
||||||
<record id="service_instance_http_monitoring_tree" model="ir.ui.view">
|
<record id="service_instance_http_monitoring_tree" model="ir.ui.view">
|
||||||
<field name="name">service.instance.http.monitoring.tree</field>
|
<field name="name">service.instance.http.monitoring.list</field>
|
||||||
<field name="model">service.instance</field>
|
<field name="model">service.instance</field>
|
||||||
<field
|
<field
|
||||||
name="inherit_id"
|
name="inherit_id"
|
||||||
ref="maintenance_server_data.service_instance_view_tree"
|
ref="maintenance_server_data.service_instance_view_tree"
|
||||||
/>
|
/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree position="attributes">
|
<list position="attributes">
|
||||||
<attribute name="decoration-danger">http_status_ok == False</attribute>
|
<attribute name="decoration-danger">http_status_ok == False</attribute>
|
||||||
</tree>
|
</list>
|
||||||
<field name="version_id" position="after">
|
<field name="version_id" position="after">
|
||||||
<field name="service_url" />
|
<field name="service_url" />
|
||||||
<field name="last_http_check_date" />
|
<field name="last_http_check_date" />
|
||||||
|
|||||||
Reference in New Issue
Block a user