logstash-output-zabbix 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/NOTICE.TXT +5 -0
- data/lib/logstash/outputs/zabbix.rb +4 -4
- data/logstash-output-zabbix.gemspec +3 -3
- metadata +28 -35
- data/.gitignore +0 -5
- data/Rakefile +0 -7
- data/docker/Dockerfile +0 -48
- data/docker/README.md +0 -89
- data/docker/build_db.sh +0 -29
- data/docker/run.sh +0 -10
- data/docker/zabbix.conf.php +0 -20
- data/docker/zabbix.sql +0 -3547
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f335e6edeefc3b732deae8543f1a88070d4b243
|
4
|
+
data.tar.gz: 841ef0e1a70580884bde00cfabf7b883813a3179
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8619695947f1058e2556cbf49ac134d2dd0dfe60e108a7766844028b21fe0804f18d577f243e7de163f3aff8938c1ea368490f75ae6b58d36ec8d4bd7c147780
|
7
|
+
data.tar.gz: 19ccda7d3fd84468fb51e8c665130700fe9847d0927087ac887c53bfc225c2bd99ced5c2a692e66660133cdcae1398cfce156d348c4c7704629135a5a349032f
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,6 @@
|
|
1
|
+
## 2.0.0
|
2
|
+
- Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
|
3
|
+
instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
|
4
|
+
- Dependency on logstash-core update to 2.0
|
5
|
+
- Update to allow semicolons (or not, e.g. Zabbix 2.0). #6 (davmrtl)
|
6
|
+
- Update to prevent Logstash from crashing when the Zabbix server becomes unavailable while the plugin is sending data. #9 (dkanbier)
|
data/NOTICE.TXT
ADDED
@@ -174,8 +174,8 @@ class LogStash::Outputs::Zabbix < LogStash::Outputs::Base
|
|
174
174
|
return false
|
175
175
|
end
|
176
176
|
# Prune the semicolons, then turn it into an array
|
177
|
-
info =
|
178
|
-
# ["processed", "0", "Failed", "
|
177
|
+
info = data["info"].tr(';', '').split()
|
178
|
+
# ["processed", "0", "Failed", "1", "Total", "1", "seconds", "spent:", "0.000018"]
|
179
179
|
failed = info[3].to_i
|
180
180
|
total = info[5].to_i
|
181
181
|
if failed == total
|
@@ -208,7 +208,7 @@ class LogStash::Outputs::Zabbix < LogStash::Outputs::Base
|
|
208
208
|
# Did the message get received by Zabbix?
|
209
209
|
response_check(event, resp)
|
210
210
|
end
|
211
|
-
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
|
211
|
+
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::ECONNRESET
|
212
212
|
@logger.error("Connection error. Unable to connect to Zabbix server",
|
213
213
|
:server => @zabbix_server_host,
|
214
214
|
:port => @zabbix_server_port.to_s
|
@@ -234,7 +234,7 @@ class LogStash::Outputs::Zabbix < LogStash::Outputs::Base
|
|
234
234
|
|
235
235
|
public
|
236
236
|
def receive(event)
|
237
|
-
|
237
|
+
|
238
238
|
return unless field_check(event, @zabbix_host)
|
239
239
|
send_to_zabbix(event)
|
240
240
|
end # def event
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-zabbix'
|
3
|
-
s.version = "
|
3
|
+
s.version = "2.0.0"
|
4
4
|
s.licenses = ["Apache License (2.0)"]
|
5
5
|
s.summary = "This output sends key/value pairs to a Zabbix server."
|
6
6
|
s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.require_paths = ["lib"]
|
11
11
|
|
12
12
|
# Files
|
13
|
-
s.files =
|
13
|
+
s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
|
14
14
|
# Tests
|
15
15
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
16
16
|
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" }
|
19
19
|
|
20
20
|
# Gem dependencies
|
21
|
-
s.add_runtime_dependency "logstash-core", ">=
|
21
|
+
s.add_runtime_dependency "logstash-core", ">= 2.0.0.beta2", "< 3.0.0"
|
22
22
|
s.add_runtime_dependency "zabbix_protocol"
|
23
23
|
s.add_runtime_dependency "logstash-codec-plain"
|
24
24
|
s.add_development_dependency "logstash-devutils", ">= 0.0.12"
|
metadata
CHANGED
@@ -1,125 +1,118 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-zabbix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: logstash-core
|
15
|
-
version_requirements: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 1.4.0
|
20
|
-
- - <
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 2.0.0
|
23
14
|
requirement: !ruby/object:Gem::Requirement
|
24
15
|
requirements:
|
25
16
|
- - '>='
|
26
17
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
18
|
+
version: 2.0.0.beta2
|
28
19
|
- - <
|
29
20
|
- !ruby/object:Gem::Version
|
30
|
-
version:
|
21
|
+
version: 3.0.0
|
22
|
+
name: logstash-core
|
31
23
|
prerelease: false
|
32
24
|
type: :runtime
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: zabbix_protocol
|
35
25
|
version_requirements: !ruby/object:Gem::Requirement
|
36
26
|
requirements:
|
37
27
|
- - '>='
|
38
28
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
29
|
+
version: 2.0.0.beta2
|
30
|
+
- - <
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.0.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
40
34
|
requirement: !ruby/object:Gem::Requirement
|
41
35
|
requirements:
|
42
36
|
- - '>='
|
43
37
|
- !ruby/object:Gem::Version
|
44
38
|
version: '0'
|
39
|
+
name: zabbix_protocol
|
45
40
|
prerelease: false
|
46
41
|
type: :runtime
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: logstash-codec-plain
|
49
42
|
version_requirements: !ruby/object:Gem::Requirement
|
50
43
|
requirements:
|
51
44
|
- - '>='
|
52
45
|
- !ruby/object:Gem::Version
|
53
46
|
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
54
48
|
requirement: !ruby/object:Gem::Requirement
|
55
49
|
requirements:
|
56
50
|
- - '>='
|
57
51
|
- !ruby/object:Gem::Version
|
58
52
|
version: '0'
|
53
|
+
name: logstash-codec-plain
|
59
54
|
prerelease: false
|
60
55
|
type: :runtime
|
61
|
-
- !ruby/object:Gem::Dependency
|
62
|
-
name: logstash-devutils
|
63
56
|
version_requirements: !ruby/object:Gem::Requirement
|
64
57
|
requirements:
|
65
58
|
- - '>='
|
66
59
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0
|
60
|
+
version: '0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
68
62
|
requirement: !ruby/object:Gem::Requirement
|
69
63
|
requirements:
|
70
64
|
- - '>='
|
71
65
|
- !ruby/object:Gem::Version
|
72
66
|
version: 0.0.12
|
67
|
+
name: logstash-devutils
|
73
68
|
prerelease: false
|
74
69
|
type: :development
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: logstash-filter-mutate
|
77
70
|
version_requirements: !ruby/object:Gem::Requirement
|
78
71
|
requirements:
|
79
72
|
- - '>='
|
80
73
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
74
|
+
version: 0.0.12
|
75
|
+
- !ruby/object:Gem::Dependency
|
82
76
|
requirement: !ruby/object:Gem::Requirement
|
83
77
|
requirements:
|
84
78
|
- - '>='
|
85
79
|
- !ruby/object:Gem::Version
|
86
80
|
version: '0'
|
81
|
+
name: logstash-filter-mutate
|
87
82
|
prerelease: false
|
88
83
|
type: :development
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: longshoreman
|
91
84
|
version_requirements: !ruby/object:Gem::Requirement
|
92
85
|
requirements:
|
93
86
|
- - '>='
|
94
87
|
- !ruby/object:Gem::Version
|
95
88
|
version: '0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
96
90
|
requirement: !ruby/object:Gem::Requirement
|
97
91
|
requirements:
|
98
92
|
- - '>='
|
99
93
|
- !ruby/object:Gem::Version
|
100
94
|
version: '0'
|
95
|
+
name: longshoreman
|
101
96
|
prerelease: false
|
102
97
|
type: :development
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
103
|
description: This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program
|
104
104
|
email: info@elastic.co
|
105
105
|
executables: []
|
106
106
|
extensions: []
|
107
107
|
extra_rdoc_files: []
|
108
108
|
files:
|
109
|
-
- .gitignore
|
110
109
|
- CHANGELOG.md
|
111
110
|
- CONTRIBUTORS
|
112
111
|
- DEVELOPER.md
|
113
112
|
- Gemfile
|
114
113
|
- LICENSE
|
114
|
+
- NOTICE.TXT
|
115
115
|
- README.md
|
116
|
-
- Rakefile
|
117
|
-
- docker/Dockerfile
|
118
|
-
- docker/README.md
|
119
|
-
- docker/build_db.sh
|
120
|
-
- docker/run.sh
|
121
|
-
- docker/zabbix.conf.php
|
122
|
-
- docker/zabbix.sql
|
123
116
|
- lib/logstash/outputs/zabbix.rb
|
124
117
|
- logstash-output-zabbix.gemspec
|
125
118
|
- spec/helpers/zabbix_helper.rb
|
@@ -146,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
139
|
version: '0'
|
147
140
|
requirements: []
|
148
141
|
rubyforge_project:
|
149
|
-
rubygems_version: 2.
|
142
|
+
rubygems_version: 2.4.8
|
150
143
|
signing_key:
|
151
144
|
specification_version: 4
|
152
145
|
summary: This output sends key/value pairs to a Zabbix server.
|
data/.gitignore
DELETED
data/Rakefile
DELETED
data/docker/Dockerfile
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
FROM ubuntu:14.04
|
2
|
-
|
3
|
-
MAINTAINER Aaron Mildenstein <aaron@mildensteins.com>
|
4
|
-
|
5
|
-
RUN apt-get -qq update
|
6
|
-
RUN DEBIAN_FRONTEND=noninteractive apt-get -yqq install mysql-server
|
7
|
-
#RUN apt-get -yqq install php5-mysql zabbix-frontend-php
|
8
|
-
RUN apt-get -yqq install zabbix-server-mysql
|
9
|
-
|
10
|
-
# Change PHP setup
|
11
|
-
#RUN sed -i -e 's/^post_max_size =.*/post_max_size = 16M/' -e 's/^max_execution_time.*/max_execution_time = 300/' \
|
12
|
-
# -e 's/^max_input_time.*/max_input_time = 300/' -e 's/;date.timezone.*/date.timezone = America\/Denver/' /etc/php5/apache2/php.ini
|
13
|
-
|
14
|
-
# Setup Apache
|
15
|
-
#RUN cp /usr/share/doc/zabbix-frontend-php/examples/apache.conf /etc/apache2/conf-available/zabbix.conf
|
16
|
-
#RUN ln -s /etc/apache2/conf-available/zabbix.conf /etc/apache2/conf-enabled/zabbix.conf
|
17
|
-
#COPY zabbix.conf.php /etc/zabbix/zabbix.conf.php
|
18
|
-
|
19
|
-
# Set to allow Zabbix to run
|
20
|
-
RUN sed -i s/START=no/START=yes/g /etc/default/zabbix-server
|
21
|
-
|
22
|
-
# Create this dir and change permissions (the package doesn't, for some reason)
|
23
|
-
RUN mkdir -p /var/run/zabbix
|
24
|
-
RUN chown zabbix:zabbix /var/run/zabbix
|
25
|
-
|
26
|
-
# Configure zabbix_server.conf
|
27
|
-
RUN sed -i -e 's/^# StartPollers=5/StartPollers=1/' \
|
28
|
-
-e 's/^# StartPollersUnreachable=1/StartPollersUnreachable=0/' \
|
29
|
-
-e 's/^# StartTrappers=5/StartTrappers=1/' \
|
30
|
-
-e 's/^# StartPingers=1/StartPingers=0/' \
|
31
|
-
-e 's/^# StartDiscoverers=1/StartDiscoverers=0/' \
|
32
|
-
-e 's/^# StartHTTPPollers=1/StartHTTPPollers=0/' \
|
33
|
-
-e 's/^# StartDBSyncers=4/StartDBSyncers=2/' \
|
34
|
-
-e 's/^DBUser=zabbix/DBUser=root/' \
|
35
|
-
-e 's/^# DBSocket=\/tmp\/mysql.sock/DBSocket=\/var\/run\/mysqld\/mysqld.sock/' \
|
36
|
-
-e 's/^# StartProxyPollers=1/StartProxyPollers=0/' /etc/zabbix/zabbix_server.conf
|
37
|
-
|
38
|
-
# Expose the Ports used by
|
39
|
-
# * Zabbix services
|
40
|
-
# * Apache with Zabbix UI (Add port 80 below)
|
41
|
-
|
42
|
-
EXPOSE 10051
|
43
|
-
|
44
|
-
COPY build_db.sh /
|
45
|
-
COPY run.sh /
|
46
|
-
COPY zabbix.sql /
|
47
|
-
RUN ln -s /run.sh /usr/bin/run
|
48
|
-
|
data/docker/README.md
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
# Docker Image For Testing This Plugin
|
2
|
-
|
3
|
-
The current image tag is: `latest`
|
4
|
-
|
5
|
-
## Docker Hub
|
6
|
-
|
7
|
-
The completed image is hosted at https://registry.hub.docker.com/u/untergeek/logstash_output_zabbix_rspec/
|
8
|
-
|
9
|
-
You can manually pull it to your Docker installation by running
|
10
|
-
|
11
|
-
docker pull untergeek/logstash_output_zabbix_rspec:latest
|
12
|
-
|
13
|
-
Learn more about Docker at http://docs.docker.com
|
14
|
-
|
15
|
-
## How the image was created
|
16
|
-
|
17
|
-
**Prerequisite: Database SQL file creation**
|
18
|
-
|
19
|
-
This image is currently built using a multi-stage process. Because creating
|
20
|
-
items either requires the API or SQL access, I opted to first build an image
|
21
|
-
with Apache & PHP so it would have a front-end. After building a successful
|
22
|
-
Zabbix installation, I created items and dumped the MySQL of the full db into
|
23
|
-
`zabbix.sql`. The vestiges of this remain commented in the `Dockerfile`.
|
24
|
-
|
25
|
-
### Building the image
|
26
|
-
|
27
|
-
A new Zabbix Server image had to be built based on the database from the previous
|
28
|
-
step. The `Dockerfile` is what built this with these steps:
|
29
|
-
|
30
|
-
#### 1. Build the initial image:
|
31
|
-
* `docker build .`
|
32
|
-
* Get the docker image id from this step and use in the next step
|
33
|
-
|
34
|
-
#### 2. Create the database on the initial image:
|
35
|
-
**Run the image from step 1 in an interactive shell:**
|
36
|
-
|
37
|
-
* Run `docker run -i -t IMAGE_ID /bin/bash` from the container host
|
38
|
-
* Run `/build_db.sh` from the resulting shell.
|
39
|
-
|
40
|
-
**Do NOT exit the shellwhen this is done.**
|
41
|
-
|
42
|
-
#### 3. Commit the changes to a new image:
|
43
|
-
From another shell on the container host, commit the changes (the populated
|
44
|
-
database) from the initial image into a _new_ image:
|
45
|
-
|
46
|
-
```
|
47
|
-
docker commit \
|
48
|
-
--author="Aaron Mildenstein <aaron@mildensteins.com>" \
|
49
|
-
--message="Populated the database" \
|
50
|
-
IMAGE_ID \
|
51
|
-
untergeek/logstash_output_zabbix_rspec:latest
|
52
|
-
```
|
53
|
-
|
54
|
-
#### 4. Push the image to Docker Hub:
|
55
|
-
|
56
|
-
The image is then pushed to the Docker Hub:
|
57
|
-
|
58
|
-
docker push untergeek/logstash_output_zabbix_rspec:latest
|
59
|
-
|
60
|
-
### Running the image
|
61
|
-
|
62
|
-
While the RSpec test handles creating a container from this image, and then
|
63
|
-
deletes it when done, you can manually run the image, if needed:
|
64
|
-
|
65
|
-
docker run -i --name="logstash_zabbix_rspec" -t -d -p 10051:10051 untergeek/logstash_output_zabbix_rspec:latest run
|
66
|
-
|
67
|
-
This command ensures that port 10051 is forwarded from the container to the
|
68
|
-
container host. The `run` command at the end runs `run.sh` as in this directory.
|
69
|
-
|
70
|
-
#### Manual/interactive container use
|
71
|
-
|
72
|
-
You can also run Zabbix interactively, as though you were on the server:
|
73
|
-
|
74
|
-
docker run -i -t -p 10051:10051 untergeek/logstash_output_zabbix_rspec:latest /bin/bash
|
75
|
-
|
76
|
-
At this point, you'd need to run `service mysql start` and `service zabbix-server start`
|
77
|
-
to fully initialize the server, but you have the ability to see the logs, or
|
78
|
-
query the MySQL directly. Exiting the shell will close and delete the container.
|
79
|
-
|
80
|
-
### Stopping the image
|
81
|
-
|
82
|
-
If you ran a container in detached (`-d`) mode, you can stop the running image
|
83
|
-
by running:
|
84
|
-
|
85
|
-
docker stop logstash_zabbix_rspec
|
86
|
-
|
87
|
-
This will only work if you included `--name="logstash_zabbix_rspec"` in your
|
88
|
-
`docker run` command-line. You will otherwise have to run `docker ps` and find
|
89
|
-
the container id.
|
data/docker/build_db.sh
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
# Start MySQL
|
4
|
-
/etc/init.d/mysql start
|
5
|
-
|
6
|
-
# Build the Zabbix Database
|
7
|
-
/etc/init.d/mysql start
|
8
|
-
|
9
|
-
# Build the Zabbix Database
|
10
|
-
mysql < /zabbix.sql
|
11
|
-
|
12
|
-
# Flush tables and logs
|
13
|
-
mysqladmin refresh
|
14
|
-
|
15
|
-
# Stop it again afterwards
|
16
|
-
/etc/init.d/mysql stop
|
17
|
-
|
18
|
-
### Instructions for building the original db
|
19
|
-
|
20
|
-
#echo 'create database zabbix character set utf8 collate utf8_bin' > /create.sql
|
21
|
-
#mysql < /create.sql
|
22
|
-
|
23
|
-
#cd /usr/share/zabbix-server-mysql/
|
24
|
-
#for file in $(ls *.gz); do gunzip $file; done
|
25
|
-
#mysql zabbix < schema.sql
|
26
|
-
#mysql zabbix < images.sql
|
27
|
-
#mysql zabbix < data.sql
|
28
|
-
|
29
|
-
### Run Zabbix, create your items, then mysqldump to zabbix.sql
|
data/docker/run.sh
DELETED
data/docker/zabbix.conf.php
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
<?php
|
2
|
-
// Zabbix GUI configuration file
|
3
|
-
global $DB;
|
4
|
-
|
5
|
-
$DB['TYPE'] = 'MYSQL';
|
6
|
-
$DB['SERVER'] = 'localhost';
|
7
|
-
$DB['PORT'] = '0';
|
8
|
-
$DB['DATABASE'] = 'zabbix';
|
9
|
-
$DB['USER'] = 'root';
|
10
|
-
$DB['PASSWORD'] = '';
|
11
|
-
|
12
|
-
// SCHEMA is relevant only for IBM_DB2 database
|
13
|
-
$DB['SCHEMA'] = '';
|
14
|
-
|
15
|
-
$ZBX_SERVER = 'localhost';
|
16
|
-
$ZBX_SERVER_PORT = '10051';
|
17
|
-
$ZBX_SERVER_NAME = '';
|
18
|
-
|
19
|
-
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
|
20
|
-
?>
|