Add monitoring_statsd in cloud_platform

This commit is contained in:
Guewen Baconnier
2016-11-04 10:30:10 +01:00
parent d53ef3de37
commit 65e9bad4e5
4 changed files with 29 additions and 10 deletions
+21 -10
View File
@@ -6,14 +6,13 @@ Camptocamp odoo addons used on our Cloud Platform.
On the platform we want to achieve having:
* no data stored on the local filesystem so we can move an instance
* No data stored on the local filesystem so we can move an instance
between hosts and even have several running front-ends
* metrics read from the logs or sent to Prometheus to monitor the instances
* Metrics read from the logs or sent to Prometheus to monitor the instances
* Logs sent to ElasticSearch-Kibana structured as JSON for better searching
For the storage, we store all the attachments on a object storage such as S3 or a S3 compatible one, and we store the werkzeug sessions on Redis.
For the metrics, we produce logs as json (TODO) that is sent
to ELK and send data to Prometheus/Grafana using statsd.
For the storage, we store all the attachments on a object storage such as S3 or
a S3 compatible one, and we store the werkzeug sessions on Redis.
## Setup
@@ -25,6 +24,7 @@ Libraries that must be added in ``requirements.txt``:
boto==2.42.0
redis==2.10.5
python-json-logger==0.1.5
statsd==3.2.1
```
### Server Environment
@@ -46,16 +46,16 @@ The exact naming is important, because the `cloud_platform` addon rely on these
* `AWS_ACCESS_KEY_ID`: depends of the platform
* `AWS_SECRET_ACCESS_KEY`: depends of the platform
* `AWS_BUCKETNAME`: `<client>-odoo-prod`
* integration: stored RO in the production object storage, fallback
on database for the writes
* integration:
* `AWS_HOST`: depends of the platform
* `AWS_ACCESS_KEY_ID`: depends of the platform
* `AWS_SECRET_ACCESS_KEY`: depends of the platform
* `AWS_BUCKETNAME`: `<client>-odoo-integration`
* test: attachments are stored in database
Besides, the
* `ir.config_parameter` `ir_attachment.location`: `s3://` (
Besides, the attachment location should be set to `s3` (but this is
automatically done by the `install` methods of the `cloud_platform` module.
* `ir.config_parameter` `ir_attachment.location`: `s3`
### Sessions in Redis
@@ -83,6 +83,17 @@ At least on production and integration, activate:
* Add ``logging_json`` in the ``server_wide_modules`` option in the
configuration file
### Metrics (Statsd/Prometheus for Grafana)
Should be active at least on the production server
* `ODOO_STATSD`: 1
* `STATSD_CUSTOMER`: `<client>`
* `STATSD_ENVIRONMENT`: set if you want to send metrics for a special
environment which does not match with the `server_environment`
* `STATSD_HOST`: depends of the platform
* `STATSD_PORT`: depends of the platform
### Automatic Configuration
Calling `ctx.env['cloud.platform'].install_exoscale()` in an
+1
View File
@@ -15,6 +15,7 @@
'monitoring_status',
'logging_json',
# 'monitoring_log_requests',
'monitoring_statsd',
'server_environment', # OCA/server-tools
],
'website': 'http://www.camptocamp.com',
+6
View File
@@ -99,6 +99,11 @@ class CloudPlatform(models.AbstractModel):
", we got: '%s'" % (prefix,)
)
@api.model
def _check_metrics(self, environment_name):
if environment_name == 'prod':
assert is_true(os.environ.get('ODOO_STATSD'))
@api.model
def check(self):
if is_true(os.environ.get('ODOO_CLOUD_PLATFORM_UNSAFE')):
@@ -117,6 +122,7 @@ class CloudPlatform(models.AbstractModel):
environment_name = config['running_env']
self._check_s3(environment_name)
self._check_redis(environment_name)
self._check_metrics(environment_name)
@api.cr
def _register_hook(self, cr):
+1
View File
@@ -1,3 +1,4 @@
boto==2.42.0
redis==2.10.5
python-json-logger==0.1.5
statsd==3.2.1