Service Comment - How do I get content and comment ID?



I have the following problem:
There is a Nagios plugin creating cyclically service comments, containing additional information which expands status information. In case of an error service comments are created permanently, unfortunately therefore there are a lot of comments containing identical content. This is to be avoided.
My target is to create a kind of clean up plugin which supports the possibility of recognizing double-posted comments and delete them or of avoiding the creation.

My question: How do I acess the content and comment ID of a service comment at the java source code?

Thank you for help.