Files
maintenance-tools/maintenance_service_http_monitoring

======================================
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`.


Webhook Notification
====================

When a new maintenance request is created (HTTP check failure), the module can
send a webhook notification to an external service (e.g., n8n, Rocket.Chat, Slack).

Configuration
-------------

Go to **Settings > Technical > Parameters > System Parameters** and configure:

+--------------------------------------------------------+----------------------------------------+
| Key                                                    | Description                            |
+========================================================+========================================+
| ``maintenance_service_http_monitoring.webhook_url``    | Webhook URL (POST endpoint)            |
+--------------------------------------------------------+----------------------------------------+
| ``maintenance_service_http_monitoring.webhook_user``   | Basic Auth username (optional)         |
+--------------------------------------------------------+----------------------------------------+
| ``maintenance_service_http_monitoring.webhook_password``| Basic Auth password (optional)        |
+--------------------------------------------------------+----------------------------------------+

Webhook Payload
---------------

The webhook sends a JSON POST with the following structure::

    {
        "id": 42,
        "name": "[HTTP KO] Server Name",
        "priority": "2",
        "description": "Service KO: https://example.com",
        "equipment": "Server Name",
        "link": "https://odoo.example.com/web#id=42&model=maintenance.request&view_type=form"
    }


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.