LM SDK update_device_datasource_instance_alert_setting_by_id (and auto.interface.ifindex vs system.instanceId)
All,
So I used the Logicmonitor_sdk to pull the device id, instance id, instance wild value, and the datasource id on the device, because my goal was to try to use the API to set an alert threshold on InMbps for a modified clone of Network Interfaces.
I'm sure I have the right numbers, because all my api pulls show in the response the values I'm using.
device_id = 31068
datasource_id = 2106068
instance_id = 12776109
instance_wild_value = 37978112
alert_setting_id = 18572
Original Body values for the alert setting I pulled, if I were to try to set it to the exact same thing:
body = {
"global_alert_expr":'',
"alert_clear_interval":0,
"disable_alerting":False,
"alert_expr_note":'',
"data_point_description":'Inbound throughput, in megabits per second.',
"data_source_instance_id":12776109,
"disable_dp_alert_host_groups":None,
"data_point_name":'InMbps',
"data_point_id":18572,
"device_group_id":10895,
"parent_device_group_alert_expr_list":[],
"alerting_disabled_on":None,
"id":18572,
"data_source_instance_alias":'1/2/7, 10/100/Gig Ethernet SFP, "eNodeB001-LTE-e" [ID:37978112]',
"device_group_full_path":'blah/blah/WSAE/All Devices/7705 DES',
"alert_expr":'',
"alert_transition_interval":0
}
Body I'm actually attempting to set:
body = {
"id":18572,
"alert_expr":'>= 99 99 99'
}
#from SDK DOCS: update_device_datasource_instance_alert_setting_by_id(deviceId, hdsId, instanceId, id, body)
update_response = api_instance.update_device_datasource_instance_alert_setting_by_id (device_id, datasource_id, instance_id, alert_setting_id, body)
print (update_response)
RESULTS: when I call the update on the alert setting, I get an OK response, and a response body IDENTICAL to the body I got when querying the alert setting BEFORE my change. So it seems this call did NOT actually do anything, aside from give me an OK response with an unchanged body.
QUESTIONS:
1) Has anybody else used this method? Does it just not work? I am pretty sure I have all the right numbers for the params because when I dont, an error happens.
2) what is the difference between auto.interface.ifindex and system.instanceId ? The API tells me different values for instance ID and instance WILD ID. Instance ID corresponds to system.instanceId on the instance's info (in the UI), and the WILD ID corresponds in the UI to auto.interface.ifindex, and is also the [ID: blah] shown on the display name.
So I'm just hoping someone can see anything I'm doing wrong in terms of maybe using the wrong values conceptually in the code above, or if you've experienced the same problem of the update just not doing anything, or even knowledge of the difference between auto.interface.ifindex and system.instanceId.
Thanks!!