Status monitoring

Status monitoring

Starting from versions Itgrix bx 3.6.0 and Itgrix Kommo 2.13.0, an API method for checking the application status at <Asterisk IP>:8077/status is added. Periodic checks of the response to this request can be used to track the application status and automatically react to problems.

Examples of requests

The following are request examples for specific status elements with explanations of their intended use. The elements can be extracted from the response using the jq utility, a json data processor available for installation on Itgrix-compatible systems, or simply by specifying the target element in the path request parameter.

Full status data can be obtained by querying:

curl -s --digest -u <login>:<password> "<Asterisk IP>:8077/status"

Here <Asterisk IP> - is the address of the Asterisk server where the module was installed. -s - reduces the amount of intermediate output from curl. --digest -u - specifies the method of authorization. <login> and <password> - login and password for the admin panel.

The reaction that should follow upon identifying faulty states of the application is not described here and should be determined according to the user's needs.

Example of a response:

{
  "app": {
    "c2c": {
      "connected": true,
      "on": true,
      "portal": "example.bitrix24.ru",
      "stayon": false,
      "url": "https://apix.itgrix.ru:9004"
    },
    "calls_queue": {
      "calls": 0,
      "lock": "locked in 384ns"
    },
    "calls_storage": {
      "calls": 0
    },
    "crm": {
      "host": "https://example.bitrix24.ru",
      "manager": {
        "batch_queue": 0,
        "connector": {
          "app_type": "LicenseType_Subscription",
          "authseq": {
            "err": "<nil>",
            "sequences": 0
          },
          "on": true,
          "portal": "example.bitrix24.ru"
        },
        "on": true
      },
      "on": true,
      "users_cache": {
        "last_updated": "2023-05-11 13:03:55.485 +05:00",
        "phones": 39,
        "users": 120
      }
    },
    "crm_type": "bitrix",
    "customizer": {
      "enabled": true,
      "methods": {
        "customize_activity": true,
        "customize_attach_record_url": true,
        "customize_autodistribution": true,
        "customize_entity": true,
        "customize_show_call_card": true,
        "need_registration": true,
        "post_registration": true,
        "process_client_phone": true,
        "process_final_params": true,
        "process_originate_params": true,
        "process_record_file_path": true,
        "process_registration_params": true,
        "process_task_creation_params": true,
        "process_user_phone": true
      },
      "path": "/opt/itgrix_bx/customizer/customize.php",
      "timeout": 2000
    },
    "err": "<nil>",
    "license_manager": {
      "currentLicense": {
        "offline": false,
        "type": "Professional",
        "valid_till": "2025-04-15"
      },
      "on": true,
      "soft_mode": "ready"
    },
    "lock": "locked in 279ns",
    "master": {
      "general": {
        "app_err": "<nil>",
        "app_state": "",
        "app_status": "Ok",
        "app_status_updated": "2023-04-27 08:58:38.172 +05:00"
      }
    },
    "originated": 0,
    "pbx": {
      "ami": {
        "logged_in": true,
        "on": true,
        "pending_actions": 0
      },
      "cel_queue": {
        "calls": 0,
        "pending_events": 0
      },
      "db": {
        "connected": true,
        "dbConnector": {
          "on": true
        }
      },
      "fmc_cache": {
        "last_refresh": "2023-05-11 13:03:55.485 +05:00",
        "phones": 39
      },
      "last_id": 713065,
      "on": true,
      "parked": 0,
      "sql_parser": {
        "originated": 0,
        "transfer_bridges": 0
      },
      "trunks": 2
    },
    "restarting": false,
    "version": "Itgrix_bx v3.10.12"
  },
  "instance": {
    "config": "/etc/itgrix_bx/config.json",
    "index": 0,
    "log": "/var/log/itgrix_bx.log",
    "service": "itgrix_bx"
  }
}

Stop/restart status of the application

Using the queries described below, you can track when and why an application stops working.

curl -s --digest -u <login>:<password> "<Asterisk IP>:8077/status?path=app.master.general.app_state

Possible values of app_state:

  • Normal operation will return a value of "".

  • The value "stopped" is returned when the application has encountered an error preventing further operation and is waiting for user action.

  • The value "restarting" is returned while the application is restarting. This can be caused by a problem that is supposed to be resolvable by reconnecting and/or by a short pause, e.g. network problems. It can also be caused by a normal restart, e.g. when changing connection settings.

curl -s --digest -u <login>:<password> "<Asterisk IP>:8077/status?path=app.master.general.app_status" 

app_status contains the overall status of the application, which can be "Ok"/"Warning"/"Error". This is the status that is displayed at the top of the main page in admin panel. Most often it corresponds to the running/restarted/stopped status, but in some situations it can provide additional information. For example, it can help in distinguishing between a normal restart and a restart due to an error.

curl -s --digest -u <login>:<password> "<Asterisk IP>:8077/status?path=app.master.general.app_err"

app_err contains error details, based on which the error text is generated under the application status on the main page in admin panel. This element can be useful in finding out the causes of the failure.

License change

This query helps to identify if the application has switched to a license with limited functionality. This can occur not only when the license expires but also due to connection issues with the licensing server.

curl -s --digest -u <login>:<password> "<Asterisk IP>:8077/status?path=app.license_manager.currentLicense.type"

license.type returns the license type displayed at the top of the main admin page.

Possible values:

  • "Professional" - paid license with full functionality.

  • "Subscription" - subscription license with limited functionality.

  • "Free" - free license with basic functionality.

curl -s --digest -u <login>:<password> "<Asterisk IP>:8077/status?path=app.license_manager.currentLicense.valid_till"

license.valid_till contains the license expiration date (the last day on which the license is valid ) in YYYYY-MM-DD format.

Last updated