prometheus-api-client 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -3
- data/lib/prometheus/api_client/client.rb +1 -1
- data/lib/prometheus/api_client/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a557e4448ade4360c97b1467ccf8a5afc23c244
|
4
|
+
data.tar.gz: 255437c66a4bfbc9b5129519234006b44536b1b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b1463359dae9bbbde9c7ceff7a23db40f03d92a9c6b30d33a80fcfaccf76560038acbbad48858b229e03f61f1f93041582c037269a373be58642ea59ac4fd9b
|
7
|
+
data.tar.gz: 149728f4c861090bdbeda63d7356708743803269861aa3448207d281b8391f74c335aaa39b1d098b84b9057885bc09032fdb9ad36de1e477efc1a8215934c319
|
data/README.md
CHANGED
@@ -36,7 +36,7 @@ prometheus.get(
|
|
36
36
|
|
37
37
|
```ruby
|
38
38
|
# return a client for host http://example.com:9090/api/v1/
|
39
|
-
prometheus = Prometheus::ApiClient.client('example.com')
|
39
|
+
prometheus = Prometheus::ApiClient.client('http://example.com:9090')
|
40
40
|
```
|
41
41
|
|
42
42
|
#### Authentication proxy
|
@@ -44,10 +44,32 @@ prometheus = Prometheus::ApiClient.client('example.com')
|
|
44
44
|
If an authentication proxy ( e.g. oauth2 ) is used in a layer above the prometheus REST server, this client can use ssl and authentication headears.
|
45
45
|
|
46
46
|
```ruby
|
47
|
-
# return a client for host https://example.com/api/v1/
|
48
|
-
prometheus = Prometheus::ApiClient.client('example.com',
|
47
|
+
# return a client for host https://example.com/api/v1/ using a Bearer token "TopSecret"
|
48
|
+
prometheus = Prometheus::ApiClient.client('https://example.com:443', credentials: {token: 'TopSecret'})
|
49
49
|
```
|
50
50
|
|
51
|
+
#### High level calls
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
|
55
|
+
# send a query request to server
|
56
|
+
prometheus.query(
|
57
|
+
:query => "sum(container_cpu_usage_seconds_total{container_name=\"prometheus-hgv4s\",job=\"kubernetes-nodes\"})",
|
58
|
+
:start => "2015-07-01T20:10:30.781Z",
|
59
|
+
:end => "2015-07-02T20:10:30.781Z"
|
60
|
+
)
|
61
|
+
|
62
|
+
# send a query_range request to server
|
63
|
+
prometheus.query_range(
|
64
|
+
:query => "sum(container_cpu_usage_seconds_total{container_name=\"prometheus-hgv4s\",job=\"kubernetes-nodes\"})",
|
65
|
+
:start => "2015-07-01T20:10:30.781Z",
|
66
|
+
:end => "2015-07-02T20:10:30.781Z",
|
67
|
+
:step => "120s"
|
68
|
+
)
|
69
|
+
|
70
|
+
# send a label request to server
|
71
|
+
prometheus.label('__name__')
|
72
|
+
```
|
51
73
|
## Tests
|
52
74
|
|
53
75
|
Install necessary development gems with `bundle install` and run tests with
|