Site icon VentorTech

How to set up monitoring for your Odoo instance

set up monitoring for your Odoo

Drinking coffee or beer in a pub, having a weekend trip, watching a movie, or just sleeping but … your Odoo is down for a day already. Familiar?

odoo mem

When your Odoo ERP is down, your business is also down. You can’t receive goods, can’t sell them and can’t deliver. Internal processes are also stopped. And the longer it lasts, the more money you lose.

To prevent such unexpected issues or timely notify about downs and errors, we always set up monitoring in our Odoo projects.

Table of contents

  1. Sentry for Odoo monitoring
  2. How to install Sentry to Odoo
  3. How to configure Sentry to monitor your Odoo
  4. Summary

Sentry for Odoo monitoring

We usually use Sentry to monitor Odoo instance. And in this guide will show you how to set up Odoo monitoring via Sentry. 

There is a great OCA module that will help us doing so – https://apps.odoo.com/apps/modules/14.0/sentry/

How to install Sentry to Odoo

  1. Deploy Sentry on your server or create an account on an online service https://sentry.io
  2. Create a new project in your profile

Create Sentry project

  3. Deploy the Sentry module to your Odoo server (https://apps.odoo.com/apps/modules/14.0/sentry/).

  4. Install the Python package raven in your virtual environment. Sentry uses the SDK (software development kit) to catch exceptions and warnings. Sentry-sdk contains a set of tools to simplify development and integrate your python project with Sentry.  For earlier versions of Odoo (<14.0) the raven package was used.

pip install --upgrade sentry-sdk

  5. Install the Odoo Sentry module in your Odoo DB.

How to configure Sentry to monitor your Odoo

  1. Add the parameters for monitoring to the odoo.conf file. The description of the parameters can be found in the module’s documentation. The module allows you to flexibly configure Sentry monitoring based on your preferences.
[options]

sentry_dsn = https://<public_key>:<secret_key>@sentry.example.com/<project id>

sentry_enabled = true

sentry_logging_level = warn

sentry_exclude_loggers = werkzeug

sentry_ignore_exceptions = odoo.exceptions.AccessDenied,

    odoo.exceptions.AccessError,odoo.exceptions.MissingError,

    odoo.exceptions.RedirectWarning,odoo.exceptions.UserError,

    odoo.exceptions.ValidationError,odoo.exceptions.Warning,

    odoo.exceptions.except_orm

sentry_include_context = true

sentry_environment = production

   2. The sentry_dsn parameter value must be copied from the Sentry project settings.

Sentry DNS

   3. The sentry_ignore_exceptions parameter contains the exceptions that we want to ignore in monitoring, so that only the most important exceptions are displayed in Sentry. 

AccessDenied Login/password error. For example, when you try to log with a wrong password.
AccessError Access rights error. For example, when you try to read a record that you are not allowed to.
MissingError Missing record(s). For example, when you try to write on a deleted record.
RedirectWarning Warning with a possibility to redirect the user instead of simply displaying the warning message.
UserError Generic error managed by the client. Typically when the user tries to do something that has no sense given the current state of a record. Semantically comparable to the generic 400 HTTP status codes.
ValidationError Violation of python constraints. For example, when you try to create a new user with a login which already exist in the db.
Warning It is a deprecated alias to UserError.
except_orm It is a deprecated alias to UserError.

If there is a need to monitor any of the listed exceptions, you can always remove it from the sentry_ignore_exceptions parameter.

  4. Sentry provides the ability to monitor performance. It is available for the Sentry Python SDK version ≥ 0.11.2. To enable performance monitoring it is necessary to set the sentry_traces_sample_rate parameter. This parameter is set between 0 and 1 (For example, to send 20% of transactions, set traces_sample_rate to 0.2.). Be attentive when specifying the value of this parameter, as too high a value may result in poor performance.

   5. You need to restart Odoo to launch monitoring.

That’s it. Now your Odoo server is under control 🙂

 Summary

What benefits Odoo monitoring with Sentry gives:

Disadvantages of Sentry:

Calculate the price for your Odoo project

Get a quote >

 

Follow our Linkedin account and subscribe to our newsletter to make sure you don’t miss updates.

Exit mobile version