This problem raises some questions:

Is it ok for a country to spy on other countries - friend or foe - as it pleases?

I suppose you can say that it's okay for them to TRY. What's NOT okay is for a county to use technology to spy upon others, then bitch and moan when those others are found to be spying on them.

Is it a threat to democracy?
A tricky question. Is spying on Brazil a threat to democracy in the US? Probably not. In fact, spying on some countries (not necessarily Brazil) could be of benefit to democracy, not only in the US but in the rest of the world. BUT, spying on your own citizens is a threat to democracy, since a part of democratic freedoms is the freedom to remove incompetent or dangerous leaders through free elections. Spying on people in order to limit that freedom is a definite threat to democracy.

Is it time for the countries to make their own IT net?
I don't know about that. Half the politicians in THIS country don't seem capable of dealing with a postage stamp, much less the complexities of email.

Will the WWW fracture if that happens?
I think governments might fracture before the internet does. Hell, half the twelve year olds in the world can hack into just about any infrastructure, it seems. What makes them think that any such IT network would be safe from them?

Should the UN over guidelines for spying, and be equipped to see that they are followed?
The UN is a failed, ineffective, impotent organization, incapable of doing anything that any one member of the Security Council doesn't like. Any "guidelines" it might develop would be ignored whenever it suited those members to do so, and nothing could be done to stop it.