Capture system state into SQL database