Is get_counts and/or get_sums returning results if you run just that code block?
Also, in your final select, there is a cartesian join, you should have conditions to join there..
@SunilV do you have a SNMP listener enabled on your ServiceNow midserver?
https://docs.servicenow.com/bundle/washingtondc-it-operations-management/page/product/event-management/task/t_EMSNMPTrapEvent.html