Praise be to Allah, the Lord of the Worlds; and may His blessings and peace be upon our Prophet Muhammad and upon all his Family and Companions.
The Hadith you mentioned is related by al-Tabarani, Ibn Hibban, Abu Y'ala and others. al-Albani regarded it as sound. This Hadith states that: Unjust and wicked rulers will come after the Prophet (Sallallahu Alaihi wa Sallam). They will take wicked people as close companions in order to help them in falsehood and sin; they will put aside good people since they refuse to sanction their falsehood and aggression.
Thus, the Prophet (Sallallahu Alaihi wa Sallam) advised Muslims who may live in that time, i.e. co-exist with such bad rulers, to avoid taking positions as: (1) a monitor, who tells the ruler about the people's situations, (2) a policeman, who helps the ruler to put laws into practice, (3) a revenue officer, who is incharge of levying Zakah and taxes or (4) treasurer.
Allah knows best.