I spent a good amount of time researching magnesium due to a long story :( Magnesium is absolutely critical for human health and is greatly overlooked. It is a low ball estimate that it is involved in over 350 enzymatic functions and control much of the other mineral absorption and utilization such as potassium and sodium mainly through the adrenal axis.
Calcium is also an antagonist and agonist meaning it has both positive and negative effects on magnesium and vice versa (magnesium can influence calcium). Endocrine status can play a big part in magnesium absorption and utilization - for instance high adrenal activity will reduce magnesium stores. High adrenal activity results from stress which includes not only emotional, mental but biological stress (infections like protozoa).
Testing is indeed tricky and serum levels never represent true stores of magnesium which is a more essential factor than serum. RBC magnesium is more of a true indicator of magnesium stores but it is not reliable. The best test than you can do is TMA testing (hair) which has its critics but studies have shown it reliability. Finding the right lab is important, I use Trace Elements and can facilitate this if interested .http://www.traceelements.com/ Cost is around $100.00. They test all mineral status and can evaluate endocrine factors as well. There is another lab which is Exatest that uses cell scraping in the mouth, last time I checked it was expensive. http://www.exatest.com/
Vitamin D status should be checked which also plays a factor in magnesium, most people have low levels and I would imagine those who have chronic infections that the levels are even lower. Vitamin D is not only synergistic with magnesium but has influences on immune, neurological and endocrine health.
The form of magnesium is a consideration as well. For instance magnesium can come in many forms such as chelate, glycinate etc, magnesium oxide is what is found in most supplements and they use because it is cheaper, unfortunately it is not very bio-available. Forms that seem to be good for me include chelate, glycinate, lysinate - Source Naturals makes a comprehensive magnesium formula call UltraMag that has over 5 different forms. Natural sources of magnesium include most of the food we should be eating, dark leafy greens, nuts, seeds and whole grains.
For resource material, Dr. Mildred Seelig was the premier and authority on magnesium, you can access her articles here >> http://www.mgwater.com/seelig.shtml