conkw documentation - The api

Conkw is a programs that gathers data from many places through the grabbers and displays it through the ui. Of course, the missing piece in all of this is how the UI can get the data it displays.

This is the API.

Note that reading this document is not required for most people. Two clients for the api exists, one in the UI and one in the ExternalInstanceGrabber. This is all you should know for most usages.

If you intend to write your own client however, here are the details:

How to call the API

The API listens to http requests on the /api path of your server. It responds a JSON response with the specified data. It can accept two parameters, mutually exclusive:

The model

The API in grabbers mode will return a JSON like this:

{
  "timestamp": 1621865909383,
  "instanceName":"_default__",
  "errors": [],
  "responseJitter": 52,
  "metrics": {
    "test_eig": {
      "timestamp": 1621865908390,
      "errors": [],
      "extracted": [],
      "extractor": "ExternalInstanceGrabber",
      "name": "test_eig",
      "num": {
        "sys_totalCpuUsage": 0.05900816070307596,
        "sys_freespace_total_/media/extended": 1968874332160,
        "sys_ProcessCpuTime": 1275980000000,
      },
      "timestamps": {},
      "elapsedToGrab": 0,
      "str": {
        "sys_freespace_mountpoints": "/,/home,/media/backup_extended,/media/extended,/media/Travail,/media/movies,/media/rw-media",
        "sys_user": "pieroxy",
        "sys_arch": "amd64",
        "sys_osversion": "5.8.0-53-generic",
        "sys_osname": "Linux",
        "sys_hostname": "pieroxy-dev"
      }
    }
  },
  "needsAuthentication": false
}

At the root level:

Authenticating a call to the API

Note: This part is not yet stable as more user sources will be built, it will change. So I will document it when it will be stable.

Just know that even through http, the password is never transmitted, so no risk there. Of course, the session token can be stolen easily if you don't use https, hence I do recommend to use https for authentication.

Performance considerations