Forum Discussion

Zahir_Sheikkari's avatar
11 months ago
Solved

[Feature request] Custom PowerShell script: increase timeout

Hello, I was advised to go here after chatting with support. I have run into an issue where our custom PowerShell script runs into the hardcoded 120 second timeout. We're initially testing it first...
  • mnagel's avatar
    11 months ago

    I think the ask here is to be able to tune the timeout per script -- not a bad idea in general. However, I think the actual feature you want is what Nagios and other monitoring systems call “passive checks”.  We used that ALL the time to have long-running scripts generate results and inject them into monitoring.  LM does not have that, but it does have Script Caching, which could potentially be useful to run scripts and fetch results asynchronously. Sadly, that is not a general distributed facility like redis (which I’d recommended years ago), it only works for Groovy scripts.  There is no PowerShell binding (perhaps I am wrong on that, but I don’t see it in the documentation).

    You could fake this yourself with files, though. You would need to schedule your script to run asynchronously (e.g., via Task Scheduler) and write results into a known location on the collector (or a filesystem reachable by the collector).  Then your datasource would just need to fetch the latest results from the filesystem and quickly process.  You’d want to check whether the data is too old so you can produce no results if that is the case.