3.14. systemmanager

The systemmanager class is used to retrieve information about the system. Every systemmanager class request contains several parameters:

Parameter Value Description
id   Any unique value for the request, including a hash, checksum, or uuid.
name systemmanager  
namespace sysadm  
action   Actions include “batteryinfo”, “cpupercentage”, “cputemps”, “externalmounts”, “halt”, “killproc”, “memorystats”, “procinfo”, “reboot”, “setsysctl”, “sysctllist”, and “systemmanager”

The rest of this section provides examples of the available actions for each type of request, along with their responses.

3.14.1. Memory Statistics

The “memorystats” action returns memory statistics, including the amount of active, cached, free, inactive, and total physical (wired) memory.

REST Request

PUT /sysadm/systemmanager
{
  "action" : "memorystats"
}

REST Response

{
   "args": {
       "memorystats": {
           "active": "818",
           "cache": "69",
           "free": "4855",
           "inactive": "2504",
           "wired": "1598"
       }
   }
}

WebSocket Request

{
  "id" : "fooid",
  "args" : {
     "action" : "memorystats"
  },
  "namespace" : "sysadm",
  "name" : "systemmanager"
}

WebSocket Response

{
 "args": {
   "memorystats": {
     "active": "826",
     "cache": "69",
     "free": "4847",
     "inactive": "2505",
     "wired": "1598"
   }
 },
 "id": "fooid",
 "name": "response",
 "namespace": "sysadm"
}

3.14.2. CPU Usage

The “cpupercentage” action returns the usage percentage of each CPU.

REST Request

PUT /sysadm/systemmanager
{
  "action" : "cpupercentage"
}

REST Response

{
   "args": {
       "cpupercentage": {
           "busytotal": "28",
           "cpu1": {
               "busy": "28"
           },
           "cpu2": {
               "busy": "31"
           },
           "cpu3": {
               "busy": "29"
           },
           "cpu4": {
               "busy": "24"
           }
       }
   }
}

WebSocket Request

{
  "args" : {
     "action" : "cpupercentage"
  },
  "name" : "systemmanager",
  "id" : "fooid",
  "namespace" : "sysadm"
}

WebSocket Response

{
 "args": {
   "cpupercentage": {
     "busytotal": "28",
     "cpu1": {
       "busy": "28"
     },
     "cpu2": {
       "busy": "31"
     },
     "cpu3": {
       "busy": "29"
     },
     "cpu4": {
       "busy": "24"
     }
   }
 },
 "id": "fooid",
 "name": "response",
 "namespace": "sysadm"
}

3.14.3. CPU Temperature

The “cputemps” action returns the temperature of each CPU.

REST Request

PUT /sysadm/systemmanager
{
  "action" : "cputemps"
}

REST Response

{
   "args": {
       "cputemps": {
           "cpu0": "27.0C",
           "cpu1": "34.0C",
           "cpu2": "33.0C",
           "cpu3": "31.0C"
       }
   }
}

WebSocket Request

{
  "args" : {
     "action" : "cputemps"
  },
  "id" : "fooid",
  "name" : "systemmanager",
  "namespace" : "sysadm"
}

WebSocket Response

{
 "args": {
   "cputemps": {
     "cpu0": "34.0C",
     "cpu1": "32.0C",
     "cpu2": "34.0C",
     "cpu3": "31.0C"
   }
 },
 "id": "fooid",
 "name": "response",
 "namespace": "sysadm"
}

3.14.4. Process Information

The “procinfo” action lists information about each running process. Since a system will have many running processes, the responses in this section only show one process as an example of the type of information listed by this action.

REST Request

PUT /sysadm/systemmanager
{
  "action" : "procinfo"
}

REST Response

{
   "args": {
       "procinfo": {
                 "228": {
       "command": "adjkerntz",
       "cpu": "3",
       "nice": "0",
       "pri": "52",
       "res": "1968K",
       "size": "8276K",
       "state": "pause",
       "thr": "1",
       "time": "0:00",
       "username": "root",
       "wcpu": "0.00%"
         }
       }
   }
}

WebSocket Request

{
  "id" : "fooid",
  "namespace" : "sysadm",
  "name" : "systemmanager",
  "args" : {
     "action" : "procinfo"
  }
}

WebSocket Response

{
 "args": {
   "procinfo": {
     "228": {
       "command": "adjkerntz",
       "cpu": "3",
       "nice": "0",
       "pri": "52",
       "res": "1968K",
       "size": "8276K",
       "state": "pause",
       "thr": "1",
       "time": "0:00",
       "username": "root",
       "wcpu": "0.00%"
     }
 },
 "id": "fooid",
 "name": "response",
 "namespace": "sysadm"
}

3.14.5. Kill a Process

The “killproc” action can be used to send a specified signal to the specified Process ID (PID). The following signals are supported: INT, QUIT, ABRT, KILL, ALRM, or TERM.

REST Request

PUT /sysadm/systemmanager
{
  "signal" : "KILL",
  "pid" : "13939",
  "action" : "killproc"
}

REST Response

{
   "args": {
       "killproc": {
           "action": "killproc",
           "pid": "13939",
           "signal": "KILL"
       }
   }
}

WebSocket Request

{
  "namespace" : "sysadm",
  "args" : {
     "pid" : "13939",
     "action" : "killproc",
     "signal" : "KILL"
  },
  "id" : "fooid",
  "name" : "systemmanager"
}

WebSocket Response

{
 "args": {
   "killproc": {
     "action": "killproc",
     "pid": "13939",
     "signal": "KILL"
   }
 },
 "id": "fooid",
 "name": "response",
 "namespace": "sysadm"
}

3.14.6. Battery Information

The “batteryinfo” action will indicate whether or not a battery exists. If it does, it will also report its current charge percentage level (1-99), its status (offline, charging, on backup, or unknown), and estimated time left (in seconds).

REST Request

PUT /sysadm/systemmanager
{
  "action" : "batteryinfo"
}

REST Response

{
   "args": {
       "batteryinfo": {
           "battery": "false"
       }
   }
}

WebSocket Request

{
  "namespace" : "sysadm",
  "name" : "systemmanager",
  "id" : "fooid",
  "args" : {
     "action" : "batteryinfo"
  }
}

WebSocket Response

{
 "args": {
   "batteryinfo": {
     "battery": "false"
   }
 },
 "id": "fooid",
 "name": "response",
 "namespace": "sysadm"
}

3.14.7. List External Mounts

The “externalmounts” action returns a list of mounted external devices. Supported device types are UNKNOWN, USB, HDRIVE (external hard drive), DVD, and SDCARD. For each mounted device, the response will include the device name, filesystem, mount path, and device type.

REST Request

PUT /sysadm/systemmanager
{
  "action" : "externalmounts"
}

REST Response

{
   "args": {
       "externalmounts": {
           "/dev/fuse": {
               "filesystem": "fusefs",
               "path": "/usr/home/kris/.gvfs",
               "type": "UNKNOWN"
           }
       }
   }
}

WebSocket Request

{
  "id" : "fooid",
  "namespace" : "sysadm",
  "name" : "systemmanager",
  "args" : {
     "action" : "externalmounts"
  }
}

WebSocket Response

{
 "args": {
   "externalmounts": {
     "/dev/fuse": {
       "filesystem": "fusefs",
       "path": "/usr/home/kris/.gvfs",
       "type": "UNKNOWN"
     }
   }
 },
 "id": "fooid",
 "name": "response",
 "namespace": "sysadm"
}

3.14.8. System Information

The “systemmanager” action lists system information, including the architecture, number of CPUs, type of CPU, hostname, kernel name and version, system version and patch level, total amount of RAM, and the system’s uptime.

REST Request

PUT /sysadm/systemmanager
{
  "action" : "systemmanager"
}

REST Response

{
   "args": {
       "systemmanager": {
           "arch": "amd64",
           "cpucores": "4",
           "cputype": "Intel(R) Xeon(R) CPU E3-1220 v3 @ 3.10GHz",
           "hostname": "krisdesktop",
           "kernelident": "GENERIC",
           "kernelversion": "10.2-RELEASE-p11",
           "systemversion": "10.2-RELEASE-p12",
           "totalmem": 10720,
           "uptime": "up 2 days 5:09"
       }
   }
}

WebSocket Request

{
  "args" : {
     "action" : "systemmanager"
  },
  "id" : "fooid",
  "name" : "systemmanager",
  "namespace" : "sysadm"
}

WebSocket Response

{
 "args": {
   "systemmanager": {
     "arch": "amd64",
     "cpucores": "4",
     "cputype": "Intel(R) Xeon(R) CPU E3-1220 v3 @ 3.10GHz",
     "hostname": "krisdesktop",
     "kernelident": "GENERIC",
     "kernelversion": "10.2-RELEASE-p11",
     "systemversion": "10.2-RELEASE-p12",
     "totalmem": 10720,
     "uptime": "up 2 days 5:09"
   }
 },
 "id": "fooid",
 "name": "response",
 "namespace": "sysadm"
}

3.14.9. List Sysctls

The “sysctllist” action lists returns the list of all configurable sysctl values. Since there are many, the example responses in this section have been truncated.

REST Request

PUT /sysadm/systemmanager
{
  "action" : "sysctllist"
}

REST Response

{
   "args": {
       "sysctllist": {
           "compat.ia32.maxdsiz": "536870912",
           "compat.ia32.maxssiz": "67108864",
           "compat.ia32.maxvmem": "0",
           "compat.linux.osname": "Linux",
           "compat.linux.osrelease": "2.6.18",
           "compat.linux.oss_version": "198144",
           "compat.linux32.maxdsiz": "536870912",
           "compat.linux32.maxssiz": "67108864",
           "compat.linux32.maxvmem": "0",
       }
   }
}

WebSocket Request

{
  "name" : "systemmanager",
  "namespace" : "sysadm",
  "id" : "fooid",
  "args" : {
     "action" : "sysctllist"
  }
}

WebSocket Response

{
 "args": {
   "sysctllist": {
     "compat.ia32.maxdsiz": "536870912",
     "compat.ia32.maxssiz": "67108864",
     "compat.ia32.maxvmem": "0",
     "compat.linux.osname": "Linux",
     "compat.linux.osrelease": "2.6.18",
     "compat.linux.oss_version": "198144",
     "compat.linux32.maxdsiz": "536870912",
     "compat.linux32.maxssiz": "67108864",
     "compat.linux32.maxvmem": "0",
   }
 },
 "id": "fooid",
 "name": "response",
 "namespace": "sysadm"
}

3.14.10. Set a Sysctl

The “setsysctl” action sets the specified configurable sysctl to the specified value. The response indicates that the old value was changed to the new value.

REST Request

PUT /sysadm/systemmanager
{
  "value" : "0",
  "sysctl" : "security.jail.mount_devfs_allowed",
  "action" : "setsysctl"
}

REST Response

{
   "args": {
       "setsysctl": {
           "response": "security.jail.mount_devfs_allowed: 1 -> 0",
           "sysctl": "security.jail.mount_devfs_allowed",
           "value": "0"
       }
   }
}

WebSocket Request

{
  "args" : {
     "value" : "0",
     "action" : "setsysctl",
     "sysctl" : "security.jail.mount_devfs_allowed"
  },
  "name" : "systemmanager",
  "namespace" : "sysadm",
  "id" : "fooid"
}

WebSocket Response

{
 "args": {
   "setsysctl": {
     "response": "security.jail.mount_devfs_allowed: 1 -> 0",
     "sysctl": "security.jail.mount_devfs_allowed",
     "value": "0"
   }
 },
 "id": "fooid",
 "name": "response",
 "namespace": "sysadm"
}

3.14.11. Halt the System

The “halt” action shuts down the system.

REST Request

PUT /sysadm/systemmanager
{
  "action" : "halt"
}

WebSocket Request

{
  "id" : "fooid",
  "args" : {
     "action" : "halt"
  },
  "name" : "systemmanager",
  "namespace" : "sysadm"
}

Response

{
 "args": {
   "halt": {
     "response": "true"
   }
 },
 "id": "fooid",
 "name": "response",
 "namespace": "sysadm"
}

3.14.12. Reboot the System

The “reboot” action reboots the system.

REST Request

PUT /sysadm/systemmanager
{
  "action" : "reboot"
}

WebSocket Request

{
  "id" : "fooid",
  "args" : {
     "action" : "reboot"
  },
  "name" : "systemmanager",
  "namespace" : "sysadm"
}

Response

{
 "args": {
   "reboot": {
     "response": "true"
   }
 },
 "id": "fooid",
 "name": "response",
 "namespace": "sysadm"
}