Once you have established how much the roof sag needs to be jacked up lay a 2x4 plate across the ceiling joists and nail directly under the ridge of the roof.
How to correct roof sway.
Sagging rafters can lead to serious problems with the entire roofing system.
Now add collar ties from one side of the rafter to the other.
Traditional sloped roofs rely on the strength of triangulation.
If you glue three popsicle sticks together at their ends to form a triangle you ve got a decent model of how a roof frame works.
It you consider a short bit of roof and a post as a t then the way its going to move is the top from left to right.
Holding the triangle upright the angled sticks that meet at the top are the rafters.
They should be slapped on the face on the post and the roof timbers on all post and around the corners as well.
First perform step 2 except keep the string under your beam and off to the side a bit to make room for some framing.
The horizontal stick at the bottom is the rafter tie.
Bracing it with a bit of 3 x 1 screwed on in your axis means there is very little bearing surface.
Sometimes this sagging is cosmetic other times repairs are called for to prevent actual collapse of the roof.