I'm convinced that everyone will encounter mental health difficulties at some point in their life. Whether it's a brief period of unease, or a lifelong condition, we all have to be able to recognize the warning signs of a mental health crisis. I think of my mental health in the same way I think of my kidney stones; if I can recognize the early signs, I can start treatment before I'm curled up in a ball on the floor. This is obviously an overly-simplistic comparison for some conditions, but for the majority of us, it works. It's much easier to take control of your mental health before it takes control of you.
There is a lot of internet advice on how to manage your mental health, and recognize when you're in crisis. Here's some more:
A big part of managing mental health is establishing routines for self-care. I dedicated a blog post to self-care in 2015, but it basically boils down to what your 8th grade health book told you: sleep well, eat well, and get a bit of physical activity. Reviewing your routines, and discussing them with others can help you get a handle on what you need to change (if anything). Figure out what makes you feel best, and, equally important, figure out what makes you feel worse.
Track your mood.
There's conflicting information about how much sleep/food/exercise/etc. we need to feel good. The best way to figure out what makes you feel good is to track your mood, and see if you can find a pattern. Choose a technique that's easy for you to use every day. For you, it might be as simple as writing, "Slept 7 hours. Ate breakfast, lunch, and dinner. I felt anxious about work, but mostly fine." Another easy technique is sticking an emoji that represents your main emotion from the day at the top of your calendar/schedule before you go to bed. If you Google, "mood chart," you can find other, more complex examples. The most important thing to remember when you choose your technique is that whatever you end up with has to give you enough information that you can see if there are any particular patterns to what affects your mood.
Know your early warning signs.
If you have routines, and track your mood patterns, then knowing and recognizing early warning signs becomes a lot easier. With most mental health conditions, you'll likely experience a change in your sleeping patterns, eating habits, and activity level. There are other signs that are more specific to certain diseases, but changes in any of those three routines are generally the first indication that something is off. At this stage, you need to start treatment. Treatment might entail going to bed earlier, or taking a walk during lunch. It might require medication and counseling. Whatever else you decide to do, make sure you tell someone. Reaching out to others at this stage can prevent a freefall.
Find a trusted friend.
"No man is an island." Having a friend (or psychiatrist, or counselor, or parent, or ecclesiastical leader) keeping tabs on you will help you weather upheavals in your mental health. When you are struggling, tell them. Sometimes we have a mistaken belief that it's better to suffer in silence. Truthfully, it's exhausting, isolating, and counterproductive. Friends can help you maintain your routines, and assist you when you're starting to slip. Friends can help pull you up when you've fallen.
Create a list of reasons to keep going.
Despite your best efforts, you might find yourself in a crisis situation. If it gets to that point, having a list of reasons to keep going is a lifesaver, sometimes literally. Make a list of all the reasons you need to be alive, and functioning. Among other people and things, my list includes my child, my spouse, my dog, my elderly neighbor who likes my postcards, and the fact that I haven't tried bungee jumping yet. Make your list now, when you think you don't need it.
If you're in crisis right now, reach out to the National Suicide Prevention Lifeline (U.S.). If you're living abroad, this website maintains a list of international helplines: http://www.suicide.org/international-suicide-hotlines.html
Take care of your mental health.