ContributionsMost RecentMost LikesSolutionsRe: Complex Datapoints - Nested if / elseif possible w/o scripting? Thanks Stuart! You were right: I must've had one too many/few parentheses/commas sprinkled in... Got the expression to work by doing the following: if(eq(ZoneModeHeat,1),5, if(eq(ZoneModeDry,1),4, if(eq(ZoneModeFan,1),3, if(eq(ZoneModeCool,1),2, if(eq(ZoneModeAuto,1),1,0) ) ) ) ) If I get the time, might look at converting to groovy as that would be significantly easier to read. Complex Datapoints - Nested if / elseif possible w/o scripting? Setting up some monitoring for an HVAC device and there is a request to track / alert on the current state/mode of HVAC zones (i.e. when they're not at the expected state). There is an HTTP interface that I'm using to get data. For the mode, the device returns that data in plaintext. Example: mode: Cool I've created normal "binary" Datapoints that do a text match to account for all the mode options and this is working as expected. So, for example, I have a ZoneModeCool datapoint that is 1 when that mode is active. I was then hoping to have a complex datapoint that looks at these and returns a single value that represents the mode (e.g. 1 for Auto, 2 for Cool, etc.). Problem I'm running into: groovy script can't access the normal datapoints (right?) and I can't figure out a way to do what I'm doing via RPN expressions. Wondering if those support nested if statements or elseif statements? Was trying something like this where I "nest" if statements, but LM tells me that's incorrect syntax: if(eq(ZoneModeHeat,1),5, if(eq(ZoneModeDry,1),4, [...] I know I can pull the raw data into groovy script... Was hoping to avoid that since I already have the normal datapoints but maybe that's the answer anyways? SolvedRe: Xpath woes Support was able to get me going on this. Not sure why but this is the syntax that works: /*[local-name()='GetValue']/*[local-name()='return'] And, to follow up on my own question, LM has no problem dealing with non-integer (decimal) values. @LMjosephBrett thanks for your help with getting this solved! Re: Xpath woes Thanks @LMjosephBrett and sorry about the delayed response. Ticket created; DM sent. Xpath woes Hey all, Been trying to figure out why this Xpath syntax is not working and I’m at a point where it seems like it’s an issue specific to LM… hoping someone knows of a fix/workaround. Abridged XML response that I’m getting from a device we want to monitor: <?xml version="1.0" ?> <BACrest:GetValue xmlns:BACrest="urn:BACrestService"> [...] <BACrest:return>75.034996</BACrest:return> </BACrest:GetValue > I’m trying to get the value inside BACrest:return. Using the XML section of this article as reference. Also using freeformatter.com as suggested here to validate my Xpath syntax. I’ve tried a bunch of various syntax options that all work largely as expected in freeformatter but don’t work in LM: I get either NaN or 0. I have verified that I’m getting the expected XML in the body of the response. Various syntaxes I’ve tried: BACrest:GetValue/BACrest:return /BACrest:GetValue/BACrest:return /BACrest:GetValue/BACrest:return/text() number(/BACrest:GetValue/BACrest:return) string(/BACrest:GetValue/BACrest:return) ...etc. Then I thought maybe LM needs to have an integer (is that a thing?) so I tried this: substring-before(/BACrest:GetValue/BACrest:return, '.') ...which returns just 75 in freeformatter. Ideas? Thanks! SolvedRe: JSON Path capability in a Webpage DataSource Thanks for the input @Isaac Paramo and @Stuart Weenig . Going to give this a go in the near future. JSON Path capability in a Webpage DataSource I think the answer to this is gonna be “You need to script it, dummy”, but figured I’d check anyway... I'm working on a new DataSource that pulls/interprets JSON data from a peudo-custom system via HTTP. The system has a status page that lists the status of various components using JSON elements that have this general format: ParameterName&ParameterType Initial idea was that I could use the Webpage collector since it supports JSON/BSON parsing. Issue I’m running into is that the values on most of these JSON elements are string (i.e. “true”/”false”). I set up a DataPoint that can extract that value by putting in the JSON Path like so: $.[##WILDVALUE##].[ParameterName&ParameterType] ...and I can see that I’m getting the “true”/”false” values back when I do a Poll Now. But - as we know - LM won’t deal with strings natively. Workaround I came up with was to get length of the string since true/false are different lenghts. According to sources online, JSON Path should support a calculation of string length. I've also verified that I can do this by pasting my data and my JSON Path expression: $.[ComponentName].[ParameterName&ParameterType].length ...into https://jsonpath.com/ In this parser, the .length function works as expected, and returns the length of the JSON value. However, in LogicMonitor, I'm just getting this (example failure): NAN after processing with json (postProcessParam: $.[ComponentName].[ParameterName&ParameterType].length, reference=, useValue=body) Anyone know if there is a way to make this JSON Path length function work? SolvedBest way to deal with "dynamic" SNMP data I think this may be a bit of a unique scenario but I also think there might be a better way to deal with this than what I've tried so far. We're setting up LM to monitor a Crestron control system using their SNMP interface. Crestron supports some of the standard SNMP MIBs for reporting health of the control processors (e.g. Host Resources etc.) and then has a separate "IO" MIB that allows for reporting the status of various devices/systems that the control processors interface with. The main part of that MIB that I'm working with is essentially a table of status parameters (DataPoints in LM lingo), with each entry having some info about the parameter like the name of the parameter and the associated device, the current status, high/low value descriptions, etc. Couple simplified examples for purposes of this discussion: Table Entry 1 "Audio System" <-- Device name "Online Status" <-- Parameter name 1 <-- current status "Online" <-- "1" description "Offline" <-- "0" description Table Entry 2 "Projector x" <-- Device name "Power Status" <-- Parameter name 0 <-- current status "On" <-- "1" description "Off" <-- "0" description My initial approach was just based on an SNMP DataSource with ActiveDiscovery. This works okay but then the DataPoint on every instance is just "Status" and I can't set different thresholds depending on the parameter name (afaik). Based on the above examples, I would want different thresholds for Online Status vs. Power Status. Specific question related to this: is there any way to set a DataPoint name and/or DataPoint thresholds based on data from Active Discovery (i.e. instance properties)? Any other ideas for the SNMP approach? The second option I'm trying is using a script-based DataSource where the script returns the proper DataPoint name/values (e.g. "Online Status=1"). In this scenario, I can make different DataPoints with different thresholds depending on the parameter. The issue I run into is that every instance will show all of the possible DataPoints for any instance whether they apply or not. This is slightly better than the previous scenario but we still end up with more noise/confusion than desired. Specific question related to this: is there any way to enable/disable or show/hide DataPoints on a per-instance level based on data from Active Discovery? Any other ideas on the script-based approach? If you've made it this far, thanks for taking the time! Re: Modify Alert trigger Interval on the Instance level In addition to the trigger interval, it would be good to have an option to modify alert thresholds on the instance level as well since not all instances are created equal. Nevermind, found it. Re: SNMP monitoring of non-Windows "Windows" devices Makes sense. Brainstorming some more, I did find that I can override the isWindows classification despite them telling me I can't. Turns out if you make your own isWindows AppliesTo function, that overrides the built-in one. I did a quick test with this logic and it seemed to do what I needed. See any issues with this (other than it not being officially supported)? (join(system.categories,",") =~ "Windows" || join(system.categories,",") =~ "Hyper-V" || system.sysinfo =~ "Windows" || system.sysinfo =~ "Hyper-V") && !hasCategory("Crestron") (we are applying the Crestron category as needed)
Top ContributionsXpath woesSolvedBest way to deal with "dynamic" SNMP dataJSON Path capability in a Webpage DataSourceSolvedRe: Modify Alert trigger Interval on the Instance levelRe: Xpath woesRe: JSON Path capability in a Webpage DataSourceSNMP monitoring of non-Windows "Windows" devicesRe: Remove/delete a category from many resourcesRemove/delete a category from many resourcesNetScans - Advanced naming of discovered devices??