Recommendations for programmatically checking your environment using Python?

I am building a system with dependencies such as Apache, Postgresql and mod_wsgi. As part of my deployment process, I would like to write a health check script that tries to determine if the server environment meets various assumptions, the most basic of which is the installation of dependencies.

Checks I reviewed:

  • Check if the service is responding, for example. make an HTTP request, connect to the database, etc.
  • Check how the service works, for example. perhaps grepping ps ax ? (It seems unreliable)
  • Make sure the package is installed, for example. through the dpkg request.

They obviously go in decreasing order of specificity, I hope that if one test fails, I can find out why by doing a more specific test.

But where to stay? How many levels of specificity should I check? Are there any best practices for this kind of thing?

Thanks!

+4
source share
1 answer

I would run the program and execute the correct attempt. In addition, at the place of the first use of the function, the user does not have enough in the information message (db is not installed, installed, but does not work, etc.)

+1
source

All Articles