hawkular-client 2.7.0 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +19 -2
- data/.travis/wait_for_services.rb +23 -0
- data/CHANGES.rdoc +11 -0
- data/docker-compose.yml +15 -0
- data/lib/hawkular/alerts/alerts_api.rb +24 -0
- data/lib/hawkular/base_client.rb +7 -0
- data/lib/hawkular/inventory/entities.rb +3 -0
- data/lib/hawkular/metrics/metric_api.rb +38 -3
- data/lib/hawkular/metrics/metrics_client.rb +3 -0
- data/lib/hawkular/metrics/tenant_api.rb +2 -2
- data/lib/hawkular/version.rb +1 -1
- data/spec/integration/alert-resources/alerts-test-data.json +40 -0
- data/spec/integration/alert-resources/events-test-data.json +78 -0
- data/spec/integration/alert-resources/triggers-test-data.json +66 -0
- data/spec/integration/alerts_spec.rb +192 -83
- data/spec/integration/hello-world-definitions.json +1 -2
- data/spec/integration/inventory_spec.rb +18 -5
- data/spec/integration/metric_spec.rb +201 -40
- data/spec/integration/operations_spec.rb +45 -1
- data/spec/spec_helper.rb +25 -6
- data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_acknowledge_an_alert.yml +205 -0
- data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_fetch_single_alert.yml +108 -0
- data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_list_alerts.yml +59 -0
- data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_list_alerts_for_trigger.yml +58 -0
- data/spec/vcr_cassettes/Alert/Alerts/{Should_list_alerts_for_unknown_trigger.yml → Templates/Should_list_alerts_for_unknown_trigger.yml} +13 -9
- data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_list_open_alerts.yml +59 -0
- data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_resolve_an_alert.yml +207 -0
- data/spec/vcr_cassettes/Alert/Alerts/Templates/setup.yml +255 -0
- data/spec/vcr_cassettes/Alert/Alerts/Templates/setup_cleanup.yml +302 -0
- data/spec/vcr_cassettes/Alert/EndToEnd/Templates/Should_create_and_fire_a_trigger.yml +527 -0
- data/spec/vcr_cassettes/{Metrics/NonSecure/metrics_0_16_0/Templates/Gauge_metrics/Should_return_periods.yml → Alert/Events/Templates/Should_create_an_event.yml} +22 -18
- data/spec/vcr_cassettes/{Metrics/NonSecure/metrics_0_16_0/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml → Alert/Events/Templates/Should_delete_an_event.yml} +28 -24
- data/spec/vcr_cassettes/Alert/Events/Templates/Should_list_events.yml +91 -0
- data/spec/vcr_cassettes/Alert/Events/Templates/Should_list_events_using_criteria.yml +60 -0
- data/spec/vcr_cassettes/Alert/Events/{Should_not_list_events_using_criteria.yml → Templates/Should_not_list_events_using_criteria.yml} +14 -13
- data/spec/vcr_cassettes/Alert/Events/Templates/setup.yml +615 -0
- data/spec/vcr_cassettes/Alert/Events/Templates/setup_cleanup.yml +567 -0
- data/spec/vcr_cassettes/Alert/Groups/{Should_operate_a_complex_group_trigger.yml → Templates/Should_operate_a_complex_group_trigger.yml} +508 -352
- data/spec/vcr_cassettes/{Alerts → Alert/Templates}/Should_return_the_version.yml +10 -8
- data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers.yml +55 -0
- data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers_for_ID.yml +56 -0
- data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers_for_Tag.yml +56 -0
- data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers_for_Tags.yml +56 -0
- data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_bulk_load_triggers.yml +243 -0
- data/spec/vcr_cassettes/Alert/Triggers/{Should_create_a_basic_trigger_with_action.yml → Templates/Should_create_a_basic_trigger_with_action.yml} +107 -76
- data/spec/vcr_cassettes/Alert/Triggers/{Should_create_a_firing_ALL_ANY_trigger.yml → Templates/Should_create_a_firing_ALL_ANY_trigger.yml} +81 -61
- data/spec/vcr_cassettes/{Metrics/NonSecure/metrics_0_16_0/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml → Alert/Triggers/Templates/Should_create_an_action.yml} +32 -30
- data/spec/vcr_cassettes/{Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml → Alert/Triggers/Templates/Should_get_a_single_Trigger_with_conditions.yml} +29 -29
- data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_get_a_single_metric_Trigger.yml +50 -0
- data/spec/vcr_cassettes/Alert/Triggers/{Should_get_the_action_definitions.yml → Templates/Should_get_the_action_definitions.yml} +46 -73
- data/spec/vcr_cassettes/Alert/Triggers/{Should_not_create_an_action_for_unknown_plugin.yml → Templates/Should_not_create_an_action_for_unknown_plugin.yml} +12 -8
- data/spec/vcr_cassettes/{Metrics/NonSecure/metrics_0_16_0/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml → Alert/Triggers/Templates/Should_not_create_an_action_for_unknown_properties.yml} +27 -26
- data/spec/vcr_cassettes/Alert/Triggers/Templates/setup.yml +52 -0
- data/spec/vcr_cassettes/{Metrics/NonSecure/metrics_0_16_0/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml → Alert/Triggers/Templates/setup_cleanup.yml} +51 -51
- data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_metrics_of_given_metric_type.yml +29 -25
- data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Get_metric_definition_by_id.yml +3 -3
- data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Retrieve_metric_rate_points.yml +5 -5
- data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_create_Availability_definition.yml +4 -4
- data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_create_Counter_definition.yml +4 -4
- data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_create_gauge_definition.yml +4 -4
- data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_push_metric_data_to_existing_gauge.yml +4 -4
- data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_update_tags_for_Availability_definition.yml +6 -6
- data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_update_tags_for_gauge_definition.yml +8 -8
- data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/setup_client.yml +44 -0
- data/spec/vcr_cassettes/Metrics/NonSecure/{metrics_0_16_0/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml → metrics_services/Templates/All_Tags_for_metrics/Should_fetch_all_metric_tags_for_metrics_definitions.yml} +159 -53
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/Should_group_contiguous_values.yml +47 -6
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +12 -12
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/setup_client.yml +44 -0
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +17 -17
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +23 -23
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +19 -19
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +12 -12
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/setup_client.yml +44 -0
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +19 -19
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +12 -12
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_return_periods.yml +5 -5
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory.yml +151 -5
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory_def.yml +152 -6
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/setup_client.yml +44 -0
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_fetch_rate_stats_for_mixed_metric.yml +33 -33
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_fetch_stats_for_mixed_metric.yml +31 -32
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +108 -20
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +26 -26
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +27 -27
- data/spec/vcr_cassettes/Metrics/NonSecure/{metrics_0_16_0/Templates/Status/Should_return_the_version.yml → metrics_services/Templates/Mixed_metrics/setup_client.yml} +3 -3
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/No_Tenant/Should_fail.yml +43 -4
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Status/Should_return_the_version.yml +44 -3
- data/spec/vcr_cassettes/Metrics/NonSecure/{metrics_0_16_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml → metrics_services/Templates/String_metrics/Should_create_string_definition_using_Hash.yml} +9 -9
- data/spec/vcr_cassettes/Metrics/NonSecure/{metrics_0_16_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml → metrics_services/Templates/String_metrics/Should_create_string_definition_using_MetricDefinition.yml} +9 -9
- data/spec/vcr_cassettes/Metrics/NonSecure/{metrics_0_16_0/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml → metrics_services/Templates/String_metrics/Should_push_metric_data_to_existing_string.yml} +27 -27
- data/spec/vcr_cassettes/Metrics/NonSecure/{metrics_0_16_0/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml → metrics_services/Templates/String_metrics/Should_push_metric_data_to_non-existing_string.yml} +15 -15
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/String_metrics/setup_client.yml +44 -0
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Tags_Metrics/setup_client.yml +44 -0
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Tenants/Should_create_and_return_tenant.yml +10 -6
- data/spec/vcr_cassettes/Metrics/{Secure/metrics_0_16_0/Templates/Status/Should_return_the_version.yml → NonSecure/metrics_services/Templates/Tenants/setup_client.yml} +5 -5
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/setup_client.yml +44 -0
- data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +80 -33
- data/spec/vcr_cassettes/Operation/NonSecure/Operation/Add_XA_datasource_should_be_doable.json +23 -0
- data/spec/vcr_cassettes/Operation/NonSecure/Operation/{Add_datasource_should_be_doable.json → Add_non-XA_datasource_should_be_doable.json} +0 -0
- metadata +111 -156
- data/spec/vcr_cassettes/Alert/Alerts/Should_acknowledge_an_alert.yml +0 -183
- data/spec/vcr_cassettes/Alert/Alerts/Should_fetch_single_alert.yml +0 -69
- data/spec/vcr_cassettes/Alert/Alerts/Should_list_alerts.yml +0 -85
- data/spec/vcr_cassettes/Alert/Alerts/Should_list_alerts_for_trigger.yml +0 -142
- data/spec/vcr_cassettes/Alert/Alerts/Should_resolve_an_alert.yml +0 -181
- data/spec/vcr_cassettes/Alert/Alerts/Should_resolve_an_alert2.yml +0 -49
- data/spec/vcr_cassettes/Alert/EndToEnd/Should_create_and_fire_a_trigger.yml +0 -1187
- data/spec/vcr_cassettes/Alert/Events/Should_create_an_event.yml +0 -50
- data/spec/vcr_cassettes/Alert/Events/Should_list_events.yml +0 -101
- data/spec/vcr_cassettes/Alert/Events/Should_list_events_using_criteria.yml +0 -79
- data/spec/vcr_cassettes/Alert/Triggers/Should_List_Triggers.yml +0 -62
- data/spec/vcr_cassettes/Alert/Triggers/Should_List_Triggers_for_ID.yml +0 -55
- data/spec/vcr_cassettes/Alert/Triggers/Should_List_Triggers_for_Tag.yml +0 -68
- data/spec/vcr_cassettes/Alert/Triggers/Should_List_Triggers_for_Tags.yml +0 -68
- data/spec/vcr_cassettes/Alert/Triggers/Should_bulk_load_triggers.yml +0 -225
- data/spec/vcr_cassettes/Alert/Triggers/Should_create_an_action.yml +0 -134
- data/spec/vcr_cassettes/Alert/Triggers/Should_create_an_action_for_webhooks.yml +0 -220
- data/spec/vcr_cassettes/Alert/Triggers/Should_get_a_single_Trigger_with_conditions.yml +0 -138
- data/spec/vcr_cassettes/Alert/Triggers/Should_get_a_single_metric_Trigger.yml +0 -50
- data/spec/vcr_cassettes/Alert/Triggers/Should_not_create_an_action_for_unknown_properties.yml +0 -134
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +0 -99
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Availability_metrics/Should_group_contiguous_values.yml +0 -97
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +0 -240
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +0 -99
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +0 -99
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +0 -240
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +0 -281
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +0 -240
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +0 -326
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +0 -314
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/No_Tenant/Should_fail.yml +0 -50
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Simple/Should_be_Cool.yml +0 -48
- data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Tenants/Should_create_and_return_tenant.yml +0 -99
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +0 -99
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +0 -99
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_group_contiguous_values.yml +0 -97
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +0 -240
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +0 -99
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +0 -99
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +0 -240
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +0 -328
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +0 -281
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +0 -144
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +0 -99
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +0 -99
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +0 -281
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +0 -144
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_return_periods.yml +0 -97
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +0 -240
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +0 -326
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +0 -314
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +0 -285
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/No_Tenant/Should_fail.yml +0 -50
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Simple/Should_be_Cool.yml +0 -48
- data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Tenants/Should_create_and_return_tenant.yml +0 -99
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc8f82c57d113d57a96488d3d5537e7e20449435
|
4
|
+
data.tar.gz: 365a613e0f23108b62d87fbb1bf78cc0ac7db08a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e072263ba50864dc2c3e7a5bdcd3e4bb4975f2dde4157fa31ddcb2498d5889ed83473c76186ba20b47cb80730e9d4f803ec1f2374b82d9ca9c49a16feb299f7a
|
7
|
+
data.tar.gz: acd1aef7ed3c8a2282a355efd8d9e1a06b4968c5a5e113e388dadd0d8bc5a5d24e309745beaf0078d4d0db121aeaf7b9dbd8ecb3ccb622c4d15da40bfd170fc2
|
data/.travis.yml
CHANGED
@@ -1,6 +1,23 @@
|
|
1
|
+
sudo: required
|
2
|
+
|
1
3
|
language: ruby
|
2
4
|
rvm:
|
3
|
-
- 2.0
|
4
|
-
- 2.1
|
5
5
|
- 2.2
|
6
6
|
- 2.3.0
|
7
|
+
env:
|
8
|
+
global:
|
9
|
+
- ADMIN_TOKEN=4f4a1434-8cb3-11e6-ae22-56b6b6499611
|
10
|
+
matrix:
|
11
|
+
- RUN_ON_LIVE_SERVER=1 \
|
12
|
+
VCR_UPDATE=1 \
|
13
|
+
SKIP_SSL_WITHOUT_CERTIFICATE_TEST=1 \
|
14
|
+
SKIP_SECURE_CONTEXT=1 \
|
15
|
+
SKIP_V8_METRICS=1 \
|
16
|
+
- RUN_ON_LIVE_SERVER=0
|
17
|
+
services:
|
18
|
+
- docker
|
19
|
+
before_install:
|
20
|
+
- (test $RUN_ON_LIVE_SERVER = 1 && docker-compose up -d && ./.travis/wait_for_services.rb) || echo "Skipping live server"
|
21
|
+
# Lets wait a bit for the agent to load everything it needs.
|
22
|
+
before_script:
|
23
|
+
- (test $RUN_ON_LIVE_SERVER = 1 && sleep 20s) || true
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'net/http'
|
3
|
+
|
4
|
+
uris = [
|
5
|
+
'http://localhost:8080/hawkular/status',
|
6
|
+
'http://localhost:8080/hawkular/metrics/status',
|
7
|
+
'http://localhost:8080/hawkular/alerts/status',
|
8
|
+
'http://localhost:8080/hawkular/inventory/status'
|
9
|
+
]
|
10
|
+
|
11
|
+
uris.each do |uri_string|
|
12
|
+
loop do
|
13
|
+
uri = URI(uri_string)
|
14
|
+
begin
|
15
|
+
response = Net::HTTP.get_response(uri)
|
16
|
+
break if response.code == '200'
|
17
|
+
puts "Waiting for: #{uri_string}"
|
18
|
+
rescue
|
19
|
+
puts 'Waiting for Hawkular-Services to accept connections'
|
20
|
+
end
|
21
|
+
sleep 5
|
22
|
+
end
|
23
|
+
end
|
data/CHANGES.rdoc
CHANGED
@@ -3,6 +3,17 @@
|
|
3
3
|
This document describes the relevant changes between releases of the
|
4
4
|
_hawkular-client_ project.
|
5
5
|
|
6
|
+
=== V 2.8.0
|
7
|
+
|
8
|
+
* Allow to list tags in Hawkular-Metrics
|
9
|
+
* Adding support for Hawkular-Admin-Token via admin_token
|
10
|
+
* Use the new "ackBy" mechanism in Hawkular Alerts. The Ruby-client API stayed the same.
|
11
|
+
* Support for string metrics
|
12
|
+
* Exposes metric-id property if it exists and follow internal renaming
|
13
|
+
* Addition of 'delete_event' on the client.
|
14
|
+
|
15
|
+
Full list of changes can be found at https://github.com/hawkular/hawkular-client-ruby/milestone/13?closed=1
|
16
|
+
|
6
17
|
=== V 2.7.0
|
7
18
|
|
8
19
|
* Support for SSL connections
|
data/docker-compose.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
hawkular:
|
2
|
+
image: "pilhuhn/hawkular-services:latest"
|
3
|
+
ports:
|
4
|
+
- "8080:8080"
|
5
|
+
- "8443:8443"
|
6
|
+
- "9990:9990"
|
7
|
+
links:
|
8
|
+
- myCassandra
|
9
|
+
environment:
|
10
|
+
- CASSANDRA_NODES=myCassandra
|
11
|
+
- ADMIN_TOKEN
|
12
|
+
myCassandra:
|
13
|
+
image: cassandra:3.7
|
14
|
+
environment:
|
15
|
+
- CASSANDRA_START_RPC=true
|
@@ -318,6 +318,10 @@ module Hawkular::Alerts
|
|
318
318
|
|
319
319
|
http_post('/events', event)
|
320
320
|
end
|
321
|
+
|
322
|
+
def delete_event(id)
|
323
|
+
http_delete "/events/#{id}"
|
324
|
+
end
|
321
325
|
end
|
322
326
|
|
323
327
|
# Representation of one Trigger
|
@@ -519,9 +523,29 @@ module Hawkular::Alerts
|
|
519
523
|
# server and not 'rubyfied'. So 'alertId' and not 'alert_id'
|
520
524
|
# Check http://www.hawkular.org/docs/rest/rest-alerts.html#Alert for details
|
521
525
|
class Alert < OpenStruct
|
526
|
+
attr_accessor :lifecycle
|
527
|
+
|
522
528
|
def initialize(alert_hash)
|
523
529
|
super(alert_hash)
|
530
|
+
@lifecycle = alert_hash['lifecycle']
|
531
|
+
end
|
532
|
+
|
533
|
+
def ack_by
|
534
|
+
status_by('ACKNOWLEDGED')
|
524
535
|
end
|
536
|
+
|
537
|
+
def resolved_by
|
538
|
+
status_by('RESOLVED')
|
539
|
+
end
|
540
|
+
|
541
|
+
def status_by(status)
|
542
|
+
a = @lifecycle.nil? ? [] : @lifecycle.select { |l| l['status'].eql? status }
|
543
|
+
a.empty? ? nil : a.last['user']
|
544
|
+
end
|
545
|
+
|
546
|
+
# for some API back compatibility
|
547
|
+
alias_method :ackBy, :ack_by
|
548
|
+
alias_method :resolvedBy, :resolved_by
|
525
549
|
end
|
526
550
|
|
527
551
|
# Representation of one event.
|
data/lib/hawkular/base_client.rb
CHANGED
@@ -25,6 +25,7 @@ module Hawkular
|
|
25
25
|
}.merge(credentials)
|
26
26
|
@options = {
|
27
27
|
tenant: nil,
|
28
|
+
admin_token: nil,
|
28
29
|
ssl_ca_file: nil,
|
29
30
|
verify_ssl: OpenSSL::SSL::VERIFY_PEER,
|
30
31
|
ssl_client_cert: nil,
|
@@ -174,6 +175,12 @@ module Hawkular
|
|
174
175
|
class HawkularConnectionException < HawkularException
|
175
176
|
end
|
176
177
|
|
178
|
+
def admin_header
|
179
|
+
headers = {}
|
180
|
+
headers[:'Hawkular-Admin-Token'] = @options[:admin_token] unless @options[:admin_token].nil?
|
181
|
+
headers
|
182
|
+
end
|
183
|
+
|
177
184
|
private
|
178
185
|
|
179
186
|
def token_header
|
@@ -102,6 +102,8 @@ module Hawkular::Inventory
|
|
102
102
|
include MetricFields
|
103
103
|
|
104
104
|
attr_reader :type_id
|
105
|
+
# @return [String] metric id used in Hawkular Metrics
|
106
|
+
attr_reader :hawkular_metric_id
|
105
107
|
|
106
108
|
def initialize(metric_hash)
|
107
109
|
super(metric_hash)
|
@@ -110,6 +112,7 @@ module Hawkular::Inventory
|
|
110
112
|
@type_id = metric_hash['type']['id']
|
111
113
|
@unit = metric_hash['type']['unit']
|
112
114
|
@collection_interval = metric_hash['type']['collectionInterval']
|
115
|
+
@hawkular_metric_id = @properties.key?('hawkular-metric-id') ? @properties['hawkular-metric-id'] : @id
|
113
116
|
end
|
114
117
|
end
|
115
118
|
|
@@ -30,11 +30,12 @@ module Hawkular::Metrics
|
|
30
30
|
# @example push gauge and availability datapoints
|
31
31
|
# client.push_data(gauges: [{:id => "gauge1", :data => [{:value => 1}, {:value => 2}]}],
|
32
32
|
# availabilities: [{:id => "avail1", :data => [{:value => "up"}]}])
|
33
|
-
def push_data(gauges: [], counters: [], availabilities: [])
|
33
|
+
def push_data(gauges: [], counters: [], availabilities: [], strings: [])
|
34
34
|
gauges.each { |g| default_timestamp g[:data] }
|
35
35
|
counters.each { |g| default_timestamp g[:data] }
|
36
36
|
availabilities.each { |g| default_timestamp g[:data] }
|
37
|
-
|
37
|
+
strings.each { |g| default_timestamp g[:data] }
|
38
|
+
data = { gauges: gauges, counters: counters, availabilities: availabilities, strings: strings }
|
38
39
|
path = '/metrics/'
|
39
40
|
@legacy_api ? path << 'data' : path << 'raw'
|
40
41
|
http_post(path, data)
|
@@ -68,6 +69,18 @@ module Hawkular::Metrics
|
|
68
69
|
http_post(path, data)
|
69
70
|
end
|
70
71
|
|
72
|
+
# Fetch all tags for metrics definitions
|
73
|
+
# @return [Hash{String=>String}]
|
74
|
+
def tags
|
75
|
+
tags = []
|
76
|
+
http_get('/metrics/').map do |g|
|
77
|
+
g['tags'].map do |k, v|
|
78
|
+
tags << { k => v }
|
79
|
+
end unless g['tags'].nil?
|
80
|
+
end
|
81
|
+
tags.uniq!
|
82
|
+
end
|
83
|
+
|
71
84
|
# Base class for accessing metric definition and data of all
|
72
85
|
# types (counters, gauges, availabilities).
|
73
86
|
class Metrics
|
@@ -249,7 +262,7 @@ module Hawkular::Metrics
|
|
249
262
|
# @return [Array[Hash]] rate points
|
250
263
|
def get_rate(id, starts: nil, ends: nil, bucket_duration: nil)
|
251
264
|
path = "/#{@resource}/#{ERB::Util.url_encode(id)}/rate"
|
252
|
-
path << '/stats' unless bucket_duration.nil?
|
265
|
+
path << '/stats' unless bucket_duration.nil? || @legacy_api
|
253
266
|
params = { start: starts, end: ends, bucketDuration: bucket_duration }
|
254
267
|
resp = @client.http_get(path + '?' + encode_params(params))
|
255
268
|
# API returns no content (empty Hash) instead of empty array
|
@@ -257,6 +270,28 @@ module Hawkular::Metrics
|
|
257
270
|
end
|
258
271
|
end
|
259
272
|
|
273
|
+
# Class that interacts with "string" metric types
|
274
|
+
class Strings < Metrics
|
275
|
+
# @param client [Client]
|
276
|
+
def initialize(client)
|
277
|
+
super(client, 'string', 'strings')
|
278
|
+
end
|
279
|
+
|
280
|
+
# Retrieve metric datapoints
|
281
|
+
# @param id [String] metric definition id
|
282
|
+
# @param starts [Integer] optional timestamp (default now - 8h)
|
283
|
+
# @param ends [Integer] optional timestamp (default now)
|
284
|
+
# @param distinct [String] optional set to true to return only distinct, contiguous values
|
285
|
+
# @param limit [Integer] optional limit the number of data points returned
|
286
|
+
# @param order [String] optional Data point sort order, based on timestamp (ASC, DESC)
|
287
|
+
# @return [Array[Hash]] datapoints
|
288
|
+
# @see #push_data #push_data for datapoint detail
|
289
|
+
def get_data(id, starts: nil, ends: nil, distinct: nil, limit: nil, order: nil)
|
290
|
+
params = { start: starts, end: ends, distinct: distinct, limit: limit, order: order }
|
291
|
+
get_data_helper(id, params)
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
260
295
|
# Class that interacts with "availability" metric types
|
261
296
|
class Availability < Metrics
|
262
297
|
# @param client [Client]
|
@@ -25,6 +25,8 @@ module Hawkular::Metrics
|
|
25
25
|
attr_reader :counters
|
26
26
|
# @return [Gauges] access gauges API
|
27
27
|
attr_reader :gauges
|
28
|
+
# @return [Strings] access strings API
|
29
|
+
attr_reader :strings
|
28
30
|
# @return [Availability] access counters API
|
29
31
|
attr_reader :avail
|
30
32
|
|
@@ -61,6 +63,7 @@ module Hawkular::Metrics
|
|
61
63
|
@counters = Client::Counters.new self
|
62
64
|
@gauges = Client::Gauges.new self
|
63
65
|
@avail = Client::Availability.new self
|
66
|
+
@strings = Client::Strings.new self
|
64
67
|
end
|
65
68
|
end
|
66
69
|
end
|
@@ -11,13 +11,13 @@ module Hawkular::Metrics
|
|
11
11
|
# Create new tenant
|
12
12
|
# @param id [String] tenant ID/Name
|
13
13
|
def create(id)
|
14
|
-
@client.http_post("/#{@resource}", id: id)
|
14
|
+
@client.http_post("/#{@resource}", { id: id }, @client.admin_header)
|
15
15
|
end
|
16
16
|
|
17
17
|
# Query existing tenants
|
18
18
|
# @return [Array[Tenant]]
|
19
19
|
def query
|
20
|
-
@client.http_get("/#{@resource}").map do |t|
|
20
|
+
@client.http_get("/#{@resource}", @client.admin_header).map do |t|
|
21
21
|
Hawkular::Metrics::Tenant.new(t)
|
22
22
|
end
|
23
23
|
end
|
data/lib/hawkular/version.rb
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
{
|
2
|
+
"triggers":[
|
3
|
+
{
|
4
|
+
"trigger": {
|
5
|
+
"id": "hello-world-trigger",
|
6
|
+
"name": "Hello World Trigger",
|
7
|
+
"description": "A mandatory Hello World Trigger",
|
8
|
+
"severity": "HIGH",
|
9
|
+
"enabled": true
|
10
|
+
},
|
11
|
+
"conditions":[
|
12
|
+
{
|
13
|
+
"triggerMode": "FIRING",
|
14
|
+
"type": "threshold",
|
15
|
+
"dataId": "data-x",
|
16
|
+
"operator": "LT",
|
17
|
+
"threshold": 5
|
18
|
+
}
|
19
|
+
]
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"trigger": {
|
23
|
+
"id": "a-trigger",
|
24
|
+
"name": "A trigger name",
|
25
|
+
"description": "Just a trigger",
|
26
|
+
"severity": "HIGH",
|
27
|
+
"enabled": true
|
28
|
+
},
|
29
|
+
"conditions":[
|
30
|
+
{
|
31
|
+
"triggerMode": "FIRING",
|
32
|
+
"type": "threshold",
|
33
|
+
"dataId": "data-x",
|
34
|
+
"operator": "LT",
|
35
|
+
"threshold": 5
|
36
|
+
}
|
37
|
+
]
|
38
|
+
}
|
39
|
+
]
|
40
|
+
}
|
@@ -0,0 +1,78 @@
|
|
1
|
+
{
|
2
|
+
"events": [
|
3
|
+
{
|
4
|
+
"id": "my-event-01",
|
5
|
+
"category": "general-category",
|
6
|
+
"text": "some text for this event",
|
7
|
+
"extras": {
|
8
|
+
"ctime": 2000
|
9
|
+
}
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"id": "my-event-02",
|
13
|
+
"category": "my-category-01",
|
14
|
+
"text": "some text for this event",
|
15
|
+
"extras": {}
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"id": "my-event-03",
|
19
|
+
"category": "my-category-01",
|
20
|
+
"text": "some text for this event",
|
21
|
+
"extras": {}
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"id": "my-event-04",
|
25
|
+
"category": "general-category",
|
26
|
+
"text": "some text for this event",
|
27
|
+
"extras": {}
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"id": "my-event-05",
|
31
|
+
"category": "my-category-02",
|
32
|
+
"text": "some text for this event",
|
33
|
+
"extras": {}
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"id": "my-event-06",
|
37
|
+
"category": "general-category",
|
38
|
+
"text": "some text for this event",
|
39
|
+
"extras": {}
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"id": "my-event-07",
|
43
|
+
"category": "my-category-01",
|
44
|
+
"text": "some text for this event",
|
45
|
+
"extras": {}
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"id": "my-event-08",
|
49
|
+
"category": "general-category",
|
50
|
+
"text": "some text for this event",
|
51
|
+
"extras": {}
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"id": "my-event-09",
|
55
|
+
"category": "general-category",
|
56
|
+
"text": "some text for this event",
|
57
|
+
"extras": {}
|
58
|
+
},
|
59
|
+
{
|
60
|
+
"id": "my-event-10",
|
61
|
+
"category": "general-category",
|
62
|
+
"text": "some text for this event",
|
63
|
+
"extras": {}
|
64
|
+
},
|
65
|
+
{
|
66
|
+
"id": "my-event-11",
|
67
|
+
"category": "general-category",
|
68
|
+
"text": "some text for this event",
|
69
|
+
"extras": {}
|
70
|
+
},
|
71
|
+
{
|
72
|
+
"id": "my-event-12",
|
73
|
+
"category": "general-category",
|
74
|
+
"text": "some text for this event",
|
75
|
+
"extras": {}
|
76
|
+
}
|
77
|
+
]
|
78
|
+
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
{
|
2
|
+
"triggers":[
|
3
|
+
{
|
4
|
+
"trigger": {
|
5
|
+
"id": "my-trigger-01",
|
6
|
+
"tags": {
|
7
|
+
"resourceId": "my-resource01",
|
8
|
+
"app": "MyShop"
|
9
|
+
}
|
10
|
+
},
|
11
|
+
"conditions":[
|
12
|
+
{
|
13
|
+
"triggerMode": "FIRING",
|
14
|
+
"type": "threshold",
|
15
|
+
"dataId": "data-x",
|
16
|
+
"operator": "LT",
|
17
|
+
"threshold": 5
|
18
|
+
}
|
19
|
+
],
|
20
|
+
"dampenings":[
|
21
|
+
{
|
22
|
+
"dampeningId": "my-trigger-01-my-dampening-id"
|
23
|
+
}
|
24
|
+
]
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"trigger": {
|
28
|
+
"id": "my-trigger-02",
|
29
|
+
"tags": {
|
30
|
+
"resourceId": "my-resource01"
|
31
|
+
}
|
32
|
+
}
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"trigger": {
|
36
|
+
"id": "my-trigger-03",
|
37
|
+
"tags": {
|
38
|
+
"app": "MyShop"
|
39
|
+
}
|
40
|
+
}
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"trigger": {
|
44
|
+
"id": "my-trigger-04",
|
45
|
+
"tags": {
|
46
|
+
"resourceId": "my-resource01",
|
47
|
+
"app": "MyShop"
|
48
|
+
}
|
49
|
+
}
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"trigger": {
|
53
|
+
"id": "my-trigger-05"
|
54
|
+
}
|
55
|
+
},
|
56
|
+
{
|
57
|
+
"trigger": {
|
58
|
+
"id": "my-trigger-06",
|
59
|
+
"tags": {
|
60
|
+
"resourceId": "my-resource01",
|
61
|
+
"app": "MyShop"
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
]
|
66
|
+
}
|