ContributionsMost RecentMost LikesSolutionsRe: Data for groovy script in complex datapoint Thanks Stuart - now at least I know in which direction should I go 😄 Data for groovy script in complex datapoint Hi I have a question regarding using data in complex datapoint. Long story short - I need to use base-10 logarithm for some calculation - in complex datapoint I can use only log function so my idea is to use groovy script and then I can use Math.log10 DS is using SCRIPT for discovery method and another groovy script is collecting attributes/data. I would like to use data which is displayed in Normal datapoints (##WILDVALUE##.something). Is there any smart way to process/get that data in complex datapoint groovy script ? (without pooling device again as it is already done in "Collector Attributes") Re: Problem with fetching instances from device Hi Stuart, Thanks a lot - I owe You a beer Replacing dataSourceID with id did the job - now everything is working. Quote They are tied to the "hdsId", which is the ID of the datasource as it's applied to that device and it's unique for that one device. Now I see that dataSourceID is the ID of DS which is in Settings/LogicModules but ID is unique for each device - that make sense. Regarding SDK - I tried it, but I have to use proxy for all my requests and couldn't find a solution for that - maybe someone already figure this out ? Problem with fetching instances from device Hi I'm quite new with LogicMonitor so sorry for maybe obvious question - I'm trying to get list of instances for specific datasource from specific device via python script It should be fairly easy as it pretty well described in documentation First I get list of DS's from device with this: https://www.logicmonitor.com/support/rest-api-developers-guide/v1/datasources/get-datasources-associated-with-a-device And then I want to use the data provided in this script: https://www.logicmonitor.com/support/rest-api-developers-guide/v1/datasource-instances/get-datasource-instances I get the list of DS's where instance number > 0 but when I try to get instances I always get "DeviceDataSource(xxx) is not found for device(id=yyy)" Below is my super simple script but I cannot find where is the issue - it is build based on scripts from LM doc As an output I get datasource ID and name of it - e.g. when I gather information from Cisco switch I get xx - BGP- DeviceDataSource(xx) is not found for device(id=yy) zz - Network Interfaces DeviceDataSource(zz) is not found for device(id=yy) And I'm sure that there are instances for BGP or Network Interfaces so don't know why I always get "not found" import requests import json import hashlib import base64 import time import hmac from pprint import pprint AccessId ='_accessid_' AccessKey ='_accesskey_' Company = '_companyname_' httpVerb = 'GET' deviceID = '_deviceid_' proxies = { "http" : "_httpProxy_", "https" : "_httpsProxy_", } def getData(rP, qP): url = 'https://'+ Company +'.logicmonitor.com/santaba/rest' + rP + qP #Get current time in milliseconds epoch = str(int(time.time() * 1000)) #Concatenate Request details requestVars = httpVerb + epoch + rP #Construct signature signature = base64.b64encode(hmac.new(AccessKey,msg=requestVars,digestmod=hashlib.sha256).hexdigest()) #Construct headers auth = 'LMv1 ' + AccessId + ':' + signature + ':' + epoch headers = {'Content-Type':'application/json','Authorization':auth} #Make request response = requests.get(url, headers=headers, proxies=proxies) return response.json() resourcePath = '/device/devices/' + deviceID + '/devicedatasources' queryParameters = '?filter=instanceNumber>0' devDSs = getData(resourcePath, queryParameters) for x in devDSs['data']['items']: print(str(x['dataSourceId']) + " - " + x['dataSourceDisplayName']) resourcePath = '/device/devices/' + deviceID + '/devicedatasources/' + str(x['dataSourceId']) + '/instances' queryParameters = '' resp = getData(resourcePath, queryParameters) print(resp['errmsg']) Solved
Top ContributionsData for groovy script in complex datapointProblem with fetching instances from deviceSolvedRe: Data for groovy script in complex datapointRe: Problem with fetching instances from device