Hi Danyel,
For the sentence "You ought to have known it", notice the phrase "have known". In this context, you are telling the other party that he or she should have obtained some knowledge of something as a reflection.
For example: "If they had known of the danger, they would not have entered the cave."
In this case, they had entered the cave. Probably they got into some danger. After they escaped, they reflected about the entire incident and felt that if they knew of the danger BEFORE they were about to enter the cave, they would not do so.
I hope this helps.
Cheers,
Lance