-1

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)

pqrz
  • 133
  • 5
  • In Python you could try to make a socket connection to the relevant host:port. If it succeeds you can reasonably assume that it's up and running – DarkKnight Mar 01 '22 at 12:39
  • Hi Arthur, I had tried `https://xyz:abc` but it doesn't work for some reason. – pqrz Mar 01 '22 at 12:41
  • I’m voting to close this question because it should be a support request to the vendor of that product. [We can't answer customer service questions here](https://meta.stackoverflow.com/q/255745/354577). – ChrisGPT was on strike Mar 01 '22 at 12:41
  • @pqrz That is presumably because there's no HTTP(S) server on that host:port. Check your Mosek documentation for options – DarkKnight Mar 01 '22 at 12:43
  • Does Mosek use `flexlm` to manage license? – Corralien Mar 01 '22 at 12:55
  • Yes, it indeed uses the `flexlm` license manager – pqrz Mar 01 '22 at 12:57
  • ``lmutil lmstat -c host@port -a`` like here: https://docs.mosek.com/latest/licensing/floating-license.html#id1 gives current status and can be called from remote also – Michal Adamaszek Mar 01 '22 at 13:06
  • If something is possible with FlexLM it will be described in http://docs.mosek.com/generic/fnp_LicAdmin.pdf I don't think there is any protocol allowing that through HTTP. Only my previous comment. – Michal Adamaszek Mar 01 '22 at 13:08
  • Hi Michal, We are aware of `lmutil`. Very thanks for the confirmation on `HTTP(S)` though. – pqrz Mar 01 '22 at 13:14

1 Answers1

1

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

Corralien
  • 109,409
  • 8
  • 28
  • 52