Antony Hawkins

Discovery time PropertySource

Recommended Posts

Very simple PropertySource that outputs the epoch (in milliseconds) and a human-readable timestamp showing when the PropertySource ran - i.e. this will show the last time Auto Properties ran for any given collector-monitored resource. This will be true for regular collector-scheduled runs and manual / API triggered Active Discovery runs.

v1.1.0: Y2P3HN

Like any device properties, these could be used in dynamic group definitions and reporting.

You could use the same approach to add instance-level properties to discovered instances of multi-instance DataSources (using scripted Active Discovery) to be able to see and report on (via a Device Inventory report) most recent successful discovery update times - and therefore also identify instances where discovery hasn't run successfully, or where persistent instances have ceased to respond and therefore haven't been rediscovered.

It's so simple, I'll drop the groovy script in here directly:

import groovy.time.TimeCategory;
println 'auto.properties_discovered_human=' + new Date().format('yyyy-MM-dd HH:mm:ss');
println 'auto.properties_discovered_epoch=' + System.currentTimeMillis();

That's it.

It'll look like this for a device:

5bedf8e3066c2_ScreenShot2018-11-15at23_51_38.png.ffaed380521f6dbe5ecbd3fe4d151d4c.png

Share this post


Link to post
Share on other sites

@Joe Williams I'll ask the DataSources team to clear it. However, no need to wait - you can recreate it yourself in-platform. Go to the PropertySources page and start a new PropertySource; make sure you have 'Embedded Groovy Script' selected and paste in those three lines of code (above). Apply it to 'isDevice()' and give it a suitable name, and save it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now