Package monitoring has a good example too. It runs the command line (TOP) and inserts each response row in database.