View Mosek's License server status via URL

79 Views Asked by At

We are using Mosek's Floating License offering.

That means, the Mosek's license server runs on a separate dedicated server (=xyz and at a port=abc) on-premises. It displays the started the server is started at 127.0.0.1.

Though we (as developer) can use terminal to ssh into that server xyz and check if Mosek license server is up and running.

But for others (non-developer) - its difficult to check Mosek's uptime since they cannot use terminal. (That is the pain-point)

Is it possible to check Mosek's uptime via browser? (possibly by visiting the URL: https://127.0.0.1:abc - this doesn't work for some reason).

(Note: This isn't a necessity but good to have feature for us)

1

There are 1 best solutions below

0
Corralien On

You can use flask:

Create the script flexlm.py

# pip install flask
from flask import Flask, Response
import subprocess

app = Flask(__name__)

@app.route("/status")
def status():
    run = subprocess.run(['/opt/flexlm/lmutil', 'lmstat', '-a'], capture_output=True)
    return Response(run.stdout, mimetype='text/plain')

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8080)

Note: you have to customize the parameters of subprocess.run

Run flask application server:

[...]$ python3 flexlm.py
 * Serving Flask app 'flexlm' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on all addresses.
   WARNING: This is a development server. Do not use it in a production deployment.
 * Running on http://10.202.120.7:8080/ (Press CTRL+C to quit)
10.202.241.181 - - [01/Mar/2022 14:38:04] "GET / HTTP/1.1" 404 -
10.202.241.181 - - [01/Mar/2022 14:38:08] "GET /status HTTP/1.1" 200 -

Go to http://xyz:5000/status