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

     1  ---
     2  layout: api
     3  page_title: Agent - HTTP API
     4  description: |-
     5    The /agent endpoints interact with the local Nomad agent to interact with
     6    members and servers.
     7  ---
     8  
     9  # Agent HTTP API
    10  
    11  The `/agent` endpoints are used to interact with the local Nomad agent.
    12  
    13  ## List Members
    14  
    15  This endpoint queries the agent for the known peers in the gossip pool. This
    16  endpoint is only applicable to servers. Due to the nature of gossip, this is
    17  eventually consistent.
    18  
    19  | Method | Path             | Produces           |
    20  | ------ | ---------------- | ------------------ |
    21  | `GET`  | `/agent/members` | `application/json` |
    22  
    23  The table below shows this endpoint's support for
    24  [blocking queries](/api-docs#blocking-queries) and
    25  [required ACLs](/api-docs#acls).
    26  
    27  | Blocking Queries | ACL Required |
    28  | ---------------- | ------------ |
    29  | `NO`             | `node:read`  |
    30  
    31  ### Sample Request
    32  
    33  ```shell-session
    34  $ curl \
    35      https://localhost:4646/v1/agent/members
    36  ```
    37  
    38  ### Sample Response
    39  
    40  ```json
    41  {
    42    "ServerName": "bacon-mac",
    43    "ServerRegion": "global",
    44    "ServerDC": "dc1",
    45    "Members": [
    46      {
    47        "Name": "bacon-mac.global",
    48        "Addr": "127.0.0.1",
    49        "Port": 4648,
    50        "Tags": {
    51          "mvn": "1",
    52          "build": "0.5.5dev",
    53          "port": "4647",
    54          "bootstrap": "1",
    55          "role": "nomad",
    56          "region": "global",
    57          "dc": "dc1",
    58          "vsn": "1"
    59        },
    60        "Status": "alive",
    61        "ProtocolMin": 1,
    62        "ProtocolMax": 5,
    63        "ProtocolCur": 2,
    64        "DelegateMin": 2,
    65        "DelegateMax": 4,
    66        "DelegateCur": 4
    67      }
    68    ]
    69  }
    70  ```
    71  
    72  ## List Servers
    73  
    74  This endpoint lists the known server nodes. The `servers` endpoint is used to
    75  query an agent in client mode for its list of known servers. Client nodes
    76  register themselves with these server addresses so that they may dequeue work.
    77  The servers endpoint can be used to keep this configuration up to date if there
    78  are changes in the cluster.
    79  
    80  | Method | Path             | Produces           |
    81  | ------ | ---------------- | ------------------ |
    82  | `GET`  | `/agent/servers` | `application/json` |
    83  
    84  The table below shows this endpoint's support for
    85  [blocking queries](/api-docs#blocking-queries) and
    86  [required ACLs](/api-docs#acls).
    87  
    88  | Blocking Queries | ACL Required |
    89  | ---------------- | ------------ |
    90  | `NO`             | `agent:read` |
    91  
    92  ### Sample Request
    93  
    94  ```shell-session
    95  $ curl \
    96      https://localhost:4646/v1/agent/servers
    97  ```
    98  
    99  ### Sample Response
   100  
   101  ```json
   102  ["127.0.0.1:4647"]
   103  ```
   104  
   105  ## Update Servers
   106  
   107  This endpoint updates the list of known servers to the provided list. This
   108  **replaces** all previous server addresses with the new list.
   109  
   110  | Method | Path             | Produces       |
   111  | ------ | ---------------- | -------------- |
   112  | `POST` | `/agent/servers` | `(empty body)` |
   113  
   114  The table below shows this endpoint's support for
   115  [blocking queries](/api-docs#blocking-queries) and
   116  [required ACLs](/api-docs#acls).
   117  
   118  | Blocking Queries | ACL Required  |
   119  | ---------------- | ------------- |
   120  | `NO`             | `agent:write` |
   121  
   122  ### Parameters
   123  
   124  - `address` `(string: <required>)` - Specifies the list of addresses in the
   125    format `ip:port`. This is specified as a query string.
   126  
   127  ### Sample Request
   128  
   129  ```shell-session
   130  $ curl \
   131      --request POST \
   132      https://localhost:4646/v1/agent/servers?address=1.2.3.4:4647&address=5.6.7.8:4647
   133  ```
   134  
   135  ## Query Self
   136  
   137  This endpoint queries the state of the target agent (self).
   138  
   139  | Method | Path          | Produces           |
   140  | ------ | ------------- | ------------------ |
   141  | `GET`  | `/agent/self` | `application/json` |
   142  
   143  The table below shows this endpoint's support for
   144  [blocking queries](/api-docs#blocking-queries) and
   145  [required ACLs](/api-docs#acls).
   146  
   147  | Blocking Queries | ACL Required |
   148  | ---------------- | ------------ |
   149  | `NO`             | `agent:read` |
   150  
   151  ### Sample Request
   152  
   153  ```shell-session
   154  $ curl \
   155      https://localhost:4646/v1/agent/self
   156  ```
   157  
   158  ### Sample Response
   159  
   160  ```json
   161  {
   162    "config": {
   163      "Addresses": {
   164        "HTTP": "127.0.0.1",
   165        "RPC": "127.0.0.1",
   166        "Serf": "127.0.0.1"
   167      },
   168      "AdvertiseAddrs": {
   169        "HTTP": "127.0.0.1:4646",
   170        "RPC": "127.0.0.1:4647",
   171        "Serf": "127.0.0.1:4648"
   172      },
   173      "BindAddr": "127.0.0.1",
   174      "Client": {
   175        "AllocDir": "",
   176        "ChrootEnv": {},
   177        "ClientMaxPort": 14512,
   178        "ClientMinPort": 14000,
   179        "DisableRemoteExec": false,
   180        "Enabled": true,
   181        "GCDiskUsageThreshold": 99,
   182        "GCInodeUsageThreshold": 99,
   183        "GCInterval": 600000000000,
   184        "MaxKillTimeout": "30s",
   185        "Meta": {},
   186        "NetworkInterface": "lo0",
   187        "NetworkSpeed": 0,
   188        "NodeClass": "",
   189        "Options": {
   190          "driver.docker.volumes": "true"
   191        },
   192        "Reserved": {
   193          "CPU": 0,
   194          "DiskMB": 0,
   195          "MemoryMB": 0,
   196          "ParsedReservedPorts": null,
   197          "ReservedPorts": ""
   198        },
   199        "Servers": null,
   200        "StateDir": ""
   201      },
   202      "Consul": {
   203        "Addr": "",
   204        "Auth": "",
   205        "AutoAdvertise": true,
   206        "CAFile": "",
   207        "CertFile": "",
   208        "ChecksUseAdvertise": false,
   209        "ClientAutoJoin": true,
   210        "ClientServiceName": "nomad-client",
   211        "EnableSSL": false,
   212        "KeyFile": "",
   213        "ServerAutoJoin": true,
   214        "ServerServiceName": "nomad",
   215        "Timeout": 5000000000,
   216        "Token": "",
   217        "VerifySSL": false
   218      },
   219      "DataDir": "",
   220      "Datacenter": "dc1",
   221      "DevMode": true,
   222      "DisableAnonymousSignature": true,
   223      "DisableUpdateCheck": false,
   224      "EnableDebug": true,
   225      "EnableSyslog": false,
   226      "Files": null,
   227      "HTTPAPIResponseHeaders": {},
   228      "LeaveOnInt": false,
   229      "LeaveOnTerm": false,
   230      "LogLevel": "DEBUG",
   231      "NodeName": "",
   232      "Ports": {
   233        "HTTP": 4646,
   234        "RPC": 4647,
   235        "Serf": 4648
   236      },
   237      "Region": "global",
   238      "Revision": "f551dcb83e3ac144c9dbb90583b6e82d234662e9",
   239      "Server": {
   240        "BootstrapExpect": 0,
   241        "DataDir": "",
   242        "Enabled": true,
   243        "EnabledSchedulers": null,
   244        "HeartbeatGrace": "",
   245        "NodeGCThreshold": "",
   246        "NumSchedulers": 0,
   247        "ProtocolVersion": 0,
   248        "RejoinAfterLeave": false,
   249        "RetryInterval": "30s",
   250        "RetryJoin": [],
   251        "RetryMaxAttempts": 0,
   252        "StartJoin": []
   253      },
   254      "SyslogFacility": "LOCAL0",
   255      "TLSConfig": {
   256        "CAFile": "",
   257        "CertFile": "",
   258        "EnableHTTP": false,
   259        "EnableRPC": false,
   260        "KeyFile": "",
   261        "VerifyServerHostname": false
   262      },
   263      "Telemetry": {
   264        "CirconusAPIApp": "",
   265        "CirconusAPIToken": "",
   266        "CirconusAPIURL": "",
   267        "CirconusBrokerID": "",
   268        "CirconusBrokerSelectTag": "",
   269        "CirconusCheckDisplayName": "",
   270        "CirconusCheckForceMetricActivation": "",
   271        "CirconusCheckID": "",
   272        "CirconusCheckInstanceID": "",
   273        "CirconusCheckSearchTag": "",
   274        "CirconusCheckSubmissionURL": "",
   275        "CirconusCheckTags": "",
   276        "CirconusSubmissionInterval": "",
   277        "CollectionInterval": "1s",
   278        "DataDogAddr": "",
   279        "DataDogTags": [],
   280        "DisableHostname": false,
   281        "PublishAllocationMetrics": false,
   282        "PublishNodeMetrics": false,
   283        "StatsdAddr": "",
   284        "StatsiteAddr": "",
   285        "UseNodeName": false
   286      },
   287      "Vault": {
   288        "Addr": "https://vault.service.consul:8200",
   289        "AllowUnauthenticated": true,
   290        "ConnectionRetryIntv": 30000000000,
   291        "Enabled": null,
   292        "Role": "",
   293        "TLSCaFile": "",
   294        "TLSCaPath": "",
   295        "TLSCertFile": "",
   296        "TLSKeyFile": "",
   297        "TLSServerName": "",
   298        "TLSSkipVerify": null,
   299        "TaskTokenTTL": "",
   300        "Token": "root"
   301      },
   302      "Version": "0.5.5",
   303      "VersionPrerelease": "dev"
   304    },
   305    "member": {
   306      "Addr": "127.0.0.1",
   307      "DelegateCur": 4,
   308      "DelegateMax": 4,
   309      "DelegateMin": 2,
   310      "Name": "bacon-mac.global",
   311      "Port": 4648,
   312      "ProtocolCur": 2,
   313      "ProtocolMax": 5,
   314      "ProtocolMin": 1,
   315      "Status": "alive",
   316      "Tags": {
   317        "role": "nomad",
   318        "region": "global",
   319        "dc": "dc1",
   320        "vsn": "1",
   321        "mvn": "1",
   322        "build": "0.5.5dev",
   323        "port": "4647",
   324        "bootstrap": "1"
   325      }
   326    },
   327    "stats": {
   328      "runtime": {
   329        "cpu_count": "8",
   330        "kernel.name": "darwin",
   331        "arch": "amd64",
   332        "version": "go1.8",
   333        "max_procs": "7",
   334        "goroutines": "79"
   335      },
   336      "nomad": {
   337        "server": "true",
   338        "leader": "true",
   339        "leader_addr": "127.0.0.1:4647",
   340        "bootstrap": "false",
   341        "known_regions": "1"
   342      },
   343      "raft": {
   344        "num_peers": "0",
   345        "fsm_pending": "0",
   346        "last_snapshot_index": "0",
   347        "last_log_term": "2",
   348        "commit_index": "144",
   349        "term": "2",
   350        "last_log_index": "144",
   351        "snapshot_version_max": "1",
   352        "latest_configuration_index": "1",
   353        "latest_configuration": "[{Suffrage:Voter ID:127.0.0.1:4647 Address:127.0.0.1:4647}]",
   354        "last_contact": "never",
   355        "applied_index": "144",
   356        "state": "Leader",
   357        "last_snapshot_term": "0"
   358      },
   359      "client": {
   360        "heartbeat_ttl": "17.79568937s",
   361        "node_id": "fb2170a8-257d-3c64-b14d-bc06cc94e34c",
   362        "known_servers": "127.0.0.1:4647",
   363        "num_allocations": "0",
   364        "last_heartbeat": "10.107423052s"
   365      },
   366      "serf": {
   367        "event_time": "1",
   368        "event_queue": "0",
   369        "encrypted": "false",
   370        "member_time": "1",
   371        "query_time": "1",
   372        "intent_queue": "0",
   373        "query_queue": "0",
   374        "members": "1",
   375        "failed": "0",
   376        "left": "0",
   377        "health_score": "0"
   378      }
   379    }
   380  }
   381  ```
   382  
   383  ## Join Agent
   384  
   385  This endpoint introduces a new member to the gossip pool. This endpoint is only
   386  eligible for servers.
   387  
   388  | Method | Path          | Produces           |
   389  | ------ | ------------- | ------------------ |
   390  | `POST` | `/agent/join` | `application/json` |
   391  
   392  The table below shows this endpoint's support for
   393  [blocking queries](/api-docs#blocking-queries) and
   394  [required ACLs](/api-docs#acls).
   395  
   396  | Blocking Queries | ACL Required |
   397  | ---------------- | ------------ |
   398  | `NO`             | `none`       |
   399  
   400  ### Parameters
   401  
   402  - `address` `(string: <required>)` - Specifies the address to join in the
   403    `ip:port` format. This is provided as a query parameter and may be specified
   404    multiple times to join multiple servers.
   405  
   406  ### Sample Request
   407  
   408  ```shell-session
   409  $ curl \
   410      --request POST \
   411      https://localhost:4646/v1/agent/join?address=1.2.3.4&address=5.6.7.8
   412  ```
   413  
   414  ### Sample Response
   415  
   416  ```json
   417  {
   418    "error": "",
   419    "num_joined": 2
   420  }
   421  ```
   422  
   423  ## Force Leave Agent
   424  
   425  This endpoint forces a member of the gossip pool from the `"failed"` state to
   426  the `"left"` state. This allows the consensus protocol to remove the peer and
   427  stop attempting replication. This is only applicable for servers.
   428  
   429  | Method | Path                 | Produces           |
   430  | ------ | -------------------- | ------------------ |
   431  | `POST` | `/agent/force-leave` | `application/json` |
   432  
   433  The table below shows this endpoint's support for
   434  [blocking queries](/api-docs#blocking-queries) and
   435  [required ACLs](/api-docs#acls).
   436  
   437  | Blocking Queries | ACL Required  |
   438  | ---------------- | ------------- |
   439  | `NO`             | `agent:write` |
   440  
   441  ### Parameters
   442  
   443  - `node` `(string: <required>)` - Specifies the name of the node to force leave.
   444  
   445  ### Sample Request
   446  
   447  ```shell-session
   448  $ curl \
   449      --request POST \
   450      https://localhost:4646/v1/agent/force-leave?node=client-ab2e23dc
   451  ```
   452  
   453  ## Health
   454  
   455  This endpoint returns whether or not the agent is healthy. When using Consul it
   456  is the endpoint Nomad will register for its own health checks.
   457  
   458  When the agent is unhealthy 500 will be returned along with JSON response
   459  containing an error message.
   460  
   461  | Method | Path            | Produces           |
   462  | ------ | --------------- | ------------------ |
   463  | `GET`  | `/agent/health` | `application/json` |
   464  
   465  The table below shows this endpoint's support for
   466  [blocking queries](/api-docs#blocking-queries) and
   467  [required ACLs](/api-docs#acls).
   468  
   469  | Blocking Queries | ACL Required |
   470  | ---------------- | ------------ |
   471  | `NO`             | `none`       |
   472  
   473  ### Sample Request
   474  
   475  ```shell-session
   476  $ curl \
   477      https://localhost:4646/v1/agent/health
   478  ```
   479  
   480  ### Sample Response
   481  
   482  ```json
   483  {
   484    "client": {
   485      "message": "ok",
   486      "ok": true
   487    },
   488    "server": {
   489      "message": "ok",
   490      "ok": true
   491    }
   492  }
   493  ```
   494  
   495  ## Host
   496  
   497  This endpoint returns data about the agent's host environment from the
   498  perspective of the agent. It is included in the archive produced by
   499  nomad operator debug. Known sensitive environment variables are shown as
   500  `<redacted>`, but the response may still contain sensitive
   501  information.
   502  
   503  | Method | Path          | Produces           |
   504  | ------ | ------------- | ------------------ |
   505  | `GET`  | `/agent/host` | `application/json` |
   506  
   507  The table below shows this endpoint's support for
   508  [blocking queries](/api-docs#blocking-queries) and
   509  [required ACLs](/api-docs#acls).
   510  
   511  | Blocking Queries | ACL Required |
   512  | ---------------- | ------------ |
   513  | `NO`             | `agent:read` |
   514  
   515  ### Parameters
   516  
   517  - `server_id` `(string: <optional>)` - Specify the server name for
   518    targeting.
   519  
   520  - `node_id` `(string: <optional>)` - Specify the client node id for
   521    targeting.
   522  
   523  ### Sample Request
   524  
   525  ```shell-session
   526  $ curl \
   527      https://localhost:4646/v1/agent/host?node_id=4bb9aca7-d43b-43fc-d604-3a271ef0a6c0
   528  ```
   529  
   530  ### Sample Response
   531  
   532  ```json
   533  {
   534    "AgentID": "4bb9aca7-d43b-43fc-d604-3a271ef0a6c0",
   535    "HostData": {
   536      "OS": "x86_64 ip-172-31-92-147 4.15.0-1007-aws Linux #7-Ubuntu SMP Tue Apr 24 10:56:17 UTC 2018",
   537      "Network": [
   538        {
   539          "DialPacket": "\"udp4\" \"\"",
   540          "DialStream": "\"tcp4\" \"\"",
   541          "ListenPacket": "\"udp4\" \"\"",
   542          "ListenStream": "\"tcp4\" \"\"",
   543          "address": "127.0.0.1",
   544          "binary": "01111111000000000000000000000001",
   545          "broadcast": "127.255.255.255",
   546          "first_usable": "127.0.0.1",
   547          "hex": "7f000001",
   548          "host": "127.0.0.1",
   549          "last_usable": "127.255.255.254",
   550          "mask_bits": "8",
   551          "netmask": "255.0.0.0",
   552          "network": "127.0.0.0",
   553          "octets": "127 0 0 1",
   554          "port": "0",
   555          "size": "16777216",
   556          "string": "127.0.0.1/8",
   557          "type": "IPv4",
   558          "uint32": "2130706433"
   559        }
   560      ],
   561      "ResolvConf": "nameserver 172.17.0.1\nnameserver 8.8.8.8\n",
   562      "Hosts": "127.0.0.1 localhost\n\n# The following lines are desirable for IPv6 capable hosts\n::1 ip6-localhost ip6-loopback\nfe00::0 ip6-localnet\nff00::0 ip6-mcastprefix\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\nff02::3 ip6-allhosts\n127.0.0.1 ip-172-31-71-163\n127.0.0.1 ip-172-31-92-147\n",
   563      "Environment": {
   564        "INVOCATION_ID": "b106b6ac67764c9b9f85c5cc5c3357e5",
   565        "JOURNAL_STREAM": "9:109527",
   566        "LANG": "C.UTF-8",
   567        "PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
   568      },
   569      "Disk": {
   570        "/": {
   571          "DiskMB": 7876,
   572          "UsedMB": 4287
   573        }
   574      }
   575    }
   576  }
   577  ```
   578  
   579  ## Stream Logs
   580  
   581  This endpoint streams logs from the local agent until the connection is closed
   582  
   583  | Method | Path             | Produces           |
   584  | ------ | ---------------- | ------------------ |
   585  | `GET`  | `/agent/monitor` | `application/json` |
   586  
   587  The table below shows this endpoint's support for
   588  [blocking queries](/api-docs#blocking-queries) and
   589  [required ACLs](/api-docs#acls).
   590  
   591  | Blocking Queries | ACL Required |
   592  | ---------------- | ------------ |
   593  | `NO`             | `agent:read` |
   594  
   595  ### Parameters
   596  
   597  - `log_level` `(string: "info")` - Specifies a text string containing a log level
   598    to filter on, such as `info`. Possible values include `trace`, `debug`,
   599    `info`, `warn`, `error`
   600  
   601  - `log_json` `(bool: false)` - Specifies if the log format for streamed logs
   602    should be JSON.
   603  
   604  - `node_id` `(string: "a57b2adb-1a30-2dda-8df0-25abb0881952")` - Specifies a text
   605    string containing a node-id to target for streaming.
   606  
   607  - `server_id` `(string: "server1.global")` - Specifies a text
   608    string containing a server name or "leader" to target a specific remote server
   609    or leader for streaming.
   610  
   611  - `plain` `(bool: false)` - Specifies if the response should be JSON or
   612    plaintext
   613  
   614  ### Sample Request
   615  
   616  ```shell-session
   617  $ curl \
   618      https://localhost:4646/v1/agent/monitor?log_level=debug&server_id=leader
   619  
   620  $ curl \
   621      https://localhost:4646/v1/agent/monitor?log_level=debug&node_id=a57b2adb-1a30-2dda-8df0-25abb0881952
   622  ```
   623  
   624  ### Sample Response
   625  
   626  ```json
   627  {
   628    "Offset": 0,
   629    "Data": "NTMxOTMyCjUzMTkzMwo1MzE5MzQKNTMx..."
   630    "FileEvent": "log"
   631  }
   632  ```
   633  
   634  #### Field Reference
   635  
   636  The return value is a stream of frames. These frames contain the following
   637  fields:
   638  
   639  - `Data` - A base64 encoding of the bytes being streamed.
   640  
   641  - `FileEvent` - An event that could cause a change in the streams position. The
   642    possible value for this endpoint is "log".
   643  
   644  - `Offset` - Offset is the offset into the stream.
   645  
   646  ## Agent Runtime Profiles
   647  
   648  This endpoint is the equivalent of Go's /debug/pprof endpoint but is protected
   649  by ACLs and supports remote forwarding to a client node or server. See the
   650  [Golang documentation](https://golang.org/pkg/runtime/pprof/#Profile) for a list of available profiles.
   651  
   652  | Method | Path                           | Produces                   |
   653  | ------ | ------------------------------ | -------------------------- |
   654  | `GET`  | `/agent/pprof/cmdline`         | `text/plain`               |
   655  | `GET`  | `/agent/pprof/profile`         | `application/octet-stream` |
   656  | `GET`  | `/agent/pprof/trace`           | `application/octet-stream` |
   657  | `GET`  | `/agent/pprof/<pprof profile>` | `application/octet-stream` |
   658  
   659  The table below shows this endpoint's support for
   660  [blocking queries](/api-docs#blocking-queries) and
   661  [required ACLs](/api-docs#acls).
   662  
   663  | Blocking Queries | ACL Required  |
   664  | ---------------- | ------------- |
   665  | `NO`             | `agent:write` |
   666  
   667  ### Default Behavior
   668  
   669  This endpoint is enabled whenever ACLs are enabled. Due to the potentially
   670  sensitive nature of data contained in profiles, as well as their significant
   671  performance impact, the agent/pprof endpoint is protected by a high level ACL:
   672  `agent:write`. For these reasons its recommended to leave [`enable_debug`](/docs/configuration#enable_debug)
   673  unset and only use the ACL-protected endpoints.
   674  
   675  The following table explains when each endpoint is available:
   676  
   677  | Endpoint        | `enable_debug` | ACLs | **Available?** |
   678  | --------------- | -------------- | ---- | -------------- |
   679  | /v1/agent/pprof | unset          | n/a  | no             |
   680  | /v1/agent/pprof | `true`         | n/a  | yes            |
   681  | /v1/agent/pprof | `false`        | n/a  | no             |
   682  | /v1/agent/pprof | unset          | off  | no             |
   683  | /v1/agent/pprof | unset          | on   | **yes**        |
   684  | /v1/agent/pprof | `true`         | off  | yes            |
   685  | /v1/agent/pprof | `false`        | on   | **yes**        |
   686  
   687  ### Parameters
   688  
   689  - `node_id` `(string: "a57b2adb-1a30-2dda-8df0-25abb0881952")` - Specifies a text
   690    string containing a Node ID to target for profiling.
   691  
   692  - `server_id` `(string: "server1.global")` - Specifies a text
   693    string containing a Server ID, name, or `leader` to target a specific remote
   694    server or leader for profiling.
   695  
   696  - `seconds` `(int: 3)` - Specifies the amount of time to run a profile or trace
   697    request for.
   698  
   699  - `debug` `(int: 1)` - Specifies if a given pprof profile should be returned as
   700    human readable plain text instead of the pprof binary format. Defaults to 0,
   701    setting to 1 enables human readable plain text.
   702  
   703  ### Sample Request
   704  
   705  ```shell-session
   706  $ curl -O -J \
   707      --header "X-Nomad-Token: 8176afd3-772d-0b71-8f85-7fa5d903e9d4" \
   708      https://localhost:4646/v1/agent/pprof/goroutine?server_id=leader
   709  
   710  $ go tool pprof goroutine
   711  
   712  $ curl -O -J \
   713      --header "X-Nomad-Token: 8176afd3-772d-0b71-8f85-7fa5d903e9d4" \
   714      https://localhost:4646/v1/agent/profile?seconds=5&node_id=a57b2adb-1a30-2dda-8df0-25abb0881952
   715  
   716  $ go tool pprof profile
   717  
   718  $ curl -O -J \
   719      --header "X-Nomad-Token: 8176afd3-772d-0b71-8f85-7fa5d903e9d4" \
   720      https://localhost:4646/v1/agent/trace?&seconds=5&server_id=server1.global
   721  
   722  go tool trace trace
   723  ```
   724  
   725  ## Fetch all scheduler worker's status
   726  
   727  The `/agent/schedulers` endpoint allow Nomad operators to inspect the state of
   728  a Nomad server agent's scheduler workers.
   729  
   730  | Method | Path                | Produces           |
   731  | ------ | ------------------- | ------------------ |
   732  | `GET`  | `/agent/schedulers` | `application/json` |
   733  
   734  The table below shows this endpoint's support for
   735  [blocking queries](/api-docs#blocking-queries) and
   736  [required ACLs](/api-docs#acls).
   737  
   738  | Blocking Queries | ACL Required |
   739  | ---------------- | ------------ |
   740  | `NO`             | `agent:read` |
   741  
   742  ### Parameters
   743  
   744  This endpoint accepts no additional parameters.
   745  
   746  ### Sample Request
   747  
   748  ```shell-session
   749  $ curl \
   750      https://localhost:4646/v1/agent/schedulers
   751  ```
   752  
   753  ### Sample Response
   754  
   755  ```json
   756  {
   757    "schedulers": [
   758      {
   759        "enabled_schedulers": [
   760          "service",
   761          "batch",
   762          "system",
   763          "sysbatch",
   764          "_core"
   765        ],
   766        "id": "5669d6fa-0def-7369-6558-a47c35fdc675",
   767        "started": "2021-12-21T19:25:00.911883Z",
   768        "status": "Paused",
   769        "workload_status": "Paused"
   770      },
   771      {
   772        "enabled_schedulers": [
   773          "service",
   774          "batch",
   775          "system",
   776          "sysbatch",
   777          "_core"
   778        ],
   779        "id": "c919709d-6d14-66bf-b425-80b8167a267e",
   780        "started": "2021-12-21T19:25:00.91189Z",
   781        "status": "Paused",
   782        "workload_status": "Paused"
   783      },
   784      {
   785        "enabled_schedulers": [
   786          "service",
   787          "batch",
   788          "system",
   789          "sysbatch",
   790          "_core"
   791        ],
   792        "id": "f5edb69a-6122-be8f-b32a-23cd8511dba5",
   793        "started": "2021-12-21T19:25:00.911961Z",
   794        "status": "Paused",
   795        "workload_status": "Paused"
   796      },
   797      {
   798        "enabled_schedulers": [
   799          "service",
   800          "batch",
   801          "system",
   802          "sysbatch",
   803          "_core"
   804        ],
   805        "id": "458816ae-83cf-0710-d8d4-35d2ad2e42d7",
   806        "started": "2021-12-21T19:25:00.912119Z",
   807        "status": "Started",
   808        "workload_status": "WaitingToDequeue"
   809      }
   810    ],
   811    "server_id": "server1.global"
   812  }
   813  
   814  ```
   815  
   816  ## Read scheduler worker configuration
   817  
   818  This endpoint returns data about the agent's scheduler configuration from
   819  the perspective of the agent. This is only applicable for servers.
   820  
   821  | Method | Path                       | Produces           |
   822  | ------ | -------------------------- | ------------------ |
   823  | `GET`  | `/agent/schedulers/config` | `application/json` |
   824  
   825  The table below shows this endpoint's support for
   826  [blocking queries](/api-docs#blocking-queries) and
   827  [required ACLs](/api-docs#acls).
   828  
   829  | Blocking Queries | ACL Required |
   830  | ---------------- | ------------ |
   831  | `NO`             | `agent:read` |
   832  
   833  ### Parameters
   834  
   835  This endpoint accepts no additional parameters.
   836  
   837  ### Sample Request
   838  
   839  ```shell-session
   840  $ curl \
   841      https://localhost:4646/v1/agent/schedulers/config
   842  ```
   843  
   844  ### Sample Response
   845  
   846  ```json
   847  {
   848    "enabled_schedulers": [
   849      "service",
   850      "batch",
   851      "system",
   852      "sysbatch",
   853      "_core"
   854    ],
   855    "num_schedulers": 8,
   856    "server_id": "server1.global"
   857  }
   858  ```
   859  
   860  ## Update scheduler worker configuration
   861  
   862  This allows a Nomad operator to modify the server's running scheduler
   863  configuration, which will remain in effect until another update or until the
   864  node is restarted. For durable changes to this value, set the corresponding
   865  values—[`num_schedulers`][] and [`enabled_schedulers`][]—in the node's
   866  configuration file. The response contains the configuration after attempting
   867  to apply the provided values. This is only applicable for servers.
   868  
   869  | Method | Path                       | Produces           |
   870  | ------ | -------------------------- | ------------------ |
   871  | `PUT`  | `/agent/schedulers/config` | `application/json` |
   872  
   873  The table below shows this endpoint's support for
   874  [blocking queries](/api-docs#blocking-queries) and
   875  [required ACLs](/api-docs#acls).
   876  
   877  | Blocking Queries | ACL Required  |
   878  | ---------------- | ------------- |
   879  | `NO`             | `agent:write` |
   880  
   881  ### Sample Payload
   882  
   883  ```json
   884  {
   885    "enabled_schedulers": [
   886      "service",
   887      "batch",
   888      "system",
   889      "sysbatch",
   890      "_core"
   891    ],
   892    "num_schedulers": 12
   893    "server_id": "server1.global"
   894  }
   895  ```
   896  
   897  ### Sample Request
   898  
   899  ```shell-session
   900  $ curl \
   901      --request PUT \
   902      --data @payload.json \
   903      https://localhost:4646/v1/agent/schedulers/config
   904  ```
   905  
   906  ### Sample Response
   907  
   908  ```json
   909  {
   910    "enabled_schedulers": [
   911      "service",
   912      "batch",
   913      "system",
   914      "sysbatch",
   915      "_core"
   916    ],
   917    "num_schedulers": 12,
   918    "server_id": "server1.global"
   919  }
   920  ```
   921  
   922  [`enabled_schedulers`]: /docs/configuration/server#enabled_schedulers
   923  [`num_schedulers`]: /docs/configuration/server#num_schedulers