If your rack is plugged into a proper receptacle, it is ALREADY grounded - that's the reason you're getting a static shock.
If the humidity is low and/or the carpet has a high nylon content, the situation will be worse.
Short of getting new ANTI STATIC carpet, one trick that usually helps -
Go buy 2 or 3 bottles of FANTASTIK (this is a particular BRAND name) household cleaner, tilt your rack back using blocks under the front edge (or just move it out of the way)
Now, take the FANTASTIK spray and WET DOWN the carpet where the rack will sit on it, and in a radius around the rack where you could be standing when you touch it, and let it dry.
(If you care a lot about the carpet, test by wetting a patch somewhere out of sight and watching it for a day or two, first) -
After the carpet is dry, put the rack back where it was and test the "shock value" - usually, it will be reduced or completely gone.
The reason this works is that FANTASTIK has a pH of about 12, and is fairly conductive. What you're doing is essentially converting your carpet to the anti-static variety.
Any time you shampoo the carpet, you'll need to repeat this treatment... Steve