Forum Discussion

lucjad's avatar
lucjad
Icon for Neophyte rankNeophyte
23 days ago

Automatically Delete Instances - SQL System Jobs

I'm having trouble with the Auto Delete option.

Automatically Delete Instances enabled: LogicMonitor removes job instances when it thinks they no longer exist - often triggered by temporary disconnections or failovers. This causes thresholds and alerts to vanish unexpectedly (previously set thresholds on the individual job level disappear).

Mixed environments (AGs): Automatically Delete Instances disabled: Job instances persist even after failover, which can result in false warnings on old replicas that are no longer active. 

I need certain jobs to persist so their alert thresholds remain intact, but they're being removed automatically when auto delete is on. On top of that, I’m dealing with AG replicas that fail over along with the jobs, which leaves behind failed job warnings on the previous replica when the auto delete is off.

I thought of many things but there doesn't seem to be perfect solution to this yet.

Any thoughts? Ideas? 

4 Replies

  • Don't have a ton ideas myself, nothing really pretty.

    For things like temporary disconnects, that shouldn't cause instances to be deleted because the Auto Discover should return a non-zero exit code if it fails to query, so it gets ignored. If that is occurring, that might be a bug in the code or a situation it's not accounting for.

    As the rest, all I can think of is if you add all of the intelligence into the Active Discovery code itself (assuming you have someone who can code). You may need to have code to separate out instances you never want to delete from those you always want to delete. If that's even possible (don't know that much about SQL).

  • But here's the question- if I change the Active Discovery logic and get the code to work like I want to- won't the Auto Delete set to on be still overriding what's in Active Discovery script? I am assuming I would have to turn that back on? 

  • Active Discovery (AD) is what tell LogicMonitor what instances exists or not. If you output the instance in the AD script then LM will keep it, if you don't output it, LM will delete it (you would set LM to delete instances in this case).

    Perhaps you need to have multiple DataSources for the different situations even if the function (and collection script) are the same. Like having one just for instances you don't want to delete where you can disable deleting. Then have another one that just as the instances you are ok if they delete. I'm kinda assuming there isn't overlap between them.

    I would suggest taking some time to work out all the logic and situations. When you want to keep an instance, when it's ok if it's delete, when it should alert, and when it shouldn't, etc. And how they can be determined without manual review. Perhaps that might help determine how to implement it or if things can be separated out.

    • Joe_Williams's avatar
      Joe_Williams
      Icon for Professor rankProfessor

      I would approach it like this. Either you have ActiveDiscovery do its normal thing and at the tail end, if your "required" items aren't there still "Add" them.

      Or, as Mike said, create a separate DataSource that will always just have those items, and filter them out of the original DataSource.