I am not sure about the term: "the rod of the wicked" as to whether it is referring to God's rod against the wicked or the rod of wicked men themselves. Either way, it will not touch the righteous as God will take care of them.
Next there is an exhortation by David or whomever wrote this Psalm: "Do good unto those that be good, and to them that are upright in their hearts." He pronounces a certain judgment for the wicked and pronounces peace for the upright in Israel. What can I apply to myself out of all this? If I walk with God uprightly in all my ways, He will be to me like the mountains around Jerusalem, solid. Like Zion, I will not be moved. However, if I turn aside: look out. There is no telling what could happen.