5.5.2. AppState

Description

Information about a probe: a description, a current state, system resources utilization.

Request

{
  "user_id":(number),
  "methods":[
    {
      "method":"AppState",
      "params":{
        "project_id":(number),
        "app_ids":' id1 | [id1,id2] | "*" '
      }
    }
  ]
}
  • user_id - an integer value, a user identifier;

  • project_id - an integer value, a user project identifier;

  • app_ids - probe identifiers, the field can be set in one of the following formats:
    id1 - an integer value, a probe identifier;
    [id1,id2] - an array of integer values, probe identifiers;
    "*" - a string, the “asterisk” symbol, information request for all running probes.

Reply

{
  "reply":[
    {
      "method":"AppState",
      "result":[
        {
          "app_id":(number),
          "name":(string),
          "version":(string),
          "status":(string),
          "hostname":(string),
          "hostOS": (string),
          "cpu":[
            {
              "number":(string),
              "usedPercent":(number)
            }
          ],
          "memoryUsage":{
            "totalPhys":(number),
            "usedPhys":(number),
            "usedPercent":(number),
            "availPhys":(number)
          },
          "disk":{
            "total":(number),
            "available":(number)
          }
          "interfaces":[
            {
              "iface_name":(string),
              "iface_description":(string),,
              "iface_friendly_name":(string),
              "iface_index":(number),
              "iface_v6_index":(number),
              "ip":(string),
              "ipv6":(string),
              "mask":(string),
              "speed":(number)
            }
          ]
          "net_usage": [
            {
              "name": (string),
              "RX": (number),
              "TX": (number)
            }
          ]
        }
      ]
    }
  ]
}
  • app_id - an integer value, a probe identifier;

  • name - a string, a probe name;

  • version - a probe version;

  • status - a string, probe status:
    active - a probe is running;
    not started - a probe has not started.
  • hostname - a string, a host name, a device label in a network;

  • hostOS - a string, information about the operating system on which a probe is running;

  • cpu - an object, a load on each logical CPU core and load average for all cores. A probe requests from the operating system for CPU load data. The object contains the following fields:
    • number - a string, a logical CPU core identifier or the value Total for load average for all cores.

    • usedPercent - a real number, a logical core load or load average (in percent).

  • memoryUsage - an object, the RAM state. The object contains the following fields:
    • totalPhys - an integer value, the RAM size available on the server, in megabytes;

    • usedPhys - an integer value, memory utilization by all applications and the operating system, in megabytes;

    • usedPercent - a real number, size of used memory (in percent);

    • availPhys - an integer value, estimation of how much memory is available for starting new applications, without swapping;

  • disk - an object, state of the HDD partition on which a probe is installed. The object contains the following fields:
    • total - an integer value, a disk partition capacity on which a probe is installed, in megabytes;

    • available - an integer value, amount of free space of the partition on which a probe is installed, in megabytes.

  • interfaces - an object, description of the network interfaces available in the OS. The object contains the following fields:
    • iface_name - a string, a network interface name;

    • iface_description - a string, a network interface which is used in Windows;

    • iface_friendly_name - a string, a network interface friendly name which is used in Windows;

    • iface_index - an integer value, a network interface index for IPv4 protocol which is used in Windows;

    • iface_v6_index - an integer value, a network interface index for IPv6 protocol which is used in Windows;

    • ip - a string, IPv4 address of a network interface;

    • ipv6 - a string, IPv6 address of a network interface;

    • mask - an integer value, subnet mask in CIDR notation;

    • speed - a string, speed of a network interface adapter in Mbps.

  • interfaces - an object, utilization of the network interfaces available in the OS. The object contains the following fields:
    • name - a string, a network interface name;

    • RX - a real number, receive data rate in Kbps;

    • TX - a real number, transmit data rate in Kbps.

Example

Request by the cURL utility
#1. Information request for one probe
curl http://172.16.11.111/ctrl_api/v1/json \
   -H "Content-Type: application/json" \
   --data '{"user_id":4,"methods":[{"method":"AppState","params":{"project_id":23,"app_ids":702}}]}'

#2. Information request for several probes
curl http://172.16.11.111/ctrl_api/v1/json \
   -H "Content-Type: application/json" \
   --data '{"user_id":4,"methods":[{"method":"AppState","params":{"project_id":23,"app_ids":[702,703]}}]}'

#3. Information request for all running probes
curl http://172.16.11.111/ctrl_api/v1/json \
   -H "Content-Type: application/json" \
   --data '{"user_id":4,"methods":[{"method":"AppState","params":{"project_id":23,"app_ids":"*"}}]}'
Example of a reply to a request (the information request for one probe)
 {
   "reply":[
     {
       "method":"AppState",
       "result":[
         {
           "app_id":702,
           "name":"Development probe",
           "version":"1.07-dev (2020.01.21 06:53:25 UTC)",
           "status":"active",
           "hostname":"WorkMashine",
           "hostOS":"Linux 4.15.0-88-generic (x86_64), #88-Ubuntu SMP Tue Feb 11 20:11:34 UTC 2020",
           "cpu":[
             {
               "number":"0",
               "usedPercent":"53.1"
             },
             {
               "number":"1",
               "usedPercent":"29.9"
             },
             {
               "number":"2",
               "usedPercent":"32.0"
             },
             {
               "number":"3",
               "usedPercent":"28.0"
             },
             {
               "number":"Total",
               "usedPercent":"36.3"
             }
           ],
           "memoryUsage":{
             "totalPhys":15937,
             "usedPhys":6078,
             "usedPercent":39,
             "availPhys":8765
           },
           "disk":{
             "total":222522,
             "available":200430
           }
           "interfaces":[
             {
               "iface_name":"{EE5A8772-AEDC-4387-A643-AC1827642969}",
               "iface_description":"Intel(R) 82574L Gigabit #4",
               "iface_friendly_name":"Ethernet 4",
               "iface_index":6,
               "iface_v6_index":6,
               "ip":"10.10.30.203",
               "ipv6":"fe80::3dc8:a7ae:1e79:e4fd%6",
               "mask":24,
               "speed":1000
             },
             {
               "iface_name":"localhost",
               "ip":"127.0.0.1",
               "ipv6":"::1"
               "mask":8
             }
           ]
           "net_usage": [
             {
               "name":"{EE5A8772-AEDC-4387-A643-AC1827642969}",
               "RX": 631.9,
               "TX": 1412.0
             },
             {
               "name": "localhost",
               "RX": 17871.0,
               "TX": 2.89
             }
           ]
         }
       ]
     }
   ]
 }