None of this adds up, read the story. The FBI “mistook” a Petraeus email for a reference to corruption. Using that as a ploy, they proceeded to monitor his affair and get every salacious detail, some of which they are leaking to the press.
This was done to get him when they wanted to get him.
It adds up perfectly: they already had the goods on him when they nominated him to head the CIA—a classic compromised pick.