Often times I find myself with cramps in the muscles on the sides of my knees (or the ligaments, I am not sure which). This happens most often during or after a sustained inclined climb. What should I do to relieve the pain? Massaging it doesn't really help.
The knee is a complicated area of the body, and joins the shoulder as a common area for imbalances in sport and extreme adventuring. In my circle of climbers and extreme sport enthusiasts, knee and shoulder issues are common over time. Your first port of call should be a doctor specialising in sport injuries, or a physiotherapist. Given how small tears can manifest over time, these joints and load bearing areas need special attention.
I won't give specific advice, but I will point out that you can not "stretch" all areas of your leg muscles in regards to knee pain. I found a lot of progress in my own training and repair cycle when I incorporated a foam roller. See here for Leg Rollers. And a Youtube video for bonus points.
Knees are complicated, so a medical expert will help focus on the cause and area of effect. In my case, an imbalance due to mountain biking and rock climbing meant I could bash my way up a mountain, but descent would be a painful exercise. Especially on multi-days or when cooled off.
My own training routine, set by a phsyiotherapist friend, introduced exercises and drills that I would either never have done, or did not think to do. These included modified squats, foam rolls, wall sits, step jumps and other exercises for stability. In short, it not only formed a part of treatment of a minor injury at the time, but changed assumptions on what injuries I had come to live with (or expect). Well worth the effort!