Skip to content

Server info

Mentor Gashi edited this page Nov 9, 2018 · 1 revision

Time after time we need to perform checks on the server in order to troubleshoot the root cause of a random problem. Sometimes it is a closed port, memory usage and disk space.

So during the maintenance of your network it is also crucial to have a third eye focused on your machine status and health.

Currently this API provides grouped information related your server as about and stats. Considering the static data we've set some rarely changed information in about group as OS, hostname and eth0 network configuration. Meanwhile stats group can be used in real-time graphs and have a bright focus on your machine resources.

In order to obtain your server info assuming you've installed the client-api perform a GET request on it via domain or IP to your server following with the directory to client-api and info directory finally attaching the api_key (predefined in config.php) as a GET parameter.


Example URL: http://12.45.67.89/client-api/info?api_key=unique-secret-api-key

Returns JSON data as follows:

{
   "about": {
      "os":"Linux 2.6.32-642.el6.i686",
      "hostname":"localhost.localdomain",
      "network": {
         "address":"172.22.0.2",
         "subnet":"255.255.255.0",
         "gateway":"172.22.0.255"
      }
   },
   "stats": {
      "uptime": {
         "days":30,
         "hours":"04",
         "minutes":11,
         "seconds":32
      },
      "disk": {
         "total":"52.71 GB",
         "free":"46.19 GB",
         "used":"6.52 GB"
      },
      "memory": {
         "total":"3.11 GB",
         "free":"105.07 MB",
         "used":"3.01 GB"
      },
      "ports": {
         "ftp":true,
         "sftp":true,
         "telnet":false,
         "snmp":false,
         "mysql":true
      }
   }
}

In case where you may need to narrow down the data collection, you can add the action attribute to your request as GET parameter; in the info API class about and stats methods are available.

Example URL: http://12.45.67.89/client-api/info?api_key=unique-secret-api-key&action=stats

Returns JSON data as follows:

{
   "uptime": {
      "days":30,
      "hours":"04",
      "minutes":11,
      "seconds":32
   },
   "disk": {
      "total":"52.71 GB",
      "free":"46.19 GB",
      "used":"6.52 GB"
   },
   "memory": {
      "total":"3.11 GB",
      "free":"105.07 MB",
      "used":"3.01 GB"
   },
   "ports": {
      "ftp":true,
      "sftp":true,
      "telnet":false,
      "snmp":false,
      "mysql":true
   }
}