Not receiving notification emails for Lines of Code threshold limit

Must-share information (formatted with Markdown):

  • SonarQube Enterprise Edition - 10.2.1
  • Deployed on a Windows server and running as a service
  • PostgreSQL 15 being used

We are trying to set up email notifications for getting notified when the LOC threshold limit is reached or when we are nearing license expiry.
The SMTP configuration is accurate and we have tested it by sending the test email.
However, we are not receiving the LOC threshold limit notification.
The only thing that has worked is the steps mentioned in this post - Global Administration Notifications are not triggering - #4 by Joe

So, have a few questions:

  1. If there is a threshold change or smtp configuration change, does it always require updating the internal_properties table and SonarQube server restart?
  2. For the LOC threshold limit email, doesn’t it get triggered daily until the LOC goes below the threshold limit?
  3. Is there a way to check in the logs if the email was triggered?
  4. As per the above post, it says there is a background job which runs every 24 hours. Is there a way to check if that job is working and also can the background job run time be changed e.g. configure it to run every 1 hour while testing?

Thank you!

Hi all,

Can someone please help with this?

Thank you!

Hi everyone,

Can someone please help to understand the email notification logic for SonarQube?

Thank you!

Hi @ganncamp,

Can you please take a look and help with this question?

Thank you!

Hey there.

We (finally) uncovered the (private) source code that handles this notification. A few things to keep in mind:

  • The e-mail gets set to users with the global Administer System permission. Those users must have an e-mail address associated with their account.
  • SonarQube checks every 24 hours to see if the threshold has been exceeded, and stores the last time the notification was sent in the internal_properties table with the key license.notif.loc
  • SonarQube will only send the notification if the current date is a month past the date stored as license.notif.loc

So to answer your questions:

No, you shouldn’t need to update or restart anything.

As mentioned above, the notification gets sent and then won’t be sent for another month.

Unfortunately, the visibility into whether or not it got sent is limited to the value for license.notif.loc in the internal_properties table got updated.

So probably a good first debugging step for you would be – is there a value for license.notif.loc in the internal_properties table? if so, what is it?

A simple SELECT should do the trick

SELECT * FROM internal_properties WHERE kee='license.notif.loc'

1 Like

Thank you, @Colin for the detailed response.

Is there a way, the notification frequency can be changed to a custom value?

The frequency is not configurable. What would you want to set it to, if you could configure it?

Mostly, would have set it to notify weekly.
With a monthly frequency, in case you miss that email, you might have already consumed a lot more lines of code by the time you are notified again.