github.com/hhrutter/nomad@v0.6.0-rc2.0.20170723054333-80c4b03f0705/website/source/api/nodes.html.md (about) 1 --- 2 layout: api 3 page_title: Nodes - HTTP API 4 sidebar_current: api-nodes 5 description: |- 6 The /node endpoints are used to query for and interact with client nodes. 7 --- 8 9 # Nodes HTTP API 10 11 The `/node` endpoints are used to query for and interact with client nodes. 12 13 ### List Nodes 14 15 This endpoint lists all nodes registered with Nomad. 16 17 | Method | Path | Produces | 18 | ------ | ------------------------- | -------------------------- | 19 | `GET` | `/v1/nodes` | `application/json` | 20 21 The table below shows this endpoint's support for 22 [blocking queries](/api/index.html#blocking-queries) and 23 [required ACLs](/api/index.html#acls). 24 25 | Blocking Queries | ACL Required | 26 | ---------------- | ------------ | 27 | `YES` | `none` | 28 29 ### Parameters 30 31 - `prefix` `(string: "")`- Specifies a string to filter nodes on based on an 32 index prefix. This is specified as a querystring parameter. 33 34 ### Sample Request 35 36 ```text 37 $ curl \ 38 https://nomad.rocks/v1/nodes 39 ``` 40 41 ```text 42 $ curl \ 43 https://nomad.rocks/v1/nodes?prefix=prod 44 ``` 45 46 ### Sample Response 47 48 ```json 49 [ 50 { 51 "ID": "fb2170a8-257d-3c64-b14d-bc06cc94e34c", 52 "Datacenter": "dc1", 53 "Name": "bacon-mac", 54 "NodeClass": "", 55 "Drain": false, 56 "Status": "ready", 57 "StatusDescription": "", 58 "CreateIndex": 5, 59 "ModifyIndex": 45 60 } 61 ] 62 ``` 63 64 ## Read Node 65 66 This endpoint queries the status of a client node. 67 68 | Method | Path | Produces | 69 | ------ | ------------------------- | -------------------------- | 70 | `GET` | `/v1/node/:node_id` | `application/json` | 71 72 The table below shows this endpoint's support for 73 [blocking queries](/api/index.html#blocking-queries) and 74 [required ACLs](/api/index.html#acls). 75 76 | Blocking Queries | ACL Required | 77 | ---------------- | ------------ | 78 | `YES` | `none` | 79 80 ### Parameters 81 82 - `:node_id` `(string: <required>)`- Specifies the ID of the node. This must be 83 the full UUID, not the short 8-character one. This is specified as part of the 84 path. 85 86 ### Sample Request 87 88 ```text 89 $ curl \ 90 https://nomad.rocks/v1/node/fb2170a8-257d-3c64-b14d-bc06cc94e34c 91 ``` 92 93 ### Sample Response 94 95 ```json 96 { 97 "ID": "fb2170a8-257d-3c64-b14d-bc06cc94e34c", 98 "SecretID": "", 99 "Datacenter": "dc1", 100 "Name": "bacon-mac", 101 "HTTPAddr": "127.0.0.1:4646", 102 "TLSEnabled": false, 103 "Attributes": { 104 "os.version": "10.12.5", 105 "cpu.modelname": "Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz", 106 "nomad.revision": "f551dcb83e3ac144c9dbb90583b6e82d234662e9", 107 "driver.docker.volumes.enabled": "1", 108 "driver.docker": "1", 109 "cpu.frequency": "2300", 110 "memory.totalbytes": "17179869184", 111 "driver.mock_driver": "1", 112 "kernel.version": "16.6.0", 113 "unique.network.ip-address": "127.0.0.1", 114 "nomad.version": "0.5.5dev", 115 "unique.hostname": "bacon-mac", 116 "cpu.arch": "amd64", 117 "os.name": "darwin", 118 "kernel.name": "darwin", 119 "unique.storage.volume": "/dev/disk1", 120 "driver.docker.version": "17.03.1-ce", 121 "cpu.totalcompute": "18400", 122 "unique.storage.bytestotal": "249783500800", 123 "cpu.numcores": "8", 124 "os.signals": "SIGCONT,SIGSTOP,SIGSYS,SIGINT,SIGIOT,SIGXCPU,SIGSEGV,SIGUSR1,SIGTTIN,SIGURG,SIGUSR2,SIGABRT,SIGALRM,SIGCHLD,SIGFPE,SIGTSTP,SIGIO,SIGKILL,SIGQUIT,SIGXFSZ,SIGBUS,SIGHUP,SIGPIPE,SIGPROF,SIGTRAP,SIGTTOU,SIGILL,SIGTERM", 125 "driver.raw_exec": "1", 126 "unique.storage.bytesfree": "142954643456" 127 }, 128 "Resources": { 129 "CPU": 18400, 130 "MemoryMB": 16384, 131 "DiskMB": 136332, 132 "IOPS": 0, 133 "Networks": [ 134 { 135 "Device": "lo0", 136 "CIDR": "127.0.0.1/32", 137 "IP": "127.0.0.1", 138 "MBits": 1000, 139 "ReservedPorts": null, 140 "DynamicPorts": null 141 } 142 ] 143 }, 144 "Reserved": { 145 "CPU": 0, 146 "MemoryMB": 0, 147 "DiskMB": 0, 148 "IOPS": 0, 149 "Networks": null 150 }, 151 "Links": null, 152 "Meta": null, 153 "NodeClass": "", 154 "ComputedClass": "v1:10952212473894849978", 155 "Drain": false, 156 "Status": "ready", 157 "StatusDescription": "", 158 "StatusUpdatedAt": 1495748907, 159 "CreateIndex": 5, 160 "ModifyIndex": 45 161 } 162 ``` 163 164 ## Create Node Evaluation 165 166 This endpoint creates a new evaluation for the given node. This can be used to 167 force a run of the scheduling logic. 168 169 | Method | Path | Produces | 170 | ------- | ---------------------------- | -------------------------- | 171 | `POST` | `/v1/node/:node_id/evaluate` | `application/json` | 172 173 The table below shows this endpoint's support for 174 [blocking queries](/api/index.html#blocking-queries) and 175 [required ACLs](/api/index.html#acls). 176 177 | Blocking Queries | ACL Required | 178 | ---------------- | ------------ | 179 | `NO` | `none` | 180 181 ### Parameters 182 183 - `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must 184 be the full UUID, not the short 8-character one. This is specified as part of 185 the path. 186 187 ### Sample Request 188 189 ```text 190 $ curl \ 191 https://nomad.rocks/v1/node/fb2170a8-257d-3c64-b14d-bc06cc94e34c/evaluate 192 ``` 193 194 ### Sample Response 195 196 ```json 197 { 198 "HeartbeatTTL": 0, 199 "EvalIDs": [ 200 "4ff1c7a2-c650-4058-f509-d5028ff9566e" 201 ], 202 "EvalCreateIndex": 85, 203 "NodeModifyIndex": 0, 204 "LeaderRPCAddr": "127.0.0.1:4647", 205 "NumNodes": 1, 206 "Servers": [ 207 { 208 "RPCAdvertiseAddr": "127.0.0.1:4647", 209 "RPCMajorVersion": 1, 210 "RPCMinorVersion": 1, 211 "Datacenter": "dc1" 212 } 213 ], 214 "Index": 85, 215 "LastContact": 0, 216 "KnownLeader": false 217 } 218 ``` 219 220 ## Drain Node 221 222 This endpoint toggles the drain mode of the node. When draining is enabled, no 223 further allocations will be assigned to this node, and existing allocations will 224 be migrated to new nodes. 225 226 | Method | Path | Produces | 227 | ------- | ------------------------- | -------------------------- | 228 | `POST` | `/v1/node/:node_id/drain` | `application/json` | 229 230 The table below shows this endpoint's support for 231 [blocking queries](/api/index.html#blocking-queries) and 232 [required ACLs](/api/index.html#acls). 233 234 | Blocking Queries | ACL Required | 235 | ---------------- | ------------ | 236 | `NO` | `none` | 237 238 ### Parameters 239 240 - `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must 241 be the full UUID, not the short 8-character one. This is specified as part of 242 the path. 243 244 - `enable` `(bool: <required>)` - Specifies if drain mode should be enabled. 245 This is specified as a query string parameter. 246 247 ### Sample Request 248 249 ```text 250 $ curl \ 251 https://nomad.rocks/v1/node/fb2170a8-257d-3c64-b14d-bc06cc94e34c/drain?enable=true 252 ``` 253 254 ### Sample Response 255 256 ```json 257 { 258 "EvalIDs": [ 259 "253ec083-22a7-76c9-b8b6-2bf3d4b27bfb" 260 ], 261 "EvalCreateIndex": 91, 262 "NodeModifyIndex": 90, 263 "Index": 90, 264 "LastContact": 0, 265 "KnownLeader": false 266 } 267 ```