Go to official cgminer and get one of the API programs.
https://github.com/ckolivas/cgminer(I wrote the API)
We've got C, PHP, Java (and Java class file), Ruby and Python code there
Via the java class the main stats you are probably looking for would be:
java API stats IPAddressOfMiner
The miner needs to have the API set to allow the (remote) computer you are running the API command on
(which it may already)
Read the API README for full details ...
https://github.com/ckolivas/cgminer/blob/master/API-README