What is done about academics who do not do research anymore, or who teach badly? There are two loosely related questions here:


What is done about academics who do not do any research anymore?
What is done about academics who teach badly enough that it shows up?


I insist that I am asking what is done, in your department or institution (or in your country if it is uniform). I'll ask a separate question about what should be done. I would also like to distinguish between status (e.g. if you are talking about tenured faculty, please say so), and I am mostly but not only interested in tenured faculty.

Added: implicit in the question, as was mentioned in an answer, is the way an institution measures the research and teaching activities. Answers are welcome to describe the way these are measured to decide whether to take action, but please stick to what is actually done.

To give a little context, from 2009 there are recurring discussions about the teaching duty of academics in France, and whether it should be adapted to their achievements. I would like to have a broader view of the various answers actually given around the world to this issue.
The answer to both your questions will, from my perspective, be "not much". So this answer describes the view from my local point. 

As a basis, university positions in my realm are teaching positions, 70% teaching and 30% for admin, personal development and research. The 30% is very quickly consumed by everything but research. On top of that one can "buy" oneself out of teaching so that the research time essentially is based on soft money. If you do not do research well, then no money comes in and your teaching load increases towards the 70%. So as long as you do your job in some way there is no mechanism for "correcting" a lack of research. On the other hand senior academics often get involved in higher and higher level administrative work at university, governmental, etc. level so a lack of research as such may be replaced by benefits gained in other ways. But, basically, a lack of research simply means teaching more.

If your teaching is very poor there is not much that can be done. Employment laws are very strong. The only way to sack a person would be if they, for example, drink at work, or blatantly refuse to accept orders from the "boss" (head of department etc.). It is also possible to remove someone if it can be shown that there is no need for whatever profile the person was employed under. I really cannot provide a detailed description of employment laws here but they make sacking people a difficult way out. Persons failing with teaching will most likely first be placed to do other duties. I have experience with one such person and it is hard to find tasks where this person can function and contribute.

So the "not much" is largely explained by employment laws in "my" case. The problem cases, which do not easily contribute in alternative ways, will cause lots of work for the department to find ways in which they can be made productive to the department. This will be successful in most cases but not so in the odd case.