Forum Discussion
Thanks for the comment Stuart, but the request was more to handle where the act of collecting the additional info has an overhead .. and didn't want to add that overhead for the majority of collections, only when issued via the Poll Now (i. e interactively when an individual is investigating)
- Stefan_WNeophyte
As I'm doing more and more custom DataSource development which leverages the Collector ScriptCache I am also finding I am desperately wanting this feature also.
In my situation I am working with an API query which specifies a time "window" (start time and end time) to return a set of events which occurred during that time period. The current execution time of the collection run gets saved into ScriptCache to be used as the starting time for the next execution. The problem is that a Poll Now will update the ScriptCache with the time that the Poll Now happened (but the Poll Now data is not collected of course) so at the next data collection the "window" going into the API parameters is too narrow and I'm losing data!!!
Basically I need to be able to do something like this:
if ( taskProps.get( "how_am_I_being_run" ) == "pollNow" ) { // something which does NOT update Collector ScriptCache } else { // something which does update Collector ScriptCache }
(Every time I do a Test Script on the DataSource I also lose data but I can do a clunky work-around during development by working with a clone that has a different ScriptCache item name hard-coded into the Groovy. That's ugly though.)
The big issue is that for such a DataSource - where a time "window" is being saved for next-execution - doing a Poll Now causes data loss. Period.
- Anonymous
For scripted datasources, when you do a poll now, the resulting dialog box actually does output the full output of the script. So, if you wanted to output additional text, you'd just build that into the script output. Normal polling would pull the text but since it you didn't create a datapoint to try to pull in the data, it's discarded. That way when you do a poll now, it'll do what it always does and you can view the full output with the additional troubleshooting text.
I do this with my ConnectWise CMDB sync DataSource. It's written in Python, not Groovy, but works the same way. The collector executes the script every hour. When it runs, it collects the metrics regarding the synchronization and some text data. Normally, only the data gets picked up and stored. One of the metrics is "number of devices that failed to sync into CW". When i see that value go above zero, i go in and run a poll now. The output of the script again outputs the non-zero value for failures, but also outputs some text indicating which device(s) failed to sync.
- Anonymous
I put this in as a feature request too. But not only poll now, but when running in the collector debug as well. For us it doesn't matter that the feature isn't there because the people that need to do poll now don't have permission to do poll now because they have to have manage permissions on the devices, which i'm obviously not going to give.
- Anonymous
Piling on, the ability to tell whether a scripted task is running as part of active discovery or collection. This would allow a single script to be written that can branch to discovery output or collection output depending on the task at hand. Really part of the same thing.
Basic values of taskProps.get( "how_am_I_being_run" ) could be "ad", "collection", "pollNow", and "debugConsole".
I often find myself writing the same script for discovery and collection, just with different output. Maintaining one script instead of two would simplify things.
Related Content
- 7 months ago
- 2 years ago
- 8 months ago