Solved

Get all of ping-multis on a collector


Userlevel 1
Badge +3
  • Neophyte
  • 20 replies

Hi there

I’m using the LM SDK to pull data from LM. I’m looking to pull a list of ICMP Ping-Multis configured on the collector. 

Which sdk call should I be using here and does someone have an example for me of what the call will look like?

Thank very much.

 

api_instance.get_device_datasource_by_id(
api_instance.get_device_datasource_by_id_with_http_info(
api_instance.get_device_datasource_data_by_id(
api_instance.get_device_datasource_data_by_id_with_http_info(
api_instance.get_device_datasource_instance_alert_setting_by_id(
api_instance.get_device_datasource_instance_alert_setting_by_id_with_http_info(
api_instance.get_device_datasource_instance_alert_setting_list_of_device(
api_instance.get_device_datasource_instance_alert_setting_list_of_device_with_http_info(
api_instance.get_device_datasource_instance_alert_setting_list_of_dsi(
api_instance.get_device_datasource_instance_alert_setting_list_of_dsi_with_http_info(
api_instance.get_device_datasource_instance_by_id(
api_instance.get_device_datasource_instance_by_id_with_http_info(
api_instance.get_device_datasource_instance_data(
api_instance.get_device_datasource_instance_data_with_http_info(
api_instance.get_device_datasource_instance_graph_data(
api_instance.get_device_datasource_instance_graph_data_with_http_info(
api_instance.get_device_datasource_instance_group_by_id(
api_instance.get_device_datasource_instance_group_by_id_with_http_info(
api_instance.get_device_datasource_instance_group_list(
api_instance.get_device_datasource_instance_group_list_with_http_info(
api_instance.get_device_datasource_instance_group_overview_graph_data(
api_instance.get_device_datasource_instance_group_overview_graph_data_with_http_info(
api_instance.get_device_datasource_instance_list(
api_instance.get_device_datasource_instance_list_with_http_info(
api_instance.get_device_datasource_instance_sdt_history(
api_instance.get_device_datasource_instance_sdt_history_with_http_info(
api_instance.get_device_datasource_list(

api_instance.get_device_datasource_list_with_http_info(

 

 

 

icon

Best answer by Stuart Weenig 16 March 2023, 20:28

View original

10 replies

Userlevel 1
Badge +3

Ignore this, I solved it. I don’t seem to be able to delete this post. 

Userlevel 1
Badge +3

Sorry, I thought I had this working. I can pull a list of ping-multi using the following SDK command:

get_device_datasource_instance_list(device_id, device_data_source_id)

The strange thing is it’s only returning 50 items but there are a lot more then 50 of them configured. Here is the code I am using:

ping_multi_dict = {}
end_found = False
offset = 0
size = 10000
while not end_found:
ping_multi_call = api_instance.get_device_datasource_instance_list(device_id, device_data_source_id)
ping_multi_dict.update({record.id: record for record in ping_multi_call.items})
offset += size
end_found = len(ping_multi_call.items) < size

counter = 0
for k,v in ping_multi_dict.items():
print (k,v)
counter += 1

print (counter)

Any help appreciated here.

Thanks

Userlevel 6
Badge +14

You need to add a size=1000 parameter to your get_device_datasource_instance_list() call. The default return size is 50. Max is 1000. If you’re going to have more than 1000, you’ll need to do some pagination. I’ll see if i can find my post where i explain how to do pagination with the sdk.

Userlevel 6
Badge +14

 

Userlevel 1
Badge +3

Thanks, that’s done the trick. It would be good to just have an option in the sdk call of pagination = yes or something like that. Or just return full results by default? 

P.S I did have 1000 originally but I was trying all sorts to get a full response. 

Userlevel 6
Badge +14

That would be nice. If i were smart enough in python, i’d add it to my lm_wrapper. @BMAC could probably do it.

That reminds me, I need to add my LM Logs SDK action logger functions (simple function to send logs from an sdk script to LM Logs) to the lm_wrapper.

Userlevel 1
Badge +3

That would be nice. If i were smart enough in python, i’d add it to my lm_wrapper@BMAC could probably do it.

That reminds me, I need to add my LM Logs SDK action logger functions (simple function to send logs from an sdk script to LM Logs) to the lm_wrapper.

 

Sounds great, will keep an eye out.

 

Thanks again

Userlevel 1
Badge +3

Out of interest, am I going to hit the same issues with these calls?

api_instance.get_dashboard_group_list()
api_instance.get_widget_list_by_dashboard_id()

Do I need to re-write those with pagination as well?

Thanks

Userlevel 6
Badge +14

Yes. All of them have the potential of paginating the results. 

Userlevel 1
Badge +3

Yes. All of them have the potential of paginating the results. 

OK thanks.

Reply