.. _ntls:

Troubleshoot Licensing and ``findface-ntls``
====================================================

When troubleshooting licensing and ``findface-ntls`` (see :ref:`licensing-principles`), the first step is to retrieve the licensing information and ``findface-ntls`` status. You can do so by sending an API request to ``findface-ntls``. Necessary actions are then to be undertaken, subject to the response content. 

.. tip::
   Please do not hesitate to contact our experts on troubleshooting by support@ntechlab.com.

.. note::
   The online licensing is done via the NtechLab Global License Manager ``license.ntechlab.com``. Check its availability. A stable internet connection and DNS are required.

To retrieve the FindFace :ref:`licensing <licensing-principles>` information and ``findface-ntls`` status, execute on the ``findface-ntls`` host console:

.. code::

   curl http://localhost:3185/license.json -s | jq


The response will be given in JSON. One of the most significant parameters is ``last_updated``. It indicates in seconds how long ago the local license has been checked for the last time.

Interpret the ``last_updated`` value as follows:

   * [0, 5] — everything is alright.
   * (5, 30] — there may be some problems with connection, or with the local drive where the license file is stored.
   * (30; 120] — almost certainly something bad happened.
   * (120; ∞) — the licensing source response has been timed out. Take action.
   * ``"valid" -> "value": false``: connection with the licensing source was never established.


.. code::

   curl http://localhost:3185/license.json -s | jq
   {
     "name": "NTLS",
     "time": 1565186356,
     "type": "online",
     "license_id": "61063ce4b86945e1b70c3bdbedea453b",
     "generated": 1514467939,
     "last_updated": 5,
     "valid": {
       "value": true,
       "description": ""
     },
     "source": "/opt/ntech/license/import_b68d7b7ec9a7310d18832035318cff0c9ddf11e3a9ab0ae962fbe48645e196d1.lic",
     "limits": [
       {
         "type": "time",
         "name": "end",
         "value": 1609161621
       },
       {
         "type": "number",
         "name": "faces",
         "value": 9007199254740991,
         "current": 0
       },
       {
         "type": "number",
         "name": "cameras",
         "value": 4294967295,
         "current": 0
       },
       {
         "type": "number",
         "name": "extraction_api",
         "value": 256,
         "current": 0
       },
       {
         "type": "boolean",
         "name": "gender",
         "value": true
       },
       {
         "type": "boolean",
         "name": "age",
         "value": true
       },
       {
         "type": "boolean",
         "name": "emotions",
         "value": true
       },
       {
         "type": "boolean",
         "name": "fast-index",
         "value": true
       },
       {
         "type": "boolean",
         "name": "sec-genetec",
         "value": false
       },
       {
         "type": "boolean",
         "name": "beard",
         "value": false
       },
       {
         "type": "boolean",
         "name": "glasses",
         "value": false
       },
       {
         "type": "boolean",
         "name": "liveness",
         "value": false
       }
     ],
     "services": [
       {
         "name": "video-worker",
         "ip": "127.0.0.1:53276"
       },
       {
         "name": "FindFace-tarantool",
         "ip": "127.0.0.1:53284"
       },
       {
         "name": "FindFace-tarantool",
         "ip": "127.0.0.1:53288"
       }
     ]
   }