You are viewing limited content. For full access, please sign in.

Question

Question

Notification when Named User Licenses running low

asked on March 26, 2019

If LFDS is configured to sync from AD groups, is there a way to have it send a notification when the number of available licenses reaches a certain threshold or when they run out?

0 0

Answer

SELECTED ANSWER
replied on March 27, 2019 Show version history

Interesting idea, thank you for sharing! I've noted it for consideration and linked back to this post so we can update here if the feature goes to development.

If you want to set this up your own, you use SQL tools to trigger emails based off of the number of assigned licenses. I don't think there's a simple way to query for the total available number of licenses in SQL (so you might have to code that value in), but you can get a lot of information on what licenses are assigned.

 

For example,

SELECT count([type])
  FROM [LFDS_Release104].[dbo].[user_licenses]
  where [type] ='9bba0d89-9a13-455f-ada9-83cf071d46b9'

will return the number of full named user licenses (that's the 9bba[...] guid in the "type" column) assigned to users. Make sure not to modify the licensing database if you try this out!

0 0
replied on March 28, 2019

Thanks, Brianna.  I'll give that a shot.  Hopefully we can see this feature in the future.  I've had a couple of our customers ask about it, and it seems like a common-sense feature to have.

 

Thanks again!

0 0

Replies

replied on July 8, 2020

Has there been any progress/decisions on this feature?  This is something we are trying to monitor as well.

0 0
replied on May 21, 2021

Another request for an update on this. That DB query is a good starting point but doesn't include things like licenses assigned to a specific LF Server or organization. And as Brianna mentioned, it doesn't count total licenses (though I can get that through LMO).

Basically, I want to be able to see the count of full licenses that shows on the main overview page of LFDS. And then give you more money when that number gets too low.

0 0
replied on June 15, 2021

Hey @████████ any thoughts on this one? Basically, I want to create a report that will give me the same view as the LFDS counter.

 

 

0 0
replied on June 16, 2021 Show version history

Hey Pieter, 

I spent a while on this and figured out how to automatically generate the same CSV report you get by clicking this button:

This PowerShell script gets you the data in CSV format. You can then use the data to generate whatever metrics and alerts you want. I trust you could figure out how to adapt it for a Workflow web request or similar if desired to meet your needs.

# PowerShell

### Parameters
# The server name as it appears in the LFDS web admin URL (https://localhost/LFDS/#!/SERVER/database)
$lfdsServer = 'server'    

# The licensing site (database) name as it appears in the LFDS web admin URL (https://localhost/LFDS/#!/server/DATABASE)
$lfdsDatabase = 'database'

$reportFormat = 'csv'

# The FQDN you reach LFDS web admin at; NO trailing slash; must have valid TLS certificate bound
$lfdsBaseURL = "https://lfds.example.com/LFDS"
 
$reportURI = "/specificapi/Report/GenerateResourceUsageReport?server=$($lfdsServer)&dbname=$($lfdsDatabase)&reportFormat=$($reportFormat)"
$uri = $lfdsBaseURL + $reportURI

# The directory you want to store the report files in
$path = 'C:\Reports\'
$filename = "LFDS-LicenseUsageReport-$(Get-Date -f yyyy-MM-dd).csv"
$outFile = Join-Path -Path $path -ChildPath $filename

### Path validation 
if (!(Test-Path -Path $path)) {
    New-Item -ItemType Directory -Force -Path $path
}

### Report generation
# LFDS requires WinAuth to access report generation. -UseDefaultCredentials passes the current user's AD credentials.
$Response = Invoke-RestMethod -Uri $uri -UseDefaultCredentials 
$Response.value | Out-File $outFile -Encoding ASCII

Sample output file attached with a .txt extension appended because Answers forgot to put .csv on the allowlist.

1 0
replied on June 16, 2021

Thanks, Sam. You're the man!

0 0
replied on June 18, 2021

Hey Sam-

I wanted to run all the logic form within Workflow, and from threads on here, running a PS1 script from WF seems problematic. So I converted the web call in that script to a WF web call, write the output to a known CSV path, then query that CSV and compare counts. Probably could skip the data steps if I was better with c#, but I think this will work quite well for my needs.

Thanks again for the assist!

 

0 0
replied on June 18, 2021

Welcome! If you're going that route, I might suggest writing out the results to a database table with an additional date/timestamp column and querying that instead. It would make it easy to generate historical license usage reports as well if those might ever be useful. And/or hook up to a dashboard in the BI tool of your choice.

0 0
replied on December 22, 2025

Hi @████████ -

Finally updated to LFDS 12 (v11 gave some odd behavior in TEST so left PROD on 10.4 for a while). But now these license queries no longer work. Is there any documentation on running these queries for 12 (LFDS as a web service to query)? I'm not having luck finding it but that certainly doesn't mean it doesn't exist.

Or maybe there's a better way now that I'm not aware of.

Thanks.

0 0
replied on January 6

There isn't documentation on it - I simply opened browser DevTools and clicked the download button to get the report generation URI. You can right click on the call to get a "Copy > URL" option.

In any event, I just checked on Directory Server 12.0.2511.289 (Dec 2, 2025 release) and the URI format appears to be unchanged from what I originally provided. The path component is still:

"[/LFDS]/specificapi/Report/GenerateResourceUsageReport?server=$($lfdsServer)&dbname=$($lfdsDatabase)&reportFormat=$($reportFormat)". I noticed that mine today said "reportFormat=CSV" vs the "csv" of my original script, but I'd be surprised if that parameter were case sensitive.

I recommend you try copying the report generation URL out of your own Directory Server instance and compare it to what's in your script. DevTools even has a "Copy as PowerShell" option for the URL that generates a short web request script that includes all the current session cookies, headers, etc. in case any of those might be relevant. 

0 0
replied on January 7

Thanks, Sam-

Sorry if you spent much time on this, I did get it working by switching to PowerShell. As you noticed, no changes were required. The PowerShell script from v10 still works just fine with v12 running in either PowerShell or just putting the URL into a browser. But for whatever reason trying to query as a web service in Workflow keeps failing with a 500 error. There might be some sort of authorization header required now that didn't used to be, but since I got it working with PS I'm not going to fight it.

2 0
You are not allowed to follow up in this post.

Sign in to reply to this post.