Forum Discussion

Antony_Hawkins's avatar
6 years ago

Discovery time PropertySource

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:

2 Replies

Replies have been turned off for this discussion
  • @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.