Motivation
In this post I will share my notes for installation and configuration of 3 open-source tools that together work as an Electronic Design Automation (EDA) license monitoring system. The tools are flexlm_exporter
, Prometheus time-series DB
and Grafana
observability platform.
While installation of each one of those components separately is well-described in their documentation, I haven't found online any resources that would give full picture how to configure them together and which installation option (cloud, bare metal, docker) to choose. So after some trial-and-error experiments here is a description of functional configuration. Obviously it's not the only viable option, but it could serve as a starting point for further improvements and production deployment in your environment.
Background
EDA licenses are expensive, and companies big and small want to optimize their license usage as much as possible. The first step for that is a usage monitoring system that goes beyond standard capabilities of lmstat
utility. It allows to analyze historical license usage and answer essential questions like:
- do we have enough licenses of tool X? Ok, if the answer is no, you'll probably get plenty of complains from your hardware designers. But how many extra do we need, or maybe the issue is not the license amount but the infrastructure?
- are we paying for too many licenses of tool Y?
- is there an increase/decrease in demand for tool Z recently?
This is crucial information that managers and executives need to define budget for the next EDA contract renewal, and the CAD team needs during regular license remix.
Some companies choose to write their own system for license monitoring, others use commercially available options.
In my experience the open source solution described in this post works pretty well. It is reasonably simple to install and maintain and will not break the bank.
Note that Prometheus DB and Grafana are powerful and multi-purpose tools. Chances are that they are already installed in your organization, and you only need to configure the remaining pieces. Otherwise keep in mind that besides license monitoring, there are many other use cases where Grafana shines: compute cluster performance dashboards, alerts in case of infrastructure issues, collection of PPA and code coverage metrics, etc.
Architecture
There are 3 components you'll need:
- flexlm_exporter, kudos to Mario Trangoni for developing and sharing!
- Prometheus time series DB
- Grafana observability platform and FLEXlm dashboard
Installation
All 3 applications could be installed directly in your Linux environment or as Docker containers. In my opinion containerized installation is a cleaner way, and it also takes care of most dependencies. So below are the configuration files and gotchas for Docker-based installation.
flexlm_exporter
Prepare a YAML configuration file that defines all suppliers/licenses that you'd like to monitor, and paths to license files. Here is the content of my experimental licenses.yaml file:
licenses:
- name: dirt_cheap_llc
license_file: /some_path/dirt_cheap_llc.txt
features_to_exclude:
monitor_users: True
monitor_reservations: True
monitor_versions: False
- name: arm_and_leg_inc
license_file: /some_path/arm_and_leg_inc.txt
features_to_exclude:
monitor_users: True
monitor_reservations: True
monitor_versions: False
Create an executable file with this content and customize your paths before running:
#!/usr/bin/bash
export DOCKER_REPOSITORY="quay.io/mjtrangoni/flexlm_exporter:latest"
# two variables below need to be customized with the actual paths in your network
# define path to the directory with lmutil and other license utilities here
export LMUTIL_LOCAL="some_path"
# put path to your YAML config file here
export CONFIG_PATH_LOCAL="some_path/licenses.yaml"
docker run --name flexlm_exporter -d -p 9319:9319 \
--network cad --network-alias flexlm_exporter \
--volume $LMUTIL_LOCAL:/usr/bin/flexlm/ \
--volume $CONFIG_PATH_LOCAL:/home/exporter/config/licenses.yml \
$DOCKER_REPOSITORY --path.lmutil="/usr/bin/flexlm/lmutil" \
--path.config="/home/exporter/config/licenses.yml"
Notice the --network cad --network-alias flexlm_exporter
options. This trick helps to connect flexlm_exporter with Prometheus DB. Docker network allows to set aliases, that are more stable and easier to use vs IP addresses. Before executing this file, you'll need to create a new Docker network using those commands:
docker network create cad
docker network ls
Now it's time to run the executable file and check that flexlm_exporter Docker container is running without issues.
Prometheus DB
Prepare configuration prometheus.yml file. This file defines where Prometheus "scrapes" the data from. In our case we instruct Prometheus to get information from the flexlm_exporter server:port.
scrape_configs:
- job_name: 'flexlm'
static_configs:
# Here you'll need to specify server name and port of the exporter
# The network alias makes this task simple
- targets: ['flexlm_exporter:9319']
Customize your path to prometheus.yml configuration file and run Prometheus Docker container:
docker volume create prometheus-data
docker run --name prometheus -d -p 9090:9090 \
--network cad --network-alias prometheus \
-v /some_path/prometheus.yml:/etc/prometheus/prometheus.yml \
-v prometheus-data:/prometheus \
prom/prometheus
Note the 1st docker volume
command, this will make a persistent docker volume to store Prometheus data when container is re-created. Similar volume will be used below to store Grafana dashboards and credentials.
Grafana
Here are the commands to make one more Docker volume and run the 3rd container for Grafana:
docker volume create grafana-data
docker run -d --name=grafana -p 3000:3000 --network cad --network-alias grafana \
-v grafana-data:/var/lib/grafana grafana/grafana-enterprise
To access Grafana, open this URL in your browser: http://localhost:3000/
To login the 1st time, both your login and password are admin
, then you'll be prompted to change the password.
Now it's time to to add a new Grafana dashboard. First let's add a Prometheus data source to Grafana. Because we use Docker networks, the Prometheus URL will be http://prometheus:9090
. Go to Connections -> Data Sources -> Add new data source -> Prometheus:
Then go to Dashboards -> New -> Import, and paste this URL:
https://grafana.com/grafana/dashboards/3854-flexlm/
And select Prometheus as the data source. Note that if you don't see a valid Prometheus DB in the selection box, you might need to refresh your browser window before this step.
If all parts work properly, now you will see historical license usage in your dashboard, like shown in the very first image at the top.
Debugging
Here are useful commands that will help with debugging.
List running docker containers with docker ps
command. There should be 3 containers running (Status=UP)
If any of the containers is not running, use docker logs <container_name>
to see the diagnostic.
Another option is to try accessing flexlm_exporter and Prometheus DB in Web browser:
- http://localhost:9319/ - flexlm_exporter
Here you could follow Metrics
link. When exporter works as expected, there will be information like this:
# TYPE flexlm_feature_issued gauge
flexlm_feature_issued{app="arm_and_leg_inc",name="feature1"} 100
...
# HELP flexlm_feature_used License feature used labeled by app and feature name of the license.
# TYPE flexlm_feature_used gauge
flexlm_feature_used{app="arm_and_leg_inc",name="feature1"} 30
...
# HELP flexlm_feature_used_users License feature used by user labeled by app, feature name and username of the license.
# TYPE flexlm_feature_used_users gauge
flexlm_feature_used_users{app="arm_and_leg_inc",name="feature1",since="1729442400",user="user1"} 3
...
- http://localhost:9090/query - Prometheus DB
The first check is that URL is accessible. Then the following queries should work and respond with your license usage info:
up
flexlm_server_status
flexlm_feature_issued
flexlm_feature_used
flexlm_feature_used_users
Top comments (0)