github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/api-docs/nodes.mdx (about) 1 --- 2 layout: api 3 page_title: Nodes - HTTP API 4 sidebar_title: Nodes 5 description: The /node endpoints are used to query for and interact with client nodes. 6 --- 7 8 # Nodes HTTP API 9 10 The `/node` endpoints are used to query for and interact with client nodes. 11 12 ## List Nodes 13 14 This endpoint lists all nodes registered with Nomad. 15 16 | Method | Path | Produces | 17 | ------ | ----------- | ------------------ | 18 | `GET` | `/v1/nodes` | `application/json` | 19 20 The table below shows this endpoint's support for 21 [blocking queries](/api-docs#blocking-queries) and 22 [required ACLs](/api-docs#acls). 23 24 | Blocking Queries | ACL Required | 25 | ---------------- | ------------ | 26 | `YES` | `node:read` | 27 28 ### Parameters 29 30 - `prefix` `(string: "")`- Specifies a string to filter nodes based on an ID 31 prefix. Because the value is decoded to bytes, the prefix must have an even 32 number of hexadecimal characters (0-9a-f). This is specified as a query 33 string parameter. 34 35 - `resources` `(bool: false)` - Specifies whether or not to include the 36 `NodeResources` and `ReservedResources` fields in the response. 37 38 ### Sample Request 39 40 ```shell-session 41 $ curl \ 42 http://localhost:4646/v1/nodes 43 ``` 44 45 ```shell-session 46 $ curl \ 47 http://localhost:4646/v1/nodes?prefix=f7476465 48 ``` 49 50 ### Sample Response 51 52 ```json 53 [ 54 { 55 "Address": "10.138.0.5", 56 "CreateIndex": 6, 57 "Datacenter": "dc1", 58 "Drain": false, 59 "Drivers": { 60 "java": { 61 "Attributes": { 62 "driver.java.runtime": "OpenJDK Runtime Environment (build 1.8.0_162-8u162-b12-1~deb9u1-b12)", 63 "driver.java.vm": "OpenJDK 64-Bit Server VM (build 25.162-b12, mixed mode)", 64 "driver.java.version": "openjdk version \"1.8.0_162" 65 }, 66 "Detected": true, 67 "HealthDescription": "", 68 "Healthy": true, 69 "UpdateTime": "2018-04-11T23:33:48.781948669Z" 70 }, 71 "qemu": { 72 "Attributes": null, 73 "Detected": false, 74 "HealthDescription": "", 75 "Healthy": false, 76 "UpdateTime": "2018-04-11T23:33:48.7819898Z" 77 }, 78 "rkt": { 79 "Attributes": { 80 "driver.rkt.appc.version": "0.8.11", 81 "driver.rkt.volumes.enabled": "1", 82 "driver.rkt.version": "1.29.0" 83 }, 84 "Detected": true, 85 "HealthDescription": "Driver rkt is detected: true", 86 "Healthy": true, 87 "UpdateTime": "2018-04-11T23:34:48.81079772Z" 88 }, 89 "docker": { 90 "Attributes": { 91 "driver.docker.bridge_ip": "172.17.0.1", 92 "driver.docker.version": "18.03.0-ce", 93 "driver.docker.volumes.enabled": "1" 94 }, 95 "Detected": true, 96 "HealthDescription": "Driver is available and responsive", 97 "Healthy": true, 98 "UpdateTime": "2018-04-11T23:34:48.713720323Z" 99 }, 100 "exec": { 101 "Attributes": {}, 102 "Detected": true, 103 "HealthDescription": "Driver exec is detected: true", 104 "Healthy": true, 105 "UpdateTime": "2018-04-11T23:34:48.711026521Z" 106 }, 107 "raw_exec": { 108 "Attributes": {}, 109 "Detected": true, 110 "HealthDescription": "", 111 "Healthy": true, 112 "UpdateTime": "2018-04-11T23:33:48.710448534Z" 113 } 114 }, 115 "ID": "f7476465-4d6e-c0de-26d0-e383c49be941", 116 "ModifyIndex": 2526, 117 "Name": "nomad-4", 118 "NodeClass": "", 119 "SchedulingEligibility": "eligible", 120 "Status": "ready", 121 "StatusDescription": "", 122 "Version": "0.8.0-rc1" 123 } 124 ] 125 ``` 126 127 ## Read Node 128 129 This endpoint queries the status of a client node. 130 131 | Method | Path | Produces | 132 | ------ | ------------------- | ------------------ | 133 | `GET` | `/v1/node/:node_id` | `application/json` | 134 135 The table below shows this endpoint's support for 136 [blocking queries](/api-docs#blocking-queries) and 137 [required ACLs](/api-docs#acls). 138 139 | Blocking Queries | ACL Required | 140 | ---------------- | ------------ | 141 | `YES` | `node:read` | 142 143 ### Parameters 144 145 - `:node_id` `(string: <required>)`- Specifies the ID of the node. This must be 146 the full UUID, not the short 8-character one. This is specified as part of the 147 path. 148 149 ### Sample Request 150 151 ```shell-session 152 $ curl \ 153 http://localhost:4646/v1/node/f7476465-4d6e-c0de-26d0-e383c49be941 154 ``` 155 156 ### Sample Response 157 158 ```json 159 { 160 "Attributes": { 161 "consul.datacenter": "dc1", 162 "consul.revision": "d2adfc0bd", 163 "consul.server": "true", 164 "consul.version": "1.5.2", 165 "cpu.arch": "amd64", 166 "cpu.frequency": "4000", 167 "cpu.modelname": "Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz", 168 "cpu.numcores": "8", 169 "cpu.totalcompute": "32000", 170 "driver.docker": "1", 171 "driver.docker.bridge_ip": "172.17.0.1", 172 "driver.docker.os_type": "linux", 173 "driver.docker.runtimes": "runc", 174 "driver.docker.version": "18.09.6", 175 "driver.docker.volumes.enabled": "true", 176 "driver.mock": "true", 177 "driver.mock_driver": "1", 178 "driver.raw_exec": "1", 179 "kernel.name": "linux", 180 "kernel.version": "4.19.56", 181 "memory.totalbytes": "16571674624", 182 "nomad.advertise.address": "127.0.0.1:4646", 183 "nomad.revision": "30da2b8f6c3aa860113c9d313c695a05eff5bb97+CHANGES", 184 "nomad.version": "0.10.0-dev", 185 "os.name": "nixos", 186 "os.signals": "SIGTTOU,SIGTTIN,SIGSTOP,SIGSYS,SIGXCPU,SIGBUS,SIGKILL,SIGTERM,SIGIOT,SIGILL,SIGIO,SIGQUIT,SIGSEGV,SIGUSR1,SIGXFSZ,SIGCHLD,SIGUSR2,SIGURG,SIGFPE,SIGHUP,SIGINT,SIGPROF,SIGCONT,SIGALRM,SIGPIPE,SIGTRAP,SIGTSTP,SIGWINCH,SIGABRT", 187 "os.version": "\"19.03.173017.85f820d6e41 (Koi)\"", 188 "unique.cgroup.mountpoint": "/sys/fs/cgroup", 189 "unique.consul.name": "mew", 190 "unique.hostname": "mew", 191 "unique.network.ip-address": "127.0.0.1", 192 "unique.storage.bytesfree": "8273698816", 193 "unique.storage.bytestotal": "8285835264", 194 "unique.storage.volume": "tmpfs" 195 }, 196 "ComputedClass": "v1:390058673753570317", 197 "CreateIndex": 6, 198 "Datacenter": "dc1", 199 "Drain": false, 200 "DrainStrategy": null, 201 "Drivers": { 202 "docker": { 203 "Attributes": { 204 "driver.docker": "true", 205 "driver.docker.bridge_ip": "172.17.0.1", 206 "driver.docker.os_type": "linux", 207 "driver.docker.runtimes": "runc", 208 "driver.docker.version": "18.09.6", 209 "driver.docker.volumes.enabled": "true" 210 }, 211 "Detected": true, 212 "HealthDescription": "Healthy", 213 "Healthy": true, 214 "UpdateTime": "2019-08-26T12:22:50.762716458+02:00" 215 }, 216 "exec": { 217 "Attributes": null, 218 "Detected": false, 219 "HealthDescription": "Driver must run as root", 220 "Healthy": false, 221 "UpdateTime": "2019-08-26T12:22:50.6873373+02:00" 222 }, 223 "java": { 224 "Attributes": null, 225 "Detected": false, 226 "HealthDescription": "Driver must run as root", 227 "Healthy": false, 228 "UpdateTime": "2019-08-26T12:22:50.687274359+02:00" 229 }, 230 "mock_driver": { 231 "Attributes": { 232 "driver.mock": "true" 233 }, 234 "Detected": true, 235 "HealthDescription": "Healthy", 236 "Healthy": true, 237 "UpdateTime": "2019-08-26T12:22:50.687978919+02:00" 238 }, 239 "qemu": { 240 "Attributes": null, 241 "Detected": false, 242 "HealthDescription": "", 243 "Healthy": false, 244 "UpdateTime": "2019-08-26T12:22:50.688023782+02:00" 245 }, 246 "raw_exec": { 247 "Attributes": { 248 "driver.raw_exec": "true" 249 }, 250 "Detected": true, 251 "HealthDescription": "Healthy", 252 "Healthy": true, 253 "UpdateTime": "2019-08-26T12:22:50.687733347+02:00" 254 }, 255 "rkt": { 256 "Attributes": null, 257 "Detected": false, 258 "HealthDescription": "Driver must run as root", 259 "Healthy": false, 260 "UpdateTime": "2019-08-26T12:22:50.68796043+02:00" 261 } 262 }, 263 "Events": [ 264 { 265 "CreateIndex": 0, 266 "Details": null, 267 "Message": "Node registered", 268 "Subsystem": "Cluster", 269 "Timestamp": "2019-08-26T12:22:50+02:00" 270 } 271 ], 272 "HTTPAddr": "127.0.0.1:4646", 273 "HostVolumes": { 274 "certificates": { 275 "Name": "certificates", 276 "Path": "/etc/ssl/certs", 277 "ReadOnly": true 278 }, 279 "prod-mysql-a": { 280 "Name": "prod-mysql-a", 281 "Path": "/data/mysql", 282 "ReadOnly": false 283 } 284 }, 285 "ID": "1ac61e33-a465-2ace-f63f-cffa1285e7eb", 286 "Links": { 287 "consul": "dc1.mew" 288 }, 289 "Meta": { 290 "connect.log_level": "info", 291 "connect.sidecar_image": "envoyproxy/envoy:v1.11.1" 292 }, 293 "ModifyIndex": 9, 294 "Name": "mew", 295 "NodeClass": "", 296 "NodeResources": { 297 "Cpu": { 298 "CpuShares": 32000 299 }, 300 "Devices": [ 301 { 302 "Attributes": { 303 "attrB": { 304 "Float": 10.5, 305 "Unit": "MW" 306 }, 307 "attrA": { 308 "Int": 1024, 309 "Unit": "MB" 310 } 311 }, 312 "Instances": [ 313 { 314 "HealthDescription": "", 315 "Healthy": true, 316 "ID": "6a61929e-d572-092d-5921-156a913f8e56", 317 "Locality": { 318 "PciBusID": "77cda534-0660-2688-6c2e-ad6c62fc5ff3" 319 } 320 } 321 ], 322 "Name": "modelA", 323 "Type": "skeleton", 324 "Vendor": "hashicorp" 325 }, 326 { 327 "Attributes": { 328 "attrB": { 329 "Float": 10.5, 330 "Unit": "MW" 331 }, 332 "attrA": { 333 "Int": 1024, 334 "Unit": "MB" 335 } 336 }, 337 "Instances": [ 338 { 339 "HealthDescription": "", 340 "Healthy": true, 341 "ID": "73af5d3e-00f9-0786-9bc1-8f5ffa953f15", 342 "Locality": { 343 "PciBusID": "dbda64d1-ad25-6c7c-d3fb-798bae0581bf" 344 } 345 } 346 ], 347 "Name": "modelB", 348 "Type": "skeleton", 349 "Vendor": "hashicorp" 350 } 351 ], 352 "Disk": { 353 "DiskMB": 7890 354 }, 355 "Memory": { 356 "MemoryMB": 15803 357 }, 358 "Networks": [ 359 { 360 "CIDR": "127.0.0.1/32", 361 "Device": "lo", 362 "DynamicPorts": null, 363 "IP": "127.0.0.1", 364 "MBits": 1000, 365 "Mode": "", 366 "ReservedPorts": null 367 }, 368 { 369 "CIDR": "::1/128", 370 "Device": "lo", 371 "DynamicPorts": null, 372 "IP": "::1", 373 "MBits": 1000, 374 "Mode": "", 375 "ReservedPorts": null 376 } 377 ], 378 "NodeNetworks": [ 379 { 380 "Addresses": [ 381 { 382 "Address": "127.0.0.1", 383 "Alias": "default", 384 "Family": "ipv4", 385 "Gateway": "", 386 "ReservedPorts": "" 387 } 388 ], 389 "Device": "lo", 390 "MacAddress": "00:00:00:00:00:00", 391 "Mode": "host" 392 } 393 ] 394 }, 395 "Reserved": { 396 "CPU": 0, 397 "Devices": null, 398 "DiskMB": 0, 399 "IOPS": 0, 400 "MemoryMB": 0, 401 "Networks": null 402 }, 403 "ReservedResources": { 404 "Cpu": { 405 "CpuShares": 0 406 }, 407 "Disk": { 408 "DiskMB": 0 409 }, 410 "Memory": { 411 "MemoryMB": 0 412 }, 413 "Networks": { 414 "ReservedHostPorts": "" 415 } 416 }, 417 "Resources": { 418 "CPU": 32000, 419 "Devices": null, 420 "DiskMB": 7890, 421 "IOPS": 0, 422 "MemoryMB": 15803, 423 "Networks": [ 424 { 425 "CIDR": "127.0.0.1/32", 426 "Device": "lo", 427 "DynamicPorts": null, 428 "IP": "127.0.0.1", 429 "MBits": 1000, 430 "Mode": "", 431 "ReservedPorts": null 432 }, 433 { 434 "CIDR": "::1/128", 435 "Device": "lo", 436 "DynamicPorts": null, 437 "IP": "::1", 438 "MBits": 1000, 439 "Mode": "", 440 "ReservedPorts": null 441 } 442 ] 443 }, 444 "SchedulingEligibility": "eligible", 445 "SecretID": "", 446 "Status": "ready", 447 "StatusDescription": "", 448 "StatusUpdatedAt": 1566814982, 449 "TLSEnabled": false 450 } 451 ``` 452 453 ## List Node Allocations 454 455 This endpoint lists all of the allocations for the given node. This can be used to 456 determine what allocations have been scheduled on the node, their current status, 457 and the values of dynamically assigned resources, like ports. 458 459 | Method | Path | Produces | 460 | ------ | ------------------------------- | ------------------ | 461 | `GET` | `/v1/node/:node_id/allocations` | `application/json` | 462 463 The table below shows this endpoint's support for 464 [blocking queries](/api-docs#blocking-queries) and 465 [required ACLs](/api-docs#acls). 466 467 | Blocking Queries | ACL Required | 468 | ---------------- | ------------------------------ | 469 | `YES` | `node:read,namespace:read-job` | 470 471 ### Parameters 472 473 - `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must 474 be the full UUID, not the short 8-character one. This is specified as part of 475 the path. 476 477 ### Sample Request 478 479 ```shell-session 480 $ curl \ 481 http://localhost:4646/v1/node/e02b6169-83bd-9df6-69bd-832765f333eb/allocations 482 ``` 483 484 ### Sample Response 485 486 ```json 487 [ 488 { 489 "AllocModifyIndex": 2555, 490 "ClientDescription": "", 491 "ClientStatus": "running", 492 "CreateIndex": 2555, 493 "CreateTime": 1523490066575461000, 494 "DeploymentID": "", 495 "DeploymentStatus": { 496 "Healthy": true, 497 "ModifyIndex": 0 498 }, 499 "DesiredDescription": "", 500 "DesiredStatus": "run", 501 "DesiredTransition": { 502 "Migrate": null 503 }, 504 "EvalID": "5129bc74-9785-c39a-08da-bddc8aa778b1", 505 "FollowupEvalID": "", 506 "ID": "fefe81d0-08b2-4eca-fae6-6560cde46d31", 507 "Job": { 508 "AllAtOnce": false, 509 "Constraints": null, 510 "CreateIndex": 2553, 511 "Datacenters": ["dc1"], 512 "ID": "webapp", 513 "JobModifyIndex": 2553, 514 "Meta": null, 515 "ModifyIndex": 2554, 516 "Name": "webapp", 517 "Namespace": "default", 518 "ParameterizedJob": null, 519 "ParentID": "", 520 "Payload": null, 521 "Periodic": null, 522 "Priority": 50, 523 "Region": "global", 524 "Stable": false, 525 "Status": "pending", 526 "StatusDescription": "", 527 "Stop": false, 528 "SubmitTime": 1523490066563405000, 529 "TaskGroups": [ 530 { 531 "Constraints": null, 532 "Count": 9, 533 "EphemeralDisk": { 534 "Migrate": false, 535 "SizeMB": 300, 536 "Sticky": false 537 }, 538 "Meta": null, 539 "Migrate": { 540 "HealthCheck": "checks", 541 "HealthyDeadline": 300000000000, 542 "MaxParallel": 2, 543 "MinHealthyTime": 15000000000 544 }, 545 "Name": "webapp", 546 "ReschedulePolicy": { 547 "Attempts": 0, 548 "Delay": 30000000000, 549 "DelayFunction": "exponential", 550 "Interval": 0, 551 "MaxDelay": 3600000000000, 552 "Unlimited": true 553 }, 554 "RestartPolicy": { 555 "Attempts": 2, 556 "Delay": 15000000000, 557 "Interval": 1800000000000, 558 "Mode": "fail" 559 }, 560 "Tasks": [ 561 { 562 "Artifacts": null, 563 "Config": { 564 "args": ["-text", "ok4"], 565 "image": "hashicorp/http-echo:0.2.3", 566 "port_map": [ 567 { 568 "http": 5678 569 } 570 ] 571 }, 572 "Constraints": null, 573 "DispatchPayload": null, 574 "Driver": "docker", 575 "Env": null, 576 "KillSignal": "", 577 "KillTimeout": 5000000000, 578 "Leader": false, 579 "LogConfig": { 580 "MaxFileSizeMB": 10, 581 "MaxFiles": 10 582 }, 583 "Meta": null, 584 "Name": "webapp", 585 "Resources": { 586 "CPU": 100, 587 "DiskMB": 0, 588 "MemoryMB": 300, 589 "Networks": [ 590 { 591 "CIDR": "", 592 "Device": "", 593 "DynamicPorts": [ 594 { 595 "Label": "http", 596 "Value": 0 597 } 598 ], 599 "IP": "", 600 "MBits": 10, 601 "ReservedPorts": null 602 } 603 ] 604 }, 605 "Services": [ 606 { 607 "AddressMode": "auto", 608 "Checks": [ 609 { 610 "AddressMode": "", 611 "Args": null, 612 "CheckRestart": null, 613 "Command": "", 614 "Header": null, 615 "InitialStatus": "", 616 "Interval": 10000000000, 617 "Method": "", 618 "Name": "http-ok", 619 "Path": "/", 620 "PortLabel": "", 621 "Protocol": "", 622 "TLSSkipVerify": false, 623 "Timeout": 2000000000, 624 "Type": "http" 625 } 626 ], 627 "Name": "webapp", 628 "PortLabel": "http", 629 "Tags": null 630 } 631 ], 632 "ShutdownDelay": 0, 633 "Templates": null, 634 "User": "", 635 "Vault": null 636 } 637 ], 638 "Update": null 639 } 640 ], 641 "Type": "service", 642 "Update": { 643 "AutoRevert": false, 644 "Canary": 0, 645 "HealthCheck": "", 646 "HealthyDeadline": 0, 647 "MaxParallel": 0, 648 "MinHealthyTime": 0, 649 "Stagger": 0 650 }, 651 "VaultToken": "", 652 "Version": 0 653 }, 654 "JobID": "webapp", 655 "Metrics": { 656 "AllocationTime": 63337, 657 "ClassExhausted": null, 658 "ClassFiltered": null, 659 "CoalescedFailures": 0, 660 "ConstraintFiltered": null, 661 "DimensionExhausted": null, 662 "NodesAvailable": { 663 "dc1": 2 664 }, 665 "NodesEvaluated": 2, 666 "NodesExhausted": 0, 667 "NodesFiltered": 0, 668 "QuotaExhausted": null, 669 "Scores": { 670 "46f1c6c4-a0e5-21f6-fd5c-d76c3d84e806.binpack": 2.6950883117541586, 671 "f7476465-4d6e-c0de-26d0-e383c49be941.binpack": 2.6950883117541586 672 } 673 }, 674 "ModifyIndex": 2567, 675 "ModifyTime": 1523490089807324000, 676 "Name": "webapp.webapp[0]", 677 "Namespace": "default", 678 "NextAllocation": "", 679 "NodeID": "f7476465-4d6e-c0de-26d0-e383c49be941", 680 "PreviousAllocation": "", 681 "RescheduleTracker": null, 682 "Resources": { 683 "CPU": 100, 684 "DiskMB": 300, 685 "MemoryMB": 300, 686 "Networks": [ 687 { 688 "CIDR": "", 689 "Device": "eth0", 690 "DynamicPorts": [ 691 { 692 "Label": "http", 693 "Value": 25920 694 } 695 ], 696 "IP": "10.138.0.5", 697 "MBits": 10, 698 "ReservedPorts": null 699 } 700 ] 701 }, 702 "SharedResources": { 703 "CPU": 0, 704 "DiskMB": 300, 705 "MemoryMB": 0, 706 "Networks": null 707 }, 708 "TaskGroup": "webapp", 709 "TaskResources": { 710 "webapp": { 711 "CPU": 100, 712 "DiskMB": 0, 713 "MemoryMB": 300, 714 "Networks": [ 715 { 716 "CIDR": "", 717 "Device": "eth0", 718 "DynamicPorts": [ 719 { 720 "Label": "http", 721 "Value": 25920 722 } 723 ], 724 "IP": "10.138.0.5", 725 "MBits": 10, 726 "ReservedPorts": null 727 } 728 ] 729 } 730 }, 731 "TaskStates": { 732 "webapp": { 733 "Events": [ 734 { 735 "Details": {}, 736 "DiskLimit": 0, 737 "DisplayMessage": "Task received by client", 738 "DownloadError": "", 739 "DriverError": "", 740 "DriverMessage": "", 741 "ExitCode": 0, 742 "FailedSibling": "", 743 "FailsTask": false, 744 "GenericSource": "", 745 "KillError": "", 746 "KillReason": "", 747 "KillTimeout": 0, 748 "Message": "", 749 "RestartReason": "", 750 "SetupError": "", 751 "Signal": 0, 752 "StartDelay": 0, 753 "TaskSignal": "", 754 "TaskSignalReason": "", 755 "Time": 1523490066712543500, 756 "Type": "Received", 757 "ValidationError": "", 758 "VaultError": "" 759 }, 760 { 761 "Details": { 762 "message": "Building Task Directory" 763 }, 764 "DiskLimit": 0, 765 "DisplayMessage": "Building Task Directory", 766 "DownloadError": "", 767 "DriverError": "", 768 "DriverMessage": "", 769 "ExitCode": 0, 770 "FailedSibling": "", 771 "FailsTask": false, 772 "GenericSource": "", 773 "KillError": "", 774 "KillReason": "", 775 "KillTimeout": 0, 776 "Message": "Building Task Directory", 777 "RestartReason": "", 778 "SetupError": "", 779 "Signal": 0, 780 "StartDelay": 0, 781 "TaskSignal": "", 782 "TaskSignalReason": "", 783 "Time": 1523490066715208000, 784 "Type": "Task Setup", 785 "ValidationError": "", 786 "VaultError": "" 787 }, 788 { 789 "Details": {}, 790 "DiskLimit": 0, 791 "DisplayMessage": "Task started by client", 792 "DownloadError": "", 793 "DriverError": "", 794 "DriverMessage": "", 795 "ExitCode": 0, 796 "FailedSibling": "", 797 "FailsTask": false, 798 "GenericSource": "", 799 "KillError": "", 800 "KillReason": "", 801 "KillTimeout": 0, 802 "Message": "", 803 "RestartReason": "", 804 "SetupError": "", 805 "Signal": 0, 806 "StartDelay": 0, 807 "TaskSignal": "", 808 "TaskSignalReason": "", 809 "Time": 1523490068433051100, 810 "Type": "Started", 811 "ValidationError": "", 812 "VaultError": "" 813 } 814 ], 815 "Failed": false, 816 "FinishedAt": "0001-01-01T00:00:00Z", 817 "LastRestart": "0001-01-01T00:00:00Z", 818 "Restarts": 0, 819 "StartedAt": "2018-04-11T23:41:08.445128764Z", 820 "State": "running" 821 } 822 } 823 } 824 ] 825 ``` 826 827 ## Create Node Evaluation 828 829 This endpoint creates a new evaluation for the given node. This can be used to 830 force a run of the scheduling logic. 831 832 | Method | Path | Produces | 833 | ------ | ---------------------------- | ------------------ | 834 | `POST` | `/v1/node/:node_id/evaluate` | `application/json` | 835 836 The table below shows this endpoint's support for 837 [blocking queries](/api-docs#blocking-queries) and 838 [required ACLs](/api-docs#acls). 839 840 | Blocking Queries | ACL Required | 841 | ---------------- | ------------ | 842 | `NO` | `node:write` | 843 844 ### Parameters 845 846 - `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must 847 be the full UUID, not the short 8-character one. This is specified as part of 848 the path. 849 850 ### Sample Request 851 852 ```shell-session 853 $ curl \ 854 http://localhost:4646/v1/node/fb2170a8-257d-3c64-b14d-bc06cc94e34c/evaluate 855 ``` 856 857 ### Sample Response 858 859 ```json 860 { 861 "EvalCreateIndex": 3671, 862 "EvalIDs": ["4dfc2db7-b481-c53b-3072-14479aa44be3"], 863 "HeartbeatTTL": 0, 864 "Index": 3671, 865 "KnownLeader": false, 866 "LastContact": 0, 867 "LeaderRPCAddr": "10.138.0.2:4647", 868 "NodeModifyIndex": 0, 869 "NumNodes": 3, 870 "Servers": [ 871 { 872 "Datacenter": "dc1", 873 "RPCAdvertiseAddr": "10.138.0.2:4647", 874 "RPCMajorVersion": 1, 875 "RPCMinorVersion": 1 876 }, 877 { 878 "Datacenter": "dc1", 879 "RPCAdvertiseAddr": "10.138.0.3:4647", 880 "RPCMajorVersion": 1, 881 "RPCMinorVersion": 1 882 }, 883 { 884 "Datacenter": "dc1", 885 "RPCAdvertiseAddr": "10.138.0.4:4647", 886 "RPCMajorVersion": 1, 887 "RPCMinorVersion": 1 888 } 889 ] 890 } 891 ``` 892 893 ## Drain Node 894 895 This endpoint toggles the drain mode of the node. When draining is enabled, no 896 further allocations will be assigned to this node, and existing allocations will 897 be migrated to new nodes. See the [Workload Migration 898 Guide](https://learn.hashicorp.com/tutorials/nomad/node-drain) for suggested usage. 899 900 | Method | Path | Produces | 901 | ------ | ------------------------- | ------------------ | 902 | `POST` | `/v1/node/:node_id/drain` | `application/json` | 903 904 The table below shows this endpoint's support for 905 [blocking queries](/api-docs#blocking-queries) and 906 [required ACLs](/api-docs#acls). 907 908 | Blocking Queries | ACL Required | 909 | ---------------- | ------------ | 910 | `NO` | `node:write` | 911 912 ### Parameters 913 914 - `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must 915 be the full UUID, not the short 8-character one. This is specified as part of 916 the path. 917 918 - `DrainSpec` `(object: <optional>)` - Specifies if drain mode should be 919 enabled. A missing or null value disables an existing drain. 920 921 - `Deadline` `(int: <required>)` - Specifies how long to wait in nanoseconds 922 for allocations to finish migrating before they are force stopped. This is 923 also how long batch jobs are given to complete before being migrated. 924 925 - `IgnoreSystemJobs` `(bool: false)` - Specifies whether or not to stop system 926 jobs as part of a drain. By default system jobs will be stopped after all 927 other allocations have migrated or the deadline is reached. Setting this to 928 `true` means system jobs are always left running. 929 930 - `MarkEligible` `(bool: false)` - Specifies whether to mark a node as eligible 931 for scheduling again when _disabling_ a drain. 932 933 ### Sample Payload 934 935 ```json 936 { 937 "DrainSpec": { 938 "Deadline": 3600000000000, 939 "IgnoreSystemJobs": true 940 } 941 } 942 ``` 943 944 ### Sample Request 945 946 ```shell-session 947 $ curl \ 948 -XPOST \ 949 --data @drain.json \ 950 http://localhost:4646/v1/node/fb2170a8-257d-3c64-b14d-bc06cc94e34c/drain 951 ``` 952 953 ### Sample Response 954 955 ```json 956 { 957 "EvalCreateIndex": 0, 958 "EvalIDs": null, 959 "Index": 3742, 960 "NodeModifyIndex": 3742 961 } 962 ``` 963 964 ## Purge Node 965 966 This endpoint purges a node from the system. Nodes can still join the cluster if 967 they are alive. 968 969 | Method | Path | Produces | 970 | ------ | ------------------------- | ------------------ | 971 | `POST` | `/v1/node/:node_id/purge` | `application/json` | 972 973 The table below shows this endpoint's support for 974 [blocking queries](/api-docs#blocking-queries) and 975 [required ACLs](/api-docs#acls). 976 977 | Blocking Queries | ACL Required | 978 | ---------------- | ------------ | 979 | `NO` | `node:write` | 980 981 ### Parameters 982 983 - `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must 984 be the full UUID, not the short 8-character one. This is specified as part of 985 the path. 986 987 ### Sample Request 988 989 ```shell-session 990 $ curl \ 991 -XPOST http://localhost:4646/v1/node/f7476465-4d6e-c0de-26d0-e383c49be941/purge 992 ``` 993 994 ### Sample Response 995 996 ```json 997 { 998 "EvalCreateIndex": 3817, 999 "EvalIDs": ["71bad787-5ab1-9939-be02-4809441583cd"], 1000 "HeartbeatTTL": 0, 1001 "Index": 3816, 1002 "KnownLeader": false, 1003 "LastContact": 0, 1004 "LeaderRPCAddr": "", 1005 "NodeModifyIndex": 3816, 1006 "NumNodes": 0, 1007 "Servers": null 1008 } 1009 ``` 1010 1011 ## Toggle Node Eligibility 1012 1013 This endpoint toggles the scheduling eligibility of the node. 1014 1015 | Method | Path | Produces | 1016 | ------ | ------------------------------- | ------------------ | 1017 | `POST` | `/v1/node/:node_id/eligibility` | `application/json` | 1018 1019 The table below shows this endpoint's support for 1020 [blocking queries](/api-docs#blocking-queries) and 1021 [required ACLs](/api-docs#acls). 1022 1023 | Blocking Queries | ACL Required | 1024 | ---------------- | ------------ | 1025 | `NO` | `node:write` | 1026 1027 ### Parameters 1028 1029 - `:node_id` `(string: <required>)`- Specifies the UUID of the node. This must 1030 be the full UUID, not the short 8-character one. This is specified as part of 1031 the path. 1032 1033 - `Eligibility` `(string: <required>)` - Either `eligible` or `ineligible`. 1034 1035 ### Sample Payload 1036 1037 ```json 1038 { 1039 "Eligibility": "ineligible" 1040 } 1041 ``` 1042 1043 ### Sample Request 1044 1045 ```shell-session 1046 $ curl \ 1047 -XPOST \ 1048 --data @eligibility.json \ 1049 http://localhost:4646/v1/node/fb2170a8-257d-3c64-b14d-bc06cc94e34c/eligibility 1050 ``` 1051 1052 ### Sample Response 1053 1054 ```json 1055 { 1056 "EvalCreateIndex": 0, 1057 "EvalIDs": null, 1058 "Index": 3742, 1059 "NodeModifyIndex": 3742 1060 } 1061 ``` 1062 1063 #### Field Reference 1064 1065 - Events - A list of the last 10 node events for this node. A node event is a 1066 high level concept of noteworthy events for a node. 1067 1068 Each node event has the following fields: 1069 1070 - `Message` - The specific message for the event, detailing what occurred. 1071 1072 - `Subsystem` - The subsystem where the node event took place. Subsystems 1073 include: 1074 1075 - `Drain` - The Nomad server draining subsystem. 1076 1077 - `Driver` - The Nomad client driver subsystem. 1078 1079 - `Heartbeat` - Either Nomad client or server heartbeating subsystem. 1080 1081 - `Cluster` - Nomad server cluster management subsystem. 1082 1083 - `Details` - Any further details about the event, formatted as a key/value 1084 pair. 1085 1086 - `Timestamp` - Each node event has an ISO 8601 timestamp. 1087 1088 - `CreateIndex` - The Raft index at which the event was committed.