Monitoramento

Visão geral

A API de monitoramento permite consultar informações de monitoramento dos Engines servidores da base de dados e das sessões de usuários desses Engines. Essas informações não são coletadas em tempo real, sendo atualizadas aproximadamente a cada 2 minutos. Por esse motivo, não é recomendado o uso das rotas descritas abaixo em uma periodicidade menor que essa.

Escopo de autorização requerido:

  • api.monitoring

GET /api/monitoring/v1/engines

Listas os Engines servidores de uma base de dados que estão online. Serão considerados online os Engines que tenham enviado informações de monitoramento nos últimos 5 minutos.

Parâmetros:

  • Query string: nenhum

Exemplo de consumo:

curl -X GET -i https://<server_name>/api/monitoring/v1/engines -u '<user>:<pass>'

Resultado:

Retorna um array de objetos da classe EngineInfo.

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "updatedAt": 1714744499187,
    "platform": "win32",
    "version": "71.1.14",
    "mainDatabase": "NGINSTACK",
    "hostAddress": "10.0.0.25",
    "freeDisk": 34603913216,
    "openSocketCount": 42,
    "mainHttpPort": 80,
    "providerName": "Nginstack.com",
    "name": "app-01 (80)",
    "paths": {
      "dataDir": "D:\\Engines\\NGINSTACK",
      "logDir": "D:\\Engines\\NGINSTACK\\logs",
      "programDir": "D:\\Engines\\NGINSTACK",
      "mainProgram": "D:\\Engines\\NGINSTACK\\Engine64.exe",
      "tempDir": "D:\\Engines\\NGINSTACK\\tmp"
    },
    "applicationSessions": [],
    "alerts": [],
    "ports": [
      {
        "enabled": true,
        "disabledOnStartup": false,
        "cipherList": "",
        "protocol": "http",
        "address": "",
        "port": 80
      },
      {
        "enabled": true,
        "disabledOnStartup": false,
        "cipherList": "",
        "protocol": "https",
        "address": "",
        "port": 443
      },
      {
        "enabled": true,
        "disabledOnStartup": false,
        "cipherList": "",
        "protocol": "http",
        "address": "",
        "port": 8080
      }
    ],
    "databases": [
      {
        "enabled": true,
        "name": "NGINSTACK",
        "type": "pgsql",
        "reference": "10.0.0.1:nginstack",
        "maxConnections": 10,
        "userName": "nginstack"
      }
    ],
    "config": {
      "timeZoneBias": -180,
      "automaticUpgrade": true,
      "syncToDisk": false
    },
    "arch": "x64",
    "usedVirtualMemory": 520495104,
    "instanceId": "FJXP4E2A53EP6BK1DC2LFN48HAL7CRHW",
    "hostName": "app-01",
    "openFileCount": 152,
    "startedAt": 1714664213421,
    "memoryStats": {
      "statelessSessionsCount": 3,
      "availablePageFile": 30013313024,
      "statefulSessionsCount": 0,
      "totalPhysical": 35433062400,
      "usedVirtual": 520495104,
      "availablePhysical": 23439884288,
      "standaloneSessionsCount": 0,
      "totalPageFile": 40533336064,
      "usedPhysical": 565235712
    },
    "osName": "Windows Server 2016",
    "cpuInfo": {
      "stepping": 6,
      "model": 10,
      "family": 6,
      "vendorId": "GenuineIntel",
      "modelName": "Intel(R) Xeon(R) CPU @ 2.60GHz",
      "logicalCores": 2,
      "physicalCores": 1,
      "addressWidth": 64
    },
    "dbCache": {
      "version": 0,
      "lastSyncError": "",
      "idoCacheSize": 268435456,
      "syncing": false,
      "pageSize": 4096,
      "lastSyncDuration": 0,
      "size": 41746432,
      "tableCount": 37
    },
    "scheduler": {
      "maxConcurrentTaskCount": 11,
      "taskCount": 4,
      "runningTaskCount": 0,
      "failingTaskCount": 0
    },
    "transactionLogger": {
      "pendingLogs": 0,
      "sendingError": ""
    }
  },
  {
    "updatedAt": 1714744469731,
    "platform": "linux",
    "version": "71.1.14",
    "mainDatabase": "NGINSTACK",
    "hostAddress": "10.0.0.208",
    "freeDisk": 73699123200,
    "openSocketCount": 9,
    "mainHttpPort": 80,
    "providerName": "Nginstack.com",
    "name": "app-02 (80)",
    "paths": {
      "dataDir": "/mnt/disks/data-01/engines/nginstack",
      "logDir": "/mnt/disks/data-01/engines/nginstack/logs",
      "programDir": "/mnt/disks/data-01/engines/nginstack",
      "mainProgram": "/mnt/disks/data-01/engines/nginstack/engine",
      "tempDir": "/var/tmp/engine/XZH68XLN4ZIFHB6UN6QO1ZV0B4IGKP1Z"
    },
    "applicationSessions": [],
    "alerts": [],
    "ports": [
      {
        "enabled": true,
        "disabledOnStartup": false,
        "cipherList": "",
        "protocol": "http",
        "address": "",
        "port": 80
      },
      {
        "enabled": true,
        "disabledOnStartup": false,
        "cipherList": "",
        "protocol": "https",
        "address": "",
        "port": 443
      },
      {
        "enabled": true,
        "disabledOnStartup": false,
        "cipherList": "",
        "protocol": "http",
        "address": "",
        "port": 8080
      }
    ],
    "databases": [
      {
        "enabled": true,
        "name": "NGINSTACK",
        "type": "pgsql",
        "reference": "10.0.0.1:nginstack",
        "maxConnections": 10,
        "userName": "nginstack"
      }
    ],
    "config": {
      "timeZoneBias": -180,
      "automaticUpgrade": true,
      "syncToDisk": false
    },
    "arch": "x64",
    "usedVirtualMemory": 623198208,
    "instanceId": "XZH68XLN4ZIFHB6UN6QO1ZV0B4IGKP1Z",
    "hostName": "app-02",
    "openFileCount": 116,
    "startedAt": 1714664189446,
    "memoryStats": {
      "statelessSessionsCount": 4,
      "availablePageFile": 0,
      "statefulSessionsCount": 0,
      "totalPhysical": 16763265024,
      "usedVirtual": 623468544,
      "availablePhysical": 6226657280,
      "standaloneSessionsCount": 0,
      "totalPageFile": 0,
      "usedPhysical": 623468544
    },
    "osName": "Linux 5.15.0-1058-gcp",
    "cpuInfo": {
      "stepping": 6,
      "model": 10,
      "family": 6,
      "vendorId": "GenuineIntel",
      "modelName": "Intel(R) Xeon(R) CPU @ 2.60GHz",
      "logicalCores": 2,
      "physicalCores": 1,
      "addressWidth": 64
    },
    "dbCache": {
      "version": 0,
      "lastSyncError": "",
      "idoCacheSize": 268435456,
      "syncing": false,
      "pageSize": 4096,
      "lastSyncDuration": 4,
      "size": 43917312,
      "tableCount": 38
    },
    "scheduler": {
      "maxConcurrentTaskCount": 4,
      "taskCount": 1,
      "runningTaskCount": 0,
      "failingTaskCount": 0
    },
    "transactionLogger": {
      "pendingLogs": 0,
      "sendingError": ""
    }
  }
]

GET /api/monitoring/v1/engines/<engineId>

Obtém as informações de monitoramento de um Engine específico.

Parâmetros:

  • Caminho do ponto de acesso:
    • engineId: identificador único do Engine
  • Query string: nenhum

Exemplo de consumo:

curl -X GET -i https://<server_name>/api/monitoring/v1/engines/<engineId> -u '<user>:<pass>'

Resultado:

Retorna um objeto da classe EngineInfo:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "updatedAt": 1714744499187,
  "platform": "win32",
  "version": "71.1.14",
  "mainDatabase": "NGINSTACK",
  "hostAddress": "10.0.0.25",
  "freeDisk": 34603913216,
  "openSocketCount": 42,
  "mainHttpPort": 80,
  "providerName": "Nginstack.com",
  "name": "app-01 (80)",
  "paths": {
    "dataDir": "D:\\Engines\\NGINSTACK",
    "logDir": "D:\\Engines\\NGINSTACK\\logs",
    "programDir": "D:\\Engines\\NGINSTACK",
    "mainProgram": "D:\\Engines\\NGINSTACK\\Engine64.exe",
    "tempDir": "D:\\Engines\\NGINSTACK\\tmp"
  },
  "applicationSessions": [],
  "alerts": [],
  "ports": [
    {
      "enabled": true,
      "disabledOnStartup": false,
      "cipherList": "",
      "protocol": "http",
      "address": "",
      "port": 80
    },
    {
      "enabled": true,
      "disabledOnStartup": false,
      "cipherList": "",
      "protocol": "https",
      "address": "",
      "port": 443
    },
    {
      "enabled": true,
      "disabledOnStartup": false,
      "cipherList": "",
      "protocol": "http",
      "address": "",
      "port": 8080
    }
  ],
  "databases": [
    {
      "enabled": true,
      "name": "NGINSTACK",
      "type": "pgsql",
      "reference": "10.0.0.1:nginstack",
      "maxConnections": 10,
      "userName": "nginstack"
    }
  ],
  "config": {
    "timeZoneBias": -180,
    "automaticUpgrade": true,
    "syncToDisk": false
  },
  "arch": "x64",
  "usedVirtualMemory": 520495104,
  "instanceId": "FJXP4E2A53EP6BK1DC2LFN48HAL7CRHW",
  "hostName": "app-01",
  "openFileCount": 152,
  "startedAt": 1714664213421,
  "memoryStats": {
    "statelessSessionsCount": 3,
    "availablePageFile": 30013313024,
    "statefulSessionsCount": 0,
    "totalPhysical": 35433062400,
    "usedVirtual": 520495104,
    "availablePhysical": 23439884288,
    "standaloneSessionsCount": 0,
    "totalPageFile": 40533336064,
    "usedPhysical": 565235712
  },
  "osName": "Windows Server 2016",
  "cpuInfo": {
    "stepping": 6,
    "model": 10,
    "family": 6,
    "vendorId": "GenuineIntel",
    "modelName": "Intel(R) Xeon(R) CPU @ 2.60GHz",
    "logicalCores": 2,
    "physicalCores": 1,
    "addressWidth": 64
  },
  "dbCache": {
    "version": 0,
    "lastSyncError": "",
    "idoCacheSize": 268435456,
    "syncing": false,
    "pageSize": 4096,
    "lastSyncDuration": 0,
    "size": 41746432,
    "tableCount": 37
  },
  "scheduler": {
    "maxConcurrentTaskCount": 11,
    "taskCount": 4,
    "runningTaskCount": 0,
    "failingTaskCount": 0
  },
  "transactionLogger": {
    "pendingLogs": 0,
    "sendingError": ""
  }
}

Resultado quando não é encontrado um Engine com o id informado:

HTTP/1.1 404 Not Found

GET /api/monitoring/v1/engines/<engineId>/sessions

Lista as sessões de aplicação dos usuários de um Engine específico.

Parâmetros:

  • Caminho do ponto de acesso:
    • engineId: identificador único do Engine
  • Query string: nenhum

Exemplo de consumo:

curl -X GET -i https://<server_name>/api/monitoring/v1/engines/<engineId>/sessions -u '<user>:<pass>'

Resultados:

Retorna um array de objetos da classe ApplicationSessionInfo:

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "updatedAt": 1714745333551,
    "realm": "wf-data",
    "clientAddress": "177.0.149.84",
    "clientId": "HJVYQDFF65CRMNRK328SC04ARVZR63Z9",
    "dropsAt": null,
    "dropRequestedAt": null,
    "dropRequesterKey": null,
    "createdAt": 1714745255387,
    "dropRequesterName": null,
    "applicationName": "Sistema Web",
    "accessedAt": 1714745333342,
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
    "userName": "user name",
    "expiresAt": 1714746233342,
    "userKey": 123456,
    "engineId": "FJXP4E2A53EP6BK1DC2LFN48HAL7CRHW",
    "sessionId": "D9373327EE2F4A8FAA3177870914BD27",
    "dropReason": null,
    "applicationKey": -1892602507
  },
  {
    "updatedAt": 1714745333551,
    "realm": "wf-data",
    "clientAddress": "60.0.2.3",
    "clientId": "JQ8VBX42B09DITSZQLUK9L359U00O634",
    "dropsAt": null,
    "dropRequestedAt": null,
    "dropRequesterKey": null,
    "createdAt": 1714745245387,
    "dropRequesterName": null,
    "applicationName": "Sistema Web",
    "accessedAt": 1714745333342,
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
    "userName": "other user",
    "expiresAt": 1714746233342,
    "userKey": 654321,
    "engineId": "FJXP4E2A53EP6BK1DC2LFN48HAL7CRHW",
    "sessionId": "D9373327EE2F4A8FAA3177870914BD27",
    "dropReason": null,
    "applicationKey": -1892602507
  }  
]

Resultado quando não é encontrado um Engine com o id informado:

HTTP/1.1 404 Not Found

GET /api/monitoring/v1/engines/<engineId>/sessions/<sessionId>

Obtém as informações de monitoramento de uma sessão de um Engine específico.

Parâmetros:

  • Caminho do ponto de acesso:
    • engineId: identificador único do Engine
    • sessionId: identificador único de uma sessão
  • Query string: nenhum

Exemplo de consumo:

curl -X GET -i https://<server_name>/api/monitoring/v1/engines/<engineId>/sessions/<sessionId> -u '<user>:<pass>'

Resultado:

Retorna um objeto da classe ApplicationSessionInfo:

HTTP/1.1 200 OK

{
  "updatedAt": 1714745333551,
  "realm": "wf-data",
  "clientAddress": "177.0.149.84",
  "clientId": "HJVYQDFF65CRMNRK328SC04ARVZR63Z9",
  "dropsAt": null,
  "dropRequestedAt": null,
  "dropRequesterKey": null,
  "createdAt": 1714745255387,
  "dropRequesterName": null,
  "applicationName": "Sistema Web",
  "accessedAt": 1714745333342,
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
  "userName": "user name",
  "expiresAt": 1714746233342,
  "userKey": 123456,
  "engineId": "FJXP4E2A53EP6BK1DC2LFN48HAL7CRHW",
  "sessionId": "D9373327EE2F4A8FAA3177870914BD27",
  "dropReason": null,
  "applicationKey": -1892602507
}

Resultado quando não é encontrado o Engine ou a sessão informada:

HTTP/1.1 404 Not Found

GET /api/monitoring/v1/engines/<engineId>/alerts

Lista os alertas de um Engine específico.

Parâmetros:

  • Caminho do ponto de acesso:
    • engineId: identificador único do Engine
  • Query string: nenhum

Exemplo de consumo:

curl -X GET -i https://<server_name>/api/monitoring/v1/engines/<engineId>/alerts -u '<user>:<pass>'

Resultados:

Retorna um array de objetos da classe EngineAlert:

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "severity": "warning",
    "code": "low_free_disk",
    "message": "O servidor do Engine \"app-02 (80)\" (10.0.0.208:80) possui menos que 18.64G de espaço livre no disco do diretório \"/mnt/disks/data-01/engines/nginstack\".",
    "engineId": "XZH68XLN4ZIFHB6UN6QO1ZV0B4IGKP1Z"
  }
]

Resultado quando não é encontrado um Engine com o id informado:

HTTP/1.1 404 Not Found

GET /api/monitoring/v1/sessions

Listas todas as sessões de aplicação de todos os Engines servidores de uma base de dados.

Parâmetros:

  • Query string: nenhum
  • Corpo da requisição: nenhum

Exemplos de consumo:

curl -X GET -i https://<server_name>/api/monitoring/v1/sessions -u '<user>:<pass>'

Resultado:

Retorna um array de objetos da classe ApplicationSessionInfo.

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "updatedAt": 1714745333551,
    "realm": "wf-data",
    "clientAddress": "177.0.149.84",
    "clientId": "HJVYQDFF65CRMNRK328SC04ARVZR63Z9",
    "dropsAt": null,
    "dropRequestedAt": null,
    "dropRequesterKey": null,
    "createdAt": 1714745255387,
    "dropRequesterName": null,
    "applicationName": "Sistema Web",
    "accessedAt": 1714745333342,
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
    "userName": "user name",
    "expiresAt": 1714746233342,
    "userKey": 123456,
    "engineId": "FJXP4E2A53EP6BK1DC2LFN48HAL7CRHW",
    "sessionId": "D9373327EE2F4A8FAA3177870914BD27",
    "dropReason": null,
    "applicationKey": -1892602507
  },
  {
    "updatedAt": 1714745333551,
    "realm": "wf-data",
    "clientAddress": "60.0.2.3",
    "clientId": "JQ8VBX42B09DITSZQLUK9L359U00O634",
    "dropsAt": null,
    "dropRequestedAt": null,
    "dropRequesterKey": null,
    "createdAt": 1714745245387,
    "dropRequesterName": null,
    "applicationName": "Sistema Web",
    "accessedAt": 1714745333342,
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
    "userName": "other user",
    "expiresAt": 1714746233342,
    "userKey": 654321,
    "engineId": "FJXP4E2A53EP6BK1DC2LFN48HAL7CRHW",
    "sessionId": "D9373327EE2F4A8FAA3177870914BD27",
    "dropReason": null,
    "applicationKey": -1892602507
  }  
]

GET /api/monitoring/v1/sessions/<sessionId>

Obtém as informações de monitoramento de uma sessão de aplicação específica.

Parâmetros:

  • Caminho do ponto de acesso:
    • sessionId: identificador único de uma sessão
  • Query string: nenhum

Exemplo de consumo:

curl -X GET -i https://<server_name>/api/monitoring/v1/session/<sessionId> -u '<user>:<pass>'

Resultado:

Retorna um objeto da classe ApplicationSessionInfo:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "updatedAt": 1714745333551,
  "realm": "wf-data",
  "clientAddress": "177.0.149.84",
  "clientId": "HJVYQDFF65CRMNRK328SC04ARVZR63Z9",
  "dropsAt": null,
  "dropRequestedAt": null,
  "dropRequesterKey": null,
  "createdAt": 1714745255387,
  "dropRequesterName": null,
  "applicationName": "Sistema Web",
  "accessedAt": 1714745333342,
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
  "userName": "user name",
  "expiresAt": 1714746233342,
  "userKey": 123456,
  "engineId": "FJXP4E2A53EP6BK1DC2LFN48HAL7CRHW",
  "sessionId": "D9373327EE2F4A8FAA3177870914BD27",
  "dropReason": null,
  "applicationKey": -1892602507
}

Resultado quando não é encontrada a sessão informada:

HTTP/1.1 404 Not Found

GET /api/monitoring/v1/alerts

Listas os alertas de todos os Engines servidores de uma base de dados.

Parâmetros:

  • Query string: nenhum
  • Corpo da requisição: nenhum

Exemplos de consumo:

curl -X GET -i https://<server_name>/api/monitoring/v1/alerts -u '<user>:<pass>'

Resultado:

Retorna um array de objetos da classe EngineAlert:

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "severity": "warning",
    "code": "low_free_disk",
    "message": "O servidor do Engine \"app-02 (80)\" (10.0.0.208:80) possui menos que 18.64G de espaço livre no disco do diretório \"/mnt/disks/data-01/engines/nginstack\".",
    "engineId": "XZH68XLN4ZIFHB6UN6QO1ZV0B4IGKP1Z"
  },
  {
    "severity": "warning",
    "code": "outdated_engine",
    "message": "O Engine \"app-02 (80)\" (10.0.0.208:80) está utilizando uma versão desatualizada (71.1.17).",
    "engineId": "XZH68XLN4ZIFHB6UN6QO1ZV0B4IGKP1Z"
  },
  {
    "severity": "critical",
    "code": "unsupported_os",
    "message": "O sistema operacional \"Windows Server 2012\" utilizado no servidor do Engine \"app-01 (80)\" (10.0.0.25:80) não é suportado pelo sistema.",
    "engineId": "FJXP4E2A53EP6BK1DC2LFN48HAL7CRHW"
  }
]