Cody Herzog

  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Cody Herzog

  • Rank
    Community Member
  1. Thanks very much, Mike. > I generally don't like to have LM DataSources attempt to communicate back to LM itself, I personally find it a bit hacky and avoid it unless there isn't another solution. Agreed. It feels icky to me too. > Try looking at Complex DataPoints rather then have a DataSources that attempts to re-process it's own data. My impression is that complex data points cannot go back in time to look at older samples. If that's true, then I don't think they will meet my needs in this instance. The alert logic needs to look at the last hour of history and make decisions based on statistics/trends over that hour. Is there any way to do that without using the REST API? > I'm not sure you can use python or other languages in DataSources, or you would atleast need to install those langueses on all your collectors. Yes. I ran into problems trying to use Python for external script data collection shortly after sending my first message. > There is a section of the LM APIv1 docs with different language examples at, you will also find various examples in the community and on Mike Suding's Blog (this is a great resource). Awesome. That's just what I was looking for. I'll tinker around with doing it in Groovy, but I'm still hoping there's a better way which doesn't require LM communicating with itself with the REST API. Here are some alternatives for which I've searched, but could not find: 1.) Complex data points being able to access older samples. 2.) Complex trigger expressions which support logic such as min/max over certain time ranges. Thanks again.
  2. Hello. We're in the process of migrating some complex alerts from Zabbix to LogicMonitor, and I'd like to be sure we're on the right track. Here's an example of some complex alert logic using the builtin Zabbix expressions and operators: ( {-MyTemplate:MyDataItem.last()} >= 10 ) or ( ( {-MyTemplate:MyDataItem.last()} > {-MyTemplate:MyDataItem.prev()} ) and ( {} >= 3 ) and ( {,1800)} >= 1 ) and ( {-MyTemplate:MyDataItem.last()} = {-MyTemplate:MyDataItem.max(3600)} ) ) At a high level, this is analyzing various metrics across the recent history of a certain data point. My understanding is that the best way to achieve this in LM is to create a custom scripted data source that uses the REST API to access the raw data for the desired time window, and then have the custom script process the data as desired. Is that correct? If so, what type of scripting is recommended for this? Groovy, PowerShell, or external? Most of the REST API examples I've come across use Python, so is that recommended? If not, are there any examples of using Groovy or PowerShell to access the REST API? Regarding the best API endpoint(s) to use, I suspect it would be one of these: I started playing around with those, and the one thing that's not obvious to me is the best way to deal with the device data source ID. I know that it can be obtained through the following API: However, I was expecting to be able to pass the device data source ID in to my script as a parameter, or to have it available as a builtin variable within a groovy script, similar to ##system.deviceId##. Is that not possible? If not, then would I have to make two REST API calls in my script. The first one to get the device data source ID, and the second one to get the actual data? I assume there is no dedicated REST API data source collection mechanism which would take care of all the authentication and other boilerplate stuff. Is it correct that there's no way for a scripted data item which uses the REST API to implicitly inherit the authentication context from which the script is being called? Thanks very much.