pmeyer Posted April 20, 2017 Share Posted April 20, 2017 I want to have a report that will give me all devices that are currently under an SDT, that will show the device name, SDT Start Date, SDT End Date, and the comments of the SDT> 1 1 Quote Link to comment Share on other sites More sharing options...
chendricks Posted September 4, 2018 Share Posted September 4, 2018 same here Quote Link to comment Share on other sites More sharing options...
krutaw Posted September 7, 2018 Share Posted September 7, 2018 On 4/20/2017 at 1:58 PM, pmeyer said: I want to have a report that will give me all devices that are currently under an SDT, that will show the device name, SDT Start Date, SDT End Date, and the comments of the SDT> Do you mean within the web GUI? This functionality exists in the API: https://www.logicmonitor.com/support/rest-api-developers-guide/v1/sdts/get-sdts/ 1 Quote Link to comment Share on other sites More sharing options...
Barb Posted April 14 Share Posted April 14 We would also like this feature request Quote Link to comment Share on other sites More sharing options...
Barb Posted April 28 Share Posted April 28 On 4/14/2022 at 3:43 PM, Barb said: We would also like this feature request that will show the device name, SDT Start Date, SDT End Date, and the comments of the SDT also the customer. A report that can be shown to customers. The one that comes from the api is not easily manipulated into excel from STD Output. Any suggestions on how to make this report easier to read. Quote Link to comment Share on other sites More sharing options...
Guest Stuart Weenig Posted May 2 Share Posted May 2 This script gets pretty close, I think: from lm import lm devices = lm.get_device_list(size=1000).items sdts = lm.get_sdt_list(size=1000).items r = {} for device in devices: r[device.id] = {"display_name": device.display_name, "name": device.name} r[device.id]["device_sdt"] = [s.to_dict() for s in [sdt for sdt in sdts if sdt.type=="DeviceSDT"] if device.id == s.device_id] r[device.id]["group_sdt"] = [s.to_dict() for s in [sdt for sdt in sdts if sdt.type=="DeviceGroupSDT"] if s.device_group_id in [int(i) for i in device.host_group_ids.split(',')]] print("device_id,display_name,name,sdt_type,sdt_start_time,sdt_end_time,sdt_timezone") for k,v in r.items(): for ds in v['device_sdt'] + v['group_sdt']: print(f"{k},{v['display_name']},{v['name']},{ds['type']},{ds['start_date_time_on_local']},{ds['end_date_time_on_local']},{ds['timezone']}") Uses my own personal library to build the Python SDK object called lm. Doesn't do pagination on the device, list, but that wouldn't be too hard to build. This also may output multiple lines for a single device, if multiple SDTs apply to the same device. Wouldn't be too complicated to flatten the list. This is what the output looks like on mine: device_id,display_name,name,sdt_type,sdt_start_time,sdt_end_time,sdt_timezone 58,LogicMonitor,lmstuartweenig.logicmonitor.com,DeviceGroupSDT,2022-05-02 10:25:00 CDT,2022-05-02 11:25:00 CDT,America/Chicago 62,Zoom,logicmonitor.zoom.us,DeviceGroupSDT,2022-05-02 10:25:00 CDT,2022-05-02 11:25:00 CDT,America/Chicago 78,Skilljar,status.skilljar.com,DeviceGroupSDT,2022-05-02 10:25:00 CDT,2022-05-02 11:25:00 CDT,America/Chicago 103,ConnectWise,staging.connectwisedev.com,DeviceSDT,2022-04-12 12:57:00 CDT,3022-04-12 14:57:00 CDT,America/Chicago 140,api.exchangeratesapi.io,api.exchangeratesapi.io,DeviceSDT,2022-05-06 20:00:00 CDT,2022-05-07 19:45:00 CDT,America/Chicago 140,api.exchangeratesapi.io,api.exchangeratesapi.io,DeviceSDT,2022-05-07 19:45:00 CDT,2022-05-08 19:30:00 CDT,America/Chicago 197,buttonmusic.local,buttonmusic.local,DeviceSDT,2022-03-23 10:23:00 CDT,3022-03-23 12:23:00 CDT,America/Chicago 239,boxxy.local,boxxy.local,DeviceSDT,2022-04-04 14:47:00 CDT,3022-04-04 16:47:00 CDT,America/Chicago Hopefully I'll have some time today to repost my lmwrapper module (i had to pull it off github). Quote Link to comment Share on other sites More sharing options...
Guest Stuart Weenig Posted May 2 Share Posted May 2 LM Wrapper is here: Quote Link to comment Share on other sites More sharing options...
Barb Posted May 5 Share Posted May 5 On 5/3/2022 at 2:26 AM, Guest Stuart Weenig said: LM Wrapper is here: Thank you very much, i will give this a try as soon as i can Quote Link to comment Share on other sites More sharing options...
Barb Posted May 11 Share Posted May 11 Confirmed this is almost there and is formatted much nicer to work with. Thank you so much. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.