github.com/dkerwin/nomad@v0.3.3-0.20160525181927-74554135514b/website/source/docs/http/node.html.md (about) 1 --- 2 layout: "http" 3 page_title: "HTTP API: /v1/node" 4 sidebar_current: "docs-http-node-" 5 description: |- 6 The '/1/node-' endpoint is used to query a specific client node. 7 --- 8 9 # /v1/node 10 11 The `node` endpoint is used to query the a specific client node. 12 By default, the agent's local region is used; another region can 13 be specified using the `?region=` query parameter. 14 15 ## GET 16 17 <dl> 18 <dt>Description</dt> 19 <dd> 20 Query the status of a client node registered with Nomad. 21 </dd> 22 23 <dt>Method</dt> 24 <dd>GET</dd> 25 26 <dt>URL</dt> 27 <dd>`/v1/node/<ID>`</dd> 28 29 <dt>Parameters</dt> 30 <dd> 31 None 32 </dd> 33 34 <dt>Blocking Queries</dt> 35 <dd> 36 [Supported](/docs/http/index.html#blocking-queries) 37 </dd> 38 39 <dt>Returns</dt> 40 <dd> 41 42 ```javascript 43 { 44 "ID": "c9972143-861d-46e6-df73-1d8287bc3e66", 45 "Datacenter": "dc1", 46 "Name": "Armons-MacBook-Air.local", 47 "Attributes": { 48 "arch": "amd64", 49 "cpu.frequency": "1300.000000", 50 "cpu.modelname": "Intel(R) Core(TM) i5-4250U CPU @ 1.30GHz", 51 "cpu.numcores": "2", 52 "cpu.totalcompute": "2600.000000", 53 "driver.exec": "1", 54 "driver.java": "1", 55 "driver.java.runtime": "Java(TM) SE Runtime Environment (build 1.8.0_05-b13)", 56 "driver.java.version": "1.8.0_05", 57 "driver.java.vm": "Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)", 58 "hostname": "Armons-MacBook-Air.local", 59 "kernel.name": "darwin", 60 "kernel.version": "14.4.0", 61 "memory.totalbytes": "8589934592", 62 "network.ip-address": "127.0.0.1", 63 "os.name": "darwin", 64 "os.version": "14.4.0", 65 "storage.bytesfree": "35888713728", 66 "storage.bytestotal": "249821659136", 67 "storage.volume": "/dev/disk1" 68 }, 69 "Resources": { 70 "CPU": 2600, 71 "MemoryMB": 8192, 72 "DiskMB": 34226, 73 "IOPS": 0, 74 "Networks": null 75 }, 76 "Reserved": null, 77 "Links": {}, 78 "Meta": {}, 79 "NodeClass": "", 80 "Drain": false, 81 "Status": "ready", 82 "StatusDescription": "", 83 "CreateIndex": 3, 84 "ModifyIndex": 4 85 } 86 ``` 87 88 </dd> 89 </dl> 90 91 <dl> 92 <dt>Description</dt> 93 <dd> 94 Query the allocations belonging to a single node. 95 </dd> 96 97 <dt>Method</dt> 98 <dd>GET</dd> 99 100 <dt>URL</dt> 101 <dd>`/v1/node/<id>/allocations`</dd> 102 103 <dt>Parameters</dt> 104 <dd> 105 None 106 </dd> 107 108 <dt>Blocking Queries</dt> 109 <dd> 110 [Supported](/docs/http/index.html#blocking-queries) 111 </dd> 112 113 <dt>Returns</dt> 114 <dd> 115 116 ```javascript 117 [ 118 { 119 "ID": "203266e5-e0d6-9486-5e05-397ed2b184af", 120 "EvalID": "e68125ed-3fba-fb46-46cc-291addbc4455", 121 "Name": "example.cache[0]", 122 "NodeID": "e02b6169-83bd-9df6-69bd-832765f333eb", 123 "JobID": "example", 124 "ModifyIndex": 9, 125 "Resources": { 126 "Networks": [ 127 { 128 "DynamicPorts": [ 129 { 130 "Value": 20802, 131 "Label": "db" 132 } 133 ], 134 "ReservedPorts": null, 135 "MBits": 10, 136 "IP": "", 137 "CIDR": "", 138 "Device": "" 139 } 140 ], 141 "IOPS": 0, 142 "DiskMB": 0, 143 "MemoryMB": 256, 144 "CPU": 500 145 }, 146 "TaskGroup": "cache", 147 "Job": { 148 "ModifyIndex": 5, 149 "CreateIndex": 5, 150 "StatusDescription": "", 151 "Status": "", 152 "Meta": null, 153 "Update": { 154 "MaxParallel": 1, 155 "Stagger": 1e+10 156 }, 157 "TaskGroups": [ 158 { 159 "Meta": null, 160 "Tasks": [ 161 { 162 "Meta": null, 163 "Resources": { 164 "Networks": [ 165 { 166 "DynamicPorts": [ 167 { 168 "Value": 20802, 169 "Label": "db" 170 } 171 ], 172 "ReservedPorts": null, 173 "MBits": 0, 174 "IP": "127.0.0.1", 175 "CIDR": "", 176 "Device": "lo" 177 } 178 ], 179 "IOPS": 0, 180 "DiskMB": 0, 181 "MemoryMB": 256, 182 "CPU": 500 183 }, 184 "Constraints": null, 185 "Services": [ 186 { 187 "Checks": [ 188 { 189 "Timeout": 2e+09, 190 "Interval": 1e+10, 191 "Protocol": "", 192 "Http": "", 193 "Script": "", 194 "Type": "tcp", 195 "Name": "alive", 196 "Id": "" 197 } 198 ], 199 "PortLabel": "db", 200 "Tags": [ 201 "global", 202 "cache" 203 ], 204 "Name": "example-cache-redis", 205 "Id": "" 206 } 207 ], 208 "Env": null, 209 "Config": { 210 "port_map": [ 211 { 212 "db": 6379 213 } 214 ], 215 "image": "redis:latest" 216 }, 217 "Driver": "docker", 218 "Name": "redis" 219 } 220 ], 221 "RestartPolicy": { 222 "Delay": 2.5e+10, 223 "Interval": 3e+11, 224 "Attempts": 10 225 }, 226 "Constraints": null, 227 "Count": 1, 228 "Name": "cache" 229 } 230 ], 231 "Region": "global", 232 "ID": "example", 233 "Name": "example", 234 "Type": "service", 235 "Priority": 50, 236 "AllAtOnce": false, 237 "Datacenters": [ 238 "dc1" 239 ], 240 "Constraints": [ 241 { 242 "Operand": "=", 243 "RTarget": "linux", 244 "LTarget": "${attr.kernel.name}" 245 } 246 ] 247 }, 248 "TaskResources": { 249 "redis": { 250 "Networks": [ 251 { 252 "DynamicPorts": [ 253 { 254 "Value": 20802, 255 "Label": "db" 256 } 257 ], 258 "ReservedPorts": null, 259 "MBits": 0, 260 "IP": "127.0.0.1", 261 "CIDR": "", 262 "Device": "lo" 263 } 264 ], 265 "IOPS": 0, 266 "DiskMB": 0, 267 "MemoryMB": 256, 268 "CPU": 500 269 } 270 }, 271 "Metrics": { 272 "CoalescedFailures": 0, 273 "AllocationTime": 1590406, 274 "NodesEvaluated": 1, 275 "NodesFiltered": 0, 276 "ClassFiltered": null, 277 "ConstraintFiltered": null, 278 "NodesExhausted": 0, 279 "ClassExhausted": null, 280 "DimensionExhausted": null, 281 "Scores": { 282 "e02b6169-83bd-9df6-69bd-832765f333eb.binpack": 6.133651487695705 283 } 284 }, 285 "DesiredStatus": "run", 286 "DesiredDescription": "", 287 "ClientStatus": "running", 288 "ClientDescription": "", 289 "TaskStates": { 290 "redis": { 291 "Events": [ 292 { 293 "KillError": "", 294 "Message": "", 295 "Signal": 0, 296 "ExitCode": 0, 297 "DriverError": "", 298 "Time": 1447806038427841000, 299 "Type": "Started" 300 } 301 ], 302 "State": "running" 303 } 304 }, 305 "CreateIndex": 7 306 }, 307 ... 308 ] 309 ``` 310 311 </dd> 312 </dl> 313 314 ## PUT / POST 315 316 <dl> 317 <dt>Description</dt> 318 <dd> 319 Creates a new evaluation for the given node. This can be used to force 320 run the scheduling logic if necessary. 321 </dd> 322 323 <dt>Method</dt> 324 <dd>PUT or POST</dd> 325 326 <dt>URL</dt> 327 <dd>`/v1/node/<ID>/evaluate`</dd> 328 329 <dt>Parameters</dt> 330 <dd> 331 None 332 </dd> 333 334 <dt>Returns</dt> 335 <dd> 336 337 ```javascript 338 { 339 "EvalIDs": ["d092fdc0-e1fd-2536-67d8-43af8ca798ac"], 340 "EvalCreateIndex": 35, 341 "NodeModifyIndex": 34 342 } 343 ``` 344 345 </dd> 346 </dl> 347 348 <dl> 349 <dt>Description</dt> 350 <dd> 351 Toggle the drain mode of the node. When enabled, no further 352 allocations will be assigned and existing allocations will be 353 migrated. 354 </dd> 355 356 <dt>Method</dt> 357 <dd>PUT or POST</dd> 358 359 <dt>URL</dt> 360 <dd>`/v1/node/<ID>/drain`</dd> 361 362 <dt>Parameters</dt> 363 <dd> 364 <ul> 365 <li> 366 <span class="param">enable</span> 367 <span class="param-flags">required</span> 368 Boolean value provided as a query parameter to either set 369 enabled to true or false. 370 </li> 371 </ul> 372 </dd> 373 374 <dt>Returns</dt> 375 <dd> 376 377 ```javascript 378 { 379 "EvalID": "d092fdc0-e1fd-2536-67d8-43af8ca798ac", 380 "EvalCreateIndex": 35, 381 "NodeModifyIndex": 34 382 } 383 ``` 384 385 </dd> 386 </dl>