Like so many things in life, good running posture starts with the head. When the head tilts in any one direction, the body shifts off its optimal support axis which causes you to compensate—and generally become discombobulated.
The head tilt and gaze are usually connected, so when you run, let your gaze guide you: Look out ahead naturally and scan the horizon (unless you're on a technical switchback in the Pyrenees, Killian Jornet–style). That'll straighten your neck and back into one line. If this doesn't work, try imagining a straight line so the weight of your head is carried down through your feet.
Doing this right can improve oxygen flow and conserve energy.
Unless you're trail running, work on not looking at the ground, not stretching your neck or jutting out your chin like Jay Leno. Poor head posture can lead to fatigue and injury.
For those pre-meds out there, get this: The head has a serious influence on your running because of the vestibular apparatus in the ears and cerebellum directly defining and regulating the body's position in space. If you doubt it, try running while vigorously shaking your head—ha, thought not. This regulation is accomplished through the neck muscles, which provide balance to the head and extend their influence to the rest of the muscular system of the body.
What is the optimal distance of gaze? 10 meters? 40 yards? What's a meter? Who knows. The thing to keep in mind is keeping your head in a straight line with the weight supported down between the shoulders through the hips to the balls of your feet—like when you carry baskets on your head. (In fact, that's our next mile competition.)
You will not—or should not—find a machine like this to warn you each time you slouch. Instead, try to internalize it.