General Scheduled Endpoint Question (IIS)

I run a dashboard that hosts multiple “spaces” and dashboards for several departments and I have setup endpoint initializations so that Endpoints are all segmented into their own directory and pulled in during dashboard creation. For the sake of development and deployment, this works best for me.

$Endpoints = Get-ChildItem (Join-Path $PSScriptRoot 'endpoints') | ForEach-Object {
	. $_.FullName

$EndpointInitializaton = New-UDEndpointInitialization -Function @("endpoint1","endpoint2",etc..)

$Dashboard = New-UDDashboard -Title "UD" -Pages $Pages -EndpointInitialization $EndpointInitializaton -LoginPage $Login -Theme $Theme -NavBarLogo (New-UDImage -Path "$PSScriptRoot\images\TAM-Logo-white.png" -Height 75 -Width 75) 

Start-UDDashboard -Wait -Dashboard ($Dashboard) -Endpoint $Endpoints -AllowHttpForLogin -AutoReload 

What I need to do is have a scheduled endpoint that will scan a list of servers and write all drives that are <25% free space left to a file that will then be used to build a static grid page I’ve built displaying all server drives that have less than 25% space remaining. I have the code written to build the file already I just can’t figure out how to get the scheduled endpoint working with my current setup. Anyone running something similar to this that has scheduled endpoints running regularly?

Hey @aggiebeckett just for testing sakes…have you say output the endpoints to a CSV in the IIS directory then get the grid to be built via the CSV file and not I presume Cache variable or something…least if you outputting to CSV you will see the creation date etc…or I even cheat a tad and sometimes have a scheduled task set…output that to CSV every x amount of minutes or x amount of days, and get the grid built via the CSV file…not sure if this is the solution you are looking for…but as they say different filks different strokes or summin like that.

@psDevUK Yeah I actually just ran the endpoint guts a few times for “historical” data sake and because I wanted to develop the Page so that it would grab the most recent file each time it is loaded.

The Grid loads perfectly currently from these files.

A scheduled task is absolutely doable for this and honestly a good Idea I was really just wanting to mess around with scheduled endpoint HAHA

Hi @aggiebeckett,

The scheduling is rather simple:
You add the endpoints the same way, just instead of having a URL you specify a “New-UDEndpointSchedule”.
If it doesn’t matter when the endpoints are executed (ie every 10 minutes from UD Start) you can use the following:

$everyten = New-UDEndpointSchedule -Every 10 -Minute

Or you can use the cron job, example one that runs every day at 10:

$everyDayAtTen = New-UDEndpointSchedule -Cron '0 0 10 * * ?'

The scheduled endpoints are added the same way as rest-endpoints.

On my dashboard i have both Rest and scheduled endpoints in the same folder, and run the same code to load them into UD. Works like a charm!

1 Like