Metered Licenses

Metered licenses are licenses that count the number of times something happens, sometimes called consumptive licensing. For example, you might want to license the number of pages printed in your application or the amount of time your application runs. If that is what you want, then metered licenses are for you. A metered license is like a postage meter for software – you fill the meter up, then as the application runs, it consumes the meter count. When the meter is exhausted, subsequent checkout requests fail with RLM_EL_METER_NOCOUNT.

It’s important to note that you do not have to change your code to make use of metered licenses. You call rlm_checkout() in the normal way. When you create the license, you specify that it is a metered license rather than node-locked or floating, and RLM does the rest.

Note

Metered license cannot roam. In fact, if a license specifies any of the following attributes, it cannot be metered: hold, min_checkout, client_cache, max_roam, max_roam_count, soft_limit, user_based, host_based..

Also note that meter counts are 32-bit integers, so the maximum value for a meter counter is (231)-1.

In addition, a meter counter number is also a 32-bit integer, so the maximum counter number is (231)-1, however, in practice it is best to keep your counter numbers in the range of small integers.


About RLM meters

RLM metering is managed by the license server, so every metered license requires a license server to operate. The RLM metering implementation is insecure, for two reasons: the meters themselves are stored in files on the server computer, and users with access to the RLM web interface can add count to the meters.

Note

This is not true if you use RLM Cloud, since the cloud servers are under your control and your customer does not have access to the standard web interface to modify the counters.

This implementation will work for you if you use RLM Cloud, run your license servers on your network to serve licenses for your customers, or if you want to give your customers the ability to meter licenses and then report on usage via the report log for post-use billing. But you cannot use RLM’s metering implementation to enforce meter counts if your customers run their own license servers.

The license server maintains a single meter, which can contain any number of meter counters. It is the individual meter counters which your software will consume. An RLM metered license can specify an amount to subtract from an arbitrary meter on checkout, then an additional amount periodically while the software continues to run.


How to Specify a Metered License

In order to create a metered license, the count keyword is set to “meter”. In addition, there are 4 optional parameters you can set to control the metering of the license:

Parameter

Description

meter_counter

The meter counter # used to meter this license

meter_dec

The amount subtracted from the meter on the initial rlm_checkout()

meter_period

The amount of time before an additional amount is subtracted from the meter

meter_period_dec

The amount subtracted from the meter each meter_period minutes

Note

Metered licenses are not specific to a SERVER’s hostid; they will work anywhere that you configure the meter. In other words, the SERVER’s hostid does not factor into the signature of a metered license.

If a metered license is specified with no additional options, the defaults are as follows:

meter_counter=1
meter_dec=1
meter_period=0
meter_period_dec=0

meter_counter=n

The meter_counter keyword specifies which counter is used for this product. Choose a positive integer less than 231. Smaller numbers are better for the RLM user interface.

meter_dec=n

The meter_dec keyword specifies the amount to be subtracted from the specified meter_counter when the server processes the rlm_checkout() request.

Note

The count parameter of rlm_checkout() will multiply all the meter decrement counts. If the meter counter has insufficient count, rlm_checkout() will return RLM_EL_METER_NOCOUNT. Additional checkouts of a shared license will not decrement the meter.

meter_period=n

The meter_period keyword specifies the number of minutes before the counter is decremented again. Note that this time is approximate. The first periodic decrement will happen up to one minute earlier than the time specified. After that, the decrements will be at very nearly n-minute intervals. If unspecified or specified as 0, there will be no periodic decrement of the counter.

Note

For shared licenses, only one of a group of shared licenses will have the meter decremented.

meter_period_dec=n

The meter_period_dec keyword specifies the amount to be subtracted from the specified meter_counter approximately every meter_period minutes. This is approximate because the license server does this subtraction in its periodic processing, which happens very close to once per minute. If the meter counter has insufficient count at the time of this decrement, the server will decrement the counter (causing it to go negative), then drop the license (similar to a TIMEOUT or an rlmremove operation), and your program will receive an RLM_EL_METER_NOCOUNT status the next time you call rlm_license_stat() on the license handle. The check-in status in the report log will have a reason code of 10, indicating that the check-in happened as a result of insufficient count in the meter.

Note

The count parameter of rlm_checkout() will multiply all the meter decrement counts.

Also note that for shared licenses, only one of a group of shared licenses will have the meter decremented.


Example metered licenses

This example creates a metered license which subtracts 1 from counter number 1 on initial checkout and no further decrements as long as the program is running:

LICENSE reprise test 1.0 permanent meter sig=xxxx

This example creates a metered license which subtracts 20 from counter number 7 on initial checkout and an additional 5 every 10 minutes as long as the program is running:

LICENSE reprise test 1.0 permanent meter sig=xxxx
meter_counter=7 meter_dec=20 meter_period=10
meter_period_dec=5

Installation of Metered licenses

When a metered license is installed and the license server is started, the server creates the meter counter if it does not exist. Once created, the counter has 0 count, so checkouts that require meter count will not work. In the RLM web interface (in the license server status section), there will be a separate section for metered licenses - separate from all other licenses.

In the Metered License Status section, the metering parameters for each license are displayed, near the middle, along with a text box and a button to add count to the meter. Fill in the desired increment to the count in the text area, then press the “Add to counter N” button to its right. This will bring up a confirmation page, after which the meter counter is incremented.

The Add Count to Meter section of this form will only appear if the “edit_meter” privilege is not disabled in the RLM web interface for this user.


Reporting

When a metered license is checked out, in addition to the normal checkout record, an additional record is logged for the meter decrement. In addition, a decrement record is logged for each periodic decrement. These records are described in the RLM License Administration Manual. The reportlog can be used for post-use billing of metered licenses. The ability for your customer to control the meter count means that they have control of costs during the billing cycle.