import Divider from '@site/src/components/Divider'; # server these routes relate to interacting with monitor `servers` | name | route | | ---- | ------ | | [list servers](/api/server#list-servers) | `GET /api/server/list` | | [get server](/api/server#get-server) | `GET /api/server/` | | [get server action state](/api/server#get-server-action-state) | `GET /api/server//action_state` | | [get server github accounts](/api/server#get-server-github-accounts) | `GET /api/server//github_accounts` | | [get server docker accounts](/api/server#get-server-docker-accounts) | `GET /api/server//docker_accounts` | | [get server available secrets](/api/server#get-server-available-secrets) | `GET /api/server//secrets` | | [create server](/api/server#create-server) | `POST /api/server/create` | | [create full server](/api/server#create-full-server) | `POST /api/server/create_full` | | [delete server](/api/server#delete-server) | `DELETE /api/server//delete` | | [update server](/api/server#update-server) | `PATCH /api/server/update` | | [get server periphery version](/api/server#get-server-periphery-version) | `GET /api/server//version` | | [get server system information](/api/server#get-server-system-information) | `GET /api/server//system_information` | | [get server stats](/api/server#get-server-stats) | `GET /api/server//stats` | | [get server stats history](/api/server#get-server-stats-history) | `GET /api/server//stats/history` | | [get server stats at time](/api/server#get-server-stats-at-time) | `GET /api/server//stats/at_ts` | | [get docker networks](/api/server#get-docker-networks) | `GET /api/server//networks` | | [prune docker networks](/api/server#prune-docker-networks) | `POST /api/server//networks/prune` | | [get docker images](/api/server#get-docker-images) | `GET /api/server//images` | | [prune docker images](/api/server#prune-docker-images) | `POST /api/server//images/prune` | | [get docker containers](/api/server#get-docker-containers) | `GET /api/server//containers` | | [prune docker containers](/api/server#prune-docker-containers) | `POST /api/server//containers/prune` | ```mdx-code-block ``` ## list servers `GET /api/server/list` this method will return an array of servers with their status that the requesting user has a minimum of `Read` permissions on. ### response body ```json [ { server: Server, status: ServerStatus }, ... ] ``` ```mdx-code-block ``` ## get server `GET /api/server/` this method will return the server with server status that the requesting user has a minimum of `Read` permissions on. it will return `500: Internal Server Error` if the user does not have the required permissions. ### response body ```json { server: Server, status: ServerStatus } ``` ```mdx-code-block ``` ## get server action state `GET /api/server//action_state` this method returns the action state for the server, eg. whether the server is currently `pruning_images`. ### response body ```json { pruning_networks: boolean, pruning_containers: boolean, pruning_images: boolean, } ``` ```mdx-code-block ``` ## get server github accounts `GET /api/server//github_accounts` this method returns a list of all the github account usernames that are available on the server, as defined in the server's periphery config under [github_accounts]. ### response body ```json ["", "", ...] ``` ```mdx-code-block ``` ## get server docker accounts `GET /api/server//docker_accounts` this method returns a list of all the docker account usernames that are available on the server, as defined in the server's periphery config under [docker_accounts]. ### response body ```json ["", "", ...] ``` ```mdx-code-block ``` ## get server available secrets `GET /api/server//secrets` this method returns a list of all the secret keys that are available on the server, as defined in the server's periphery config under [secrets]. ### response body ```json ["", "", ...] ``` ```mdx-code-block ``` ## create server `POST /api/server/create` ### request body ```json { name: string, address: string, // eg. http://12.34.56.78:8000 } ``` ### response body [Server](/api/types#server) ```mdx-code-block ``` ## create full server `POST /api/server/create_full` this method is used to create a new server, already initialized with config. it will return the created server. ### request body [Server](/api/types#server) ### response body [Server](/api/types#server) ```mdx-code-block ``` ## delete server `DELETE /api/server//delete` this method will delete the server, along with all deployments attached to the server. ### response body [Server](/api/types#server) ```mdx-code-block ``` ## update server `PATCH /api/server/update` this method is used to update a servers configuration. ### request body [Server](/api/types#server) ### response body [Server](/api/types#server) ```mdx-code-block ``` ## get server periphery version `GET /api/server//version` this method is used to get the version of the periphery binary running on the server. ### response body ```json string // the periphery version ``` ```mdx-code-block ``` ## get server system information `GET /api/server//system_information` this method gets some information about the host system running the periphery binary. ### response body ```json { name?: string, // the name of the system os?: string, // the os the system is running kernel?: string, // the version of the kernel core_count?: number, // number of cores in the cpu host_name?: string, // host name of the system cpu_brand: string, // information on the cpu of the system } ``` ```mdx-code-block ``` ## get server stats `GET /api/server//stats` this method retrieves current system stats of the server. ### query params ```json cpus=boolean // optional. if true, response will include information about each core individually disks=boolean // optional. if true, response will include breakdown of disk usage by mount point networks=boolean // optional. if true, response will include info on network usage components=boolean // optional. if true, response will include component tempurature processes=boolean // optional. if true, response will include all system processes running on host and their resource usage ``` ### response body ```json { system_load: number, cpu_perc: number, cpu_freq_mhz: number, mem_used_gb: number, mem_total_gb: number, disk: {}, cpus: [], networks: [], components: [], processes: [], polling_rate: Timelength, refresh_ts: number, refresh_list_ts: number, } ``` ```mdx-code-block ``` ## get server stats history `GET /api/server//stats/history` this method will return historical system stats for the server. the response is paginated, to get older data, specify a higher page number. ### query params ```json interval=Timelength // optional, default interval is 1-hr. controls granularity of historical data limit=number // optional, default is 100, max is 500. specifies the number of data points to fetch page=number // optional, default is 0. specifies the page of data, going backward in time. networks=boolean // optional. if true, response will include historical info on network usage components=boolean // optional. if true, response will include historical component tempuratures ``` ### response body ```json [ { ts: number, // unix timestamp in ms server_id: string // specifies the server system_load: number, cpu_perc: number, cpu_freq_mhz: number, mem_used_gb: number, mem_total_gb: number, disk: {}, cpus: [], networks: [], components: [], processes: [], polling_rate: Timelength, }, ... ] ``` ```mdx-code-block ``` ## get server stats at time `GET /api/server//stats/at_ts` this method retrieves the historical stats for a server at a specific timestamp ### query params ```json ts=number // required. the timestamp in ms ``` ### response body ```json { ts: number, // unix timestamp in ms server_id: string // specifies the server system_load: number, cpu_perc: number, cpu_freq_mhz: number, mem_used_gb: number, mem_total_gb: number, disk: {}, cpus: [], networks: [], components: [], processes: [], polling_rate: Timelength, } ``` ```mdx-code-block ``` ## get docker networks `GET /api/server//networks` this method retrieves the docker networks on the server ### response body ```json [ { Name?: string, Id?: string, Created?: string, Scope?: string, Driver?: string, EnableIPv6?: boolean, IPAM?: { Driver?: string, Config?: [ { Subnet?: string, IPRange?: string, Gateway?: string, AuxiliaryAddresses?: {} }, ... ], Options?: {} }, Internal?: boolean, Attachable?: boolean, Ingress?: boolean, Containers?: {}, Options?: {}, Labels?: {} }, ... ] ``` ```mdx-code-block ``` ## prune docker networks `POST /api/server//networks/prune` this method triggers the `network prune` action on the server, which runs `docker network prune -f` on the target server ### response body [Update](/api/types#update) ```mdx-code-block ``` ## get docker images `GET /api/server//images` this method will return a list of images available locally on the server ### response body ```json [ { Id: string, ParentId: string, RepoTags: [string], RepoDigests: [string], Created: number, Size: number, SharedSize: number, VirtualSize: number, Labels: {}, Containers: number, } ] ``` ```mdx-code-block ``` ## prune docker images `POST /api/server//images/prune` this method triggers the `image prune` action, which runs `docker image prune -a -f` on the target server ### response body [Update](/api/types#update) ```mdx-code-block ``` ## get docker containers `GET /api/server//containers` this method is used to retrieve information about all the containers on the target server ### response body ```json [ { name: string, id: string, image: string, state: DockerContainerState, status?: string, }, ... ] ``` ```mdx-code-block ``` ## prune docker containers `POST /api/server//containers/prune` this method triggers the `container prune` action, which runs `docker container prune -f` on the target server ### response body [Update](/api/types#update)