Forum Discussion

keiransteele's avatar
keiransteele
Icon for Neophyte rankNeophyte
4 months ago

Get historical values for alerting

I would like to alert when an MSSQL database ( Microsoft_SQLServer_Databases ) has increased in size by 10GB or more over 24h. I tried support but was told it wasn’t possible to alert on historical values. This post from 6 years ago indicates I could do it with the data rest api, is this still the only valid method after 6 years?

https://community.logicmonitor.com/archive-13/alerting-on-difference-to-historic-value-1409?tid=1409&fid=13

Has anyone done anything similar or have any examples of using the rest api or sdk to do this?

Thanks.

5 Replies

  • they do not let you define in absolute terms how far from normal triggers an alert

    We’ve done this in other cases. You can actually set a static threshold and a dynamic threshold. And the dynamic threshold has options to require the value be beyond a certain point before it triggers. Honestly, there should be a good explanation on setting thresholds and how they work. The UI does a poor job of explaining what all the options are. We had to figure it out with trial and error.

  • As a possible alternative, have you considered setting dynamic thresholds on the datapoint? They work by having the platform learn the normal range for a given datapoint (per instance) and alerting if the measured values depart a certain amount from that normal range. They do rely on historic data to learn what’s normal, but they do not let you define in absolute terms how far from normal triggers an alert. They are good for things like database file size, where there’s no obvious number or fraction to look for. https://www.logicmonitor.com/support/alerts/aiops-features-for-alerting/enabling-dynamic-thresholds-for-datapoints

  • Another option is you can create a clone of Microsoft_SQLServer_Databases, that is setup to only run once a day (which wasn’t an option 6 years ago) and use a Delta threshold for the size. Would only work for 24hr or less though.

    There is a potential downside to this: if a poll is missed, like the device doesn’t response to that once-a-day poll, you’re out of luck.

  • Another option is you can create a clone of Microsoft_SQLServer_Databases, that is setup to only run once a day (which wasn’t an option 6 years ago) and use a Delta threshold for the size. Would only work for 24hr or less though.

  • You could use the script cache to keep the minimum value of the size of the database and that value’s age in hours (or unix timestamp). That would let you compare the current value to the smallest value in the last 24 hours to see if the delta is too big.