github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/docs/autoscaling/api.mdx (about) 1 --- 2 layout: docs 3 page_title: HTTP API 4 sidebar_title: API 5 description: Learn about the Nomad Autoscaler HTTP API. 6 --- 7 8 # Nomad Autoscaler HTTP API 9 10 The Nomad Autoscaler exposes a small, simple API to be used for health checking 11 the agent and obtaining metric data. 12 13 ## Health API 14 15 This endpoint can be used to query the Nomad Autoscaler agent aliveness. If the 16 agent is alive, the request will return a 200 OK, otherwise it will return a 17 503 ServiceUnavailable. 18 19 | Method | Path | Produces | 20 | ------ | ------------ | ------------------ | 21 | `GET` | `/v1/health` | `application/json` | 22 23 ### Sample Request 24 25 ```shell-session 26 $ curl https://localhost:8080/v1/health 27 ``` 28 29 ## Metrics API 30 31 The `/metrics` endpoint returns metrics for the current Nomad Autoscaler process. 32 33 | Method | Path | Produces | 34 | ------ | ------------- | ------------------ | 35 | `GET` | `/v1/metrics` | `application/json` | 36 37 ### Parameters 38 39 - `format` `(string: "")` - Specifies the metrics format to be other than the 40 JSON default. Currently, only `prometheus` is supported as an alternative 41 format. This is specified as a query string parameter. 42 43 ### Sample Request 44 45 ```shell-session 46 $ curl https://localhost:8080/v1/metrics 47 ``` 48 49 ```shell-session 50 $ curl https://localhost:8080/v1/metrics?format=prometheus 51 ``` 52 53 ### Sample Response 54 55 ```json 56 { 57 "Counters": [ 58 { 59 "Count": 1, 60 "Labels": { 61 "policy_source": "nomad" 62 }, 63 "Max": 1, 64 "Mean": 1, 65 "Min": 1, 66 "Name": "nomad-autoscaler.policy.source.error_count", 67 "Rate": 0.1, 68 "Stddev": 0, 69 "Sum": 1 70 } 71 ], 72 "Gauges": [ 73 { 74 "Labels": {}, 75 "Name": "nomad-autoscaler.pathfinder.policy.total_num", 76 "Value": 0 77 }, 78 { 79 "Labels": {}, 80 "Name": "nomad-autoscaler.pathfinder.runtime.alloc_bytes", 81 "Value": 7230328 82 }, 83 { 84 "Labels": {}, 85 "Name": "nomad-autoscaler.pathfinder.runtime.free_count", 86 "Value": 137217 87 }, 88 { 89 "Labels": {}, 90 "Name": "nomad-autoscaler.pathfinder.runtime.heap_objects", 91 "Value": 90821 92 }, 93 { 94 "Labels": {}, 95 "Name": "nomad-autoscaler.pathfinder.runtime.malloc_count", 96 "Value": 228038 97 }, 98 { 99 "Labels": {}, 100 "Name": "nomad-autoscaler.pathfinder.runtime.num_goroutines", 101 "Value": 15 102 }, 103 { 104 "Labels": {}, 105 "Name": "nomad-autoscaler.pathfinder.runtime.sys_bytes", 106 "Value": 75317504 107 }, 108 { 109 "Labels": {}, 110 "Name": "nomad-autoscaler.pathfinder.runtime.total_gc_pause_ns", 111 "Value": 293262 112 }, 113 { 114 "Labels": {}, 115 "Name": "nomad-autoscaler.pathfinder.runtime.total_gc_runs", 116 "Value": 4 117 } 118 ], 119 "Points": [], 120 "Samples": [], 121 "Timestamp": "2020-08-25 10:25:20 +0000 UTC" 122 } 123 ```