graylogapi 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/lib/graylogapi.rb +12 -0
- data/lib/graylogapi/dashboards.rb +48 -0
- data/lib/graylogapi/static_fields.rb +26 -0
- data/lib/graylogapi/system/index_sets.rb +8 -0
- data/lib/graylogapi/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9be5fd32aab8bdf033a166ea8f8a2bbcbc37d922
|
4
|
+
data.tar.gz: 4b1c4e462cbe2ef62b37c3d8c260eac5563f1eb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a1f053a8900febc23289bce905b860b411b3ae8239cd14d5621236a5434f7b1e3bceb6c3a743636c20e181626a96571991cc64c218194fe8ff5f9235bc3a13e
|
7
|
+
data.tar.gz: 594d5f6b37bae202ec9b79d668c991badc2473bbebbddd1b2a3f01275857f90eee243081bfd17bedb3100f08b00579e0322fca3b5441db516162436fdc3fcda7
|
data/README.md
CHANGED
@@ -40,6 +40,15 @@ For example, you can find *Inputs* in *System/Inputs* in the UI and you can find
|
|
40
40
|
* recent(params) — Get the most recent alarms of all streams.
|
41
41
|
* paginated(params) — Get alarms of all streams, filtered by specifying limit and offset parameters.
|
42
42
|
* by_id(id, params) — Get an alert by ID.
|
43
|
+
* **Dashboards**: Manage dashboards
|
44
|
+
* create(params) — Create a dashboard.
|
45
|
+
* all — Get a list of all dashboards and all configurations of their widgets.
|
46
|
+
* by_id(id) — Get a single dashboards and all configurations of its widgets.
|
47
|
+
* update(id, params) — Update the settings of a dashboard.
|
48
|
+
* delete(id) — Delete a dashboard and all its widgets.
|
49
|
+
* **StaticFields**: Static fields of an input.
|
50
|
+
* create(input_id, params) — Add a static field to an input.
|
51
|
+
* delete(input_id, key) — Remove static field of an input.
|
43
52
|
* **Streams**: Manage streams
|
44
53
|
* all — Get a list of all streams.
|
45
54
|
* create(params) — Create a stream.
|
data/lib/graylogapi.rb
CHANGED
@@ -4,6 +4,8 @@ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
|
4
4
|
require 'graylogapi/version'
|
5
5
|
require 'graylogapi/alerts'
|
6
6
|
require 'graylogapi/client'
|
7
|
+
require 'graylogapi/dashboards'
|
8
|
+
require 'graylogapi/static_fields'
|
7
9
|
require 'graylogapi/streams'
|
8
10
|
require 'graylogapi/system'
|
9
11
|
|
@@ -34,4 +36,14 @@ class GraylogAPI
|
|
34
36
|
def streams
|
35
37
|
@streams ||= Streams.new(@client)
|
36
38
|
end
|
39
|
+
|
40
|
+
# @return [GraylogAPI::Dashboards]
|
41
|
+
def dashboards
|
42
|
+
@dashboards ||= Dashboards.new(@client)
|
43
|
+
end
|
44
|
+
|
45
|
+
# @return [GraylogAPI::StaticFields]
|
46
|
+
def static_fields
|
47
|
+
@static_fields ||= StaticFields.new(@client)
|
48
|
+
end
|
37
49
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class GraylogAPI
|
2
|
+
# class for manage dashboards
|
3
|
+
class Dashboards
|
4
|
+
def initialize(client)
|
5
|
+
@client = client
|
6
|
+
end
|
7
|
+
|
8
|
+
# create a dashboard
|
9
|
+
#
|
10
|
+
# @param params [Hash]
|
11
|
+
# @return [GraylogAPI::Client::Response]
|
12
|
+
def create(params)
|
13
|
+
@client.json_request(:post, '/dashboards', params)
|
14
|
+
end
|
15
|
+
|
16
|
+
# get list of all dashboards
|
17
|
+
#
|
18
|
+
# @return [GraylogAPI::Client::Response]
|
19
|
+
def all
|
20
|
+
@client.json_request(:get, '/dashboards')
|
21
|
+
end
|
22
|
+
|
23
|
+
# get dashboard by id
|
24
|
+
#
|
25
|
+
# @param id [Integer] id of a dashboard
|
26
|
+
# @return [GraylogAPI::Client::Response]
|
27
|
+
def by_id(id)
|
28
|
+
@client.json_request(:get, "/dashboards/#{id}")
|
29
|
+
end
|
30
|
+
|
31
|
+
# update dashboard
|
32
|
+
#
|
33
|
+
# @param id [Integer] id of a dashboard
|
34
|
+
# @param params [Hash]
|
35
|
+
# @return [GraylogAPI::Client::Response]
|
36
|
+
def update(id, params)
|
37
|
+
@client.json_request(:put, "/dashboards/#{id}", params)
|
38
|
+
end
|
39
|
+
|
40
|
+
# delete dashboard
|
41
|
+
#
|
42
|
+
# @param id [Integer] id of a dashboard
|
43
|
+
# @return [GraylogAPI::Client::Response]
|
44
|
+
def delete(id)
|
45
|
+
@client.json_request(:delete, "/dashboards/#{id}")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class GraylogAPI
|
2
|
+
# class for manage StaticFields of an input
|
3
|
+
class StaticFields
|
4
|
+
def initialize(client)
|
5
|
+
@client = client
|
6
|
+
end
|
7
|
+
|
8
|
+
# add key to an input
|
9
|
+
#
|
10
|
+
# @param input_id [Integer] id of an input
|
11
|
+
# @param params [Hash] hash with key and value of new static field
|
12
|
+
# @return [GraylogAPI::Client::Response]
|
13
|
+
def create(input_id, params)
|
14
|
+
@client.json_request(:post, "/system/inputs/#{input_id}/staticfields", params)
|
15
|
+
end
|
16
|
+
|
17
|
+
# delete key of an input
|
18
|
+
#
|
19
|
+
# @param input_id [Integer] id of an input
|
20
|
+
# @param key [String] key of static field
|
21
|
+
# @return [GraylogAPI::Client::Response]
|
22
|
+
def delete(input_id, key)
|
23
|
+
@client.json_request(:delete, "/system/inputs/#{input_id}/staticfields/#{key}")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -21,6 +21,14 @@ class GraylogAPI
|
|
21
21
|
def delete(id)
|
22
22
|
@client.json_request(:delete, "/system/indices/index_sets/#{id}")
|
23
23
|
end
|
24
|
+
|
25
|
+
def make_default(id)
|
26
|
+
@client.json_request(:put, "/system/indices/index_sets/#{id}/default")
|
27
|
+
end
|
28
|
+
|
29
|
+
def update(id, params)
|
30
|
+
@client.json_request(:put, "/system/indices/index_sets/#{id}", params)
|
31
|
+
end
|
24
32
|
end
|
25
33
|
end
|
26
34
|
end
|
data/lib/graylogapi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graylogapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Aleksandrov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Allows you to work with graylog api from ruby
|
14
14
|
email:
|
@@ -24,6 +24,8 @@ files:
|
|
24
24
|
- lib/graylogapi/alerts.rb
|
25
25
|
- lib/graylogapi/client.rb
|
26
26
|
- lib/graylogapi/client/response.rb
|
27
|
+
- lib/graylogapi/dashboards.rb
|
28
|
+
- lib/graylogapi/static_fields.rb
|
27
29
|
- lib/graylogapi/streams.rb
|
28
30
|
- lib/graylogapi/system.rb
|
29
31
|
- lib/graylogapi/system/cluster.rb
|