Hi Akhil,
What you might want to try is using the API to query the NMS to get a list of devices, and then iterate through them with a snmpwalk, looking for ifOperStatus = down. Then count the results per device. If you have IBM's Rapid Infrastructure Automation (formerly Rapid Network automation) solution, you could create a workflow that would do this, outputting the results to a CSV file. One other item to consider would be to log and compare ifOutOctets on the ports to see whether the octets are incrementing between queries, in order to detect whether the ports are actually unused or just down for maintenance, etc. If the port isn't emitting any new ifOutOctets over time, then you are probably safe to assume that the port is free vs. just down for maintenance.