Monitoring your environment
Your infrastructure team may be interested to monitor whether the frepple application is in a healthy state.
A addon monitoring app can be activated. It checks the following conditions, and replies with an OK message:
Log directory must have sufficient free disk space.
Database must have sufficient free disk space. (This check is only implemented if the PostgreSQL runs on the same server as the application web server).
RAM usage is low enough.
The following steps are required to configure and use the monitoring:
Update djangosettings.py
Add the app to the INSTALLED_APPS settings, and restart the web server.
INSTALLED_APPS = ( ... "freppledb.monitor", )
Point your monitoring tool to the monitoring URL
The monitoring URL requires authentication. It is recommended to create a dedicated user account for the monitoring and to generate an access token for that user. A token can be generated with the command “frepplectl generatetoken <user> –expiry=365”.
Your monitoring tool must ping the monitoring endpoint in the same way as this curl command:
curl -H 'Accept: application/json' --header 'Authorization: Bearer ACCESS_TOKEN' https://YOURSERVER/monitor/
The endpoint returns a JSON object as in the examples below:
{"status": "OK"} {"status": "WARN", "warnings": ["Running low on memory"]} {"status": "ERRORS", "errors": ["Disk full in log directory"]}