I am running a Ubuntu Linux server with Apache, wsgi, django and mysql on it. Recently something happened and the wsgi processes frooze up. Restarting apache solved the problem. As with many live systems, it's better to get the system back up and running rather than poking around. However we are having trouble diagnosing the problem, since everything looked fine, and we don't know the full state of the problem now.
Is there any tool/command (on linux/debian/ubuntu (or any other *nix flavour, I'm fine with compiling any command)) that, when invoked, will write to a file some details about the state of the system as it is now? If/When this happens again, we can just run this command, then get down to fighting some fires (restarting apache/the server etc.), and then later, we can try to diagnose the problem.
Wishlist of things it would record:
- CPU status (and various types)
- Process list & various detailed
- Details of file system usage
- List of all open files (and what process has them, etc.)
- List of all open internet connections
- (If possible) Details of what our mod_wsgi processes are doing
- MySQL status: current queries that are being run, etc.
- (maybe) run strace on apache/mysql/mod_wsgi for a few seconds to collect some data of what they are doing, and save this to a file.
- Anything else I'm forgetting?
In theory this is a simple set of commands and if no-one else has done this, then we'll just write our own scripts, but it would be better if we can use a proper tool.