anybody having an agent procedure / script to "daily" check / alert on the Kserver license expiration status.
What is your end-goal for this? From what I understand, most licenses are annual and your account manager should be aware and follow-up with you and/or your company when getting close to license expiration.
Unfortunately it didn't and we got in maintenance expired !!!
easiest thing for you to do is set up a SQL job that runs - here is the text for the job to do what you are wanting... Obviously - change the 30 and 7 to whatever values you want and you can schedule the job to run as frequently as you need.
select @Return = DateDiff(dd,getDate(),value) from vdb_licenseValues where ref = 'Expiration'
IF @Return < 30
Select @message = 'Kaseya License is getting close to expiration (' + Convert(varchar(6),@Return) + ' days left)'
IF @Return < 7
Select @message = 'Kaseya License expires in less than 1 week (' + Convert(varchar(6),@Return) + ' days left)'
-- Change your email address to email distribution group or person who needs to get
-- Success Notification
SET @recipients = 'firstname.lastname@example.org'
if (len(@message) > 0)
@recipients = @recipients,
@body = @message,
@subject = @message,
@profile_name = 'DefaultMail' ;
@Chris Clancy Thanks for sharing your SQL skills, learned a few new things by playing around with it and now I have a SQL Agent Job that will warn me for this.
No problem - I use that particular job to check that our # of agents doesn't max out unexpectedly with this line
SELECT @Return = (SELECT value FROM vdb_LicenseValues WHERE licenseType > 0 and partitionId = 1 AND dataType <> 2 and licensetype = 1) - dbo.fn_GetUsageAgentsFiltered(1, '')
This is what I like the most finding like minded people that you can also learn from;
I figured out how to replace some of those additional IF steps with a CASE and it works pretty well with that agent license select query
IF @Return < 101
BEGIN SELECT @message = (SELECT CASE
WHEN (@Return < 1) THEN 'Kaseya Agent License count Critical (' + Convert(varchar(6),@Return) + ' Agent licenses left)'
WHEN (@Return < 10) THEN 'Kaseya Agent License count Very Low (' + Convert(varchar(6),@Return) + ' Agent licenses left)'
WHEN (@Return = 100) THEN 'Kaseya Agent License count is Low (' + Convert(varchar(6),@Return) + ' Agent licenses left)'
END AS vMessage)
Cool info - thank you. I've added the license expiry and max agents into to my NOC system.
where did you get this ......dbo.fn_GetUsageAgentsFiltered(1, '') ?
would like to get the following
Maxlic - nbr of agents - KNM Licenses => remaining
that SQL function already does that math for you regarding KNM - here is what it calls to get the "KNM Licenses"
SELECT COUNT(*) FROM Inventory.knmLicenseUsage WHERE (partitionId = 1)
yes, I have that one, but is there a count for the nbr of agents installed ?
total agents that aren't KNMi -> select count (distinct agentGuid) from agentState
ok thks Graig