Flask Series: Healthcheck and Monitoring

Tuesday, Dec 22, 2015 22:21 · 382 words · 2 minutes read

Flask Series

  1. Prepare the Environment
  2. Structure the Application
  3. Application Configuration
  4. Templating
  5. Model
  6. Testing
  7. Views and Web Forms
  8. Error Management
  9. Security
  10. Optimizations
  11. Healthcheck and Monitoring
  12. Internationalization
  13. Deployment

One of the major parts in the application lifecycle is the monitoring. It is providing information how your application is performing, helping you easily to identify and resolve issues. Based on the application monitoring you could gather usage statistics, trigger actions, etc.

What should be monitored?

You have to consider monitoring both the web server and the Flask application.

Web Server Monitoring

  • CPU utilization
  • Memory usage
  • Network traffic
  • Disk capacity and usage

Application Monitoring

  • Runtime performance
  • Runtime errors and warnings
  • Rendering
  • Persistence data querying

There lots of monitoring tools that can be used with your Flask Application.

Zabbix

Zabbix is an enterprise open source monitoring solution for networks and applications. It is designed to monitor and track the status of various network services, servers, and other network hardware.

ELK Stack

The ELK stack combines Elasticsearch, Logstash and Kibana.

Elasticsearch is a distributed, open source search and analytics engine, designed for horizontal scalability, reliability, and easy management. It combines the speed of search with the power of analytics via a sophisticated, developer-friendly query language covering structured, unstructured, and time-series data.

Logstash is a flexible, open source data collection, enrichment, and transportation pipeline. With connectors to common infrastructure for easy integration, Logstash is designed to efficiently process a growing list of log, event, and unstructured data sources for distribution into a variety of outputs, including Elasticsearch.

Kibana is an open source data visualization platform that allows you to interact with your data through stunning, powerful graphics. From histograms to geomaps, Kibana brings your data to life with visuals that can be combined into custom dashboards that help you share insights from your data far and wide.

Flask Healthcheck

Healhcheck is a Flask application that allows developers to implement their own monitoring checks for their applications – persistence storage state, environment information, etc. I have added simple check.py module, which demonstrates how to include Healthcheck in your application. Have a look how to implement custom check functions.

In the next blog post I will describe how to implement internationalization and localization support in your Flask application.

The complete demo application, described in this blog post, can be found here.
comments powered by Disqus

Buy Me A Coffee