How to programmatically get License Status

Hello,

Is there any way to get the License status programmatically?
I would like to build an element manager that can display the license status / warn if the license is expired / nearing expiration.

I see the license status in the logs, but really don’t want to have to scrape the log.
Thanks in advance.

Mosquitto has an MQTT API which can do this. You publish a message to $CONTROL/cedalo/license/v1, having already subscribed to receive the reply on $CONTROL/cedalo/license/v1/response. The message should be:

{"commands":[{"command":"getLicenseInformation"}]}

You can do this with the mosquitto_rr command like this:

mosquitto_rr -p 8883 -h <host> -u <user> -P <password> -t '$CONTROL/cedalo/license/v1' -e '$CONTROL/cedalo/license/v1/response' -m '{"commands":[{"command":"getLicenseInformation"}]}'

This will give you a response like this:

{"responses":[{"command":"getLicenseInformation","data":"<license info>"}]}

There is also a REST API provided by the Management Center, one of my colleagues will provide the details on that. On our hosted instances the license is identical in both cases, so you can choose which option suits you best.

Regards,

Roger

1 Like

Hello,

As mentioned by Roger if you are using Mosquitto Management Center, you can send a GET HTTP request to /api/license endpoint and you will receive complete license information like this:

{
	"edition": "pro",
	"issuedBy": "Cedalo",
	"issuedTo": "someuser",
	"maxInstallations": -1,
	"maxBrokerConnections": 10,
	"validSince": 1660120329000,
	"validUntil": 1688169599000,
	"comment": "This is a test license",
	"features": [
		{
			"name": "inspect-clients",
			"version": "1.0",
			"validSince": 1660120329,
			"validUntil": 1688169599
		},
		{
			"name": "mosquitto-clients",
			"version": "2",
			"count": 10000000,
			"validSince": 1660120329,
			"validUntil": 1688169599
		},
		{
			"name": "tls",
			"version": "1.0",
			"validSince": 1660120329000,
			"validUntil": 1688169599000
		},
		{
			"name": "cluster-management",
			"version": "1.0",
			"validSince": 1660120329000,
			"validUntil": 1688169599000
		}
        ]
	"serial": "..."
}

Note that to file a request, you need to first be logged in into the MMC.
Check the official documentation and OS github repo

Regards,
Sergey

1 Like