Status monitoring

Status monitoring

Starting with versions Itgrix bx 3.6.0 and Itgrix Kommo 2.13.0, a method to check the application status <Asterisk IP>:8077/status is added to the API of the integration module. Periodic checking 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 requests for individual status items with explanations of their intended use. The items are extracted from the response using the jq utility, a json data processor available for installation on Itgrix-compatible systems.

Complete status data can be obtained by query:

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 area.

The response to the identified application states is not described in the examples and is determined by 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 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

Value variations 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 when the application is restarted. This can be caused by a problem that is supposed to be solved by reconnecting and/or a short wait, e.g. network problems. A restart can also be 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 admin page. In many cases it corresponds to the running/restarted/stopped status, but in some situations it can provide additional information. For example, it can help to distinguish 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. This element can be useful to find out the causes of the failure.

License change

This query allows you to notice a switch to a license with less functionality, which can happen not only when the license expires, but also when there are connection problems 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