github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/api-docs/nodes.mdx (about)

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