Monitor Service¶
The monitor service is a special hardware service which is included by default in KubOS. Instead of having an external hardware endpoint, this service’s endpoint is the OBC itself.
The monitor service provides a way to check currently running processes and total system memory usage.
Interface Details¶
Specific details about the available GraphQL queries can be found in the monitor service Rust docs.
PS Query¶
The ps
query allows users to get the status of running processes on their OBC.
It has the following schema:
{
ps(pids: [Int!] = null): [
{
pid: Int!
uid: Int
gid: Int
usr: String
grp: String
state: String
ppid: Int
mem: Int
rss: Int
threads: Int
cmd: String
}
]
}
The pids
input parameter specifies an array of process ID numbers which the service should fetch
information about. If the parameter is not specified, then information about all currently running
processes is returned.
For each requested process, the query can return the following data:
pid
- The process ID of the processuid
- The user ID of the user or process which created this processgid
- The group ID of the user or process which created this processusr
- The user name associated with the UIDgrp
- The group name associated with the GIDstate
- A single character indicating the process’ current state. Please refer to this manual for a description of each character’s meaningppid
- The process ID of the process which started this processmem
- The virtual memory size of the process, in bytesrss
- The current number of pages the process has in real memorythreads
- The current number of threads in this processcmd
- The full command, including arguments, which was used to execute this process (taken from /proc/{pid}/cmdline. Defaults to the raw process name if the file cannot be read)
An example query might look like this:
{
ps(pids: [473, 477, 501]) {
pid,
ppid,
threads,
cmd
}
}
The response from the service might look like this:
{
"errs":"",
"msg": {
"ps":[
{
"cmd": "/usr/sbin/file-service",
"pid": 473,
"ppid": 1,
"threads": 1
},
{
"cmd": "/usr/sbin/telemetry-service",
"pid": 477,
"ppid": 1,
"threads": 2
},
{
"cmd": "monitor-service",
"pid": 501,
"ppid": 497,
"threads": 1
}
]
}
}
MemInfo Query¶
The memInfo
query can be used to get information about the memory availablity and usage of the
system as a whole. It works by reading and parsing the /proc/meminfo file.
It has the following schema:
{
memInfo {
total: Int
free: Int
available: Int
lowFree: Int
}
}
The query has the following response fields:
total
- The total usable RAM of the system, in kBfree
- The total amount of free memory (includes lowFree)available
- An estimate of how much memory is available for starting new applications, without swappinglowFree
- The amount of free memory which can be used by the kernel
Note
Not all response fields are available on all systems. They will be omitted from the response if they are not available.