itamae-plugin-recipe-zabbix 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8222e81e825b69610b78eec4b6f490120fadb23d
4
+ data.tar.gz: c3a333dbbf92e3ef42ea42bcda9e1221fce19508
5
+ SHA512:
6
+ metadata.gz: 44c43f75cd098a01c84080742cfadf763db1b98f6b752f31308f166ff7083afc66ab6625075034827ea78c1a253190d1922c669c6f88e10883a7ac232ac2607d
7
+ data.tar.gz: 164af23e647bc997b287963643e14db5ecdec06ce2de9c1c32c918cfcdee53cb1a178a9505b6c0e43529fb50daabc8ce1031df0386f2813f4b22b7794702422e
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .DS_Store
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in itamae-plugin-recipe-zabbix.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # Itamae::Plugin::Recipe::Zabbix
2
+
3
+ Itamae recipe plugin for zabbix
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'itamae-plugin-recipe-zabbix'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install itamae-plugin-recipe-zabbix
20
+
21
+ ## Usage
22
+
23
+ ### Install
24
+
25
+ ```ruby
26
+ include_recipe "zabbix"
27
+ include_recipe "zabbix::agent"
28
+ ```
29
+
30
+ ```yaml
31
+ zabbix:
32
+ version: 2.2
33
+ server: zabbix.example.com
34
+ port: 10050
35
+ hostname: local.example.com
36
+ host_metadata:
37
+ userparameters:
38
+ ```
39
+
40
+ ### Userparameters
41
+
42
+ ```ruby
43
+ include_recipe "zabbix"
44
+
45
+ zabbix_userparameters "all" do
46
+ path File.expand_path(File.dirname(__FILE__)) + "/zabbix/templates/etc/zabbix/zabbix_agentd.d/"
47
+ end
48
+ ```
49
+
50
+ ```yaml
51
+ zabbix:
52
+ userparameters:
53
+ - userparameter_hoge.conf.erb
54
+ - userparameter_piyo.conf.erb
55
+ ```
56
+
57
+ ## Contributing
58
+
59
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/itamae-plugin-recipe-zabbix.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "itamae/plugin/recipe/zabbix"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'itamae/plugin/recipe/zabbix/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "itamae-plugin-recipe-zabbix"
8
+ spec.version = Itamae::Plugin::Recipe::Zabbix::VERSION
9
+ spec.authors = ["zaru"]
10
+ spec.email = ["zarutofu@gmail.com"]
11
+
12
+ spec.summary = %q{Itamae plugin to install zabbix agent}
13
+ spec.description = %q{Itamae plugin to install zabbix agent}
14
+ spec.homepage = "https://github.com/zaru/itamae-plugin-recipe-zabbix"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.10"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec"
24
+ end
@@ -0,0 +1,30 @@
1
+ require "itamae/plugin/recipe/zabbix/version"
2
+
3
+ zabbix_version = 2.2 # or 1.8 ~ 2.4
4
+ zabbix_version = node[:zabbix][:version] if node[:zabbix][:version]
5
+
6
+ platform = "rhel" # or debian, ubuntu
7
+ platform = node[:zabbix][:platform] if node[:zabbix][:platform]
8
+
9
+ platform_version = "6"
10
+ platform_version = node[:zabbix][:platform_version] if node[:zabbix][:platform_version]
11
+
12
+ cpu = "x86_64" # or i386
13
+ cpu = node[:zabbix][:platform_cpu] if node[:zabbix][:platform_cpu]
14
+
15
+ package "http://repo.zabbix.com/zabbix/#{zabbix_version}/#{platform}/#{platform_version}/#{cpu}/zabbix-release-#{zabbix_version}-1.el#{platform_version}.noarch.rpm" do
16
+ not_if "rpm -q zabbix-release"
17
+ end
18
+
19
+ define :zabbix_userparameters, path: "" do
20
+ path = params[:path]
21
+
22
+ node[:zabbix][:userparameters].each do |f|
23
+ template "/etc/zabbix/zabbix_agentd.d/#{f}" do
24
+ owner "root"
25
+ group "root"
26
+ source path + "/#{f}"
27
+ end
28
+ end
29
+
30
+ end
@@ -0,0 +1,17 @@
1
+ %w( zabbix-agent ).each do |pkg|
2
+ package pkg
3
+ end
4
+
5
+ template "/etc/zabbix/zabbix_agentd.conf" do
6
+ owner "root"
7
+ group "root"
8
+ source "./templates/etc/zabbix/zabbix_agentd.conf.erb"
9
+ end
10
+
11
+ service 'zabbix-agent' do
12
+ action [:enable, :start]
13
+ end
14
+
15
+ service "zabbix-agent" do
16
+ subscribes :restart, "template[/etc/zabbix/zabbix_agentd.conf]"
17
+ end
@@ -0,0 +1,18 @@
1
+ PidFile=/var/run/zabbix/zabbix_agentd.pid
2
+ LogFile=/var/log/zabbix/zabbix_agentd.log
3
+ LogFileSize=0
4
+ EnableRemoteCommands=1
5
+
6
+ Server=<%= node[:zabbix][:server] %>
7
+ ListenPort=<%= node[:zabbix][:port] %>
8
+ ServerActive=<%= node[:zabbix][:server] %>
9
+
10
+ <% if node[:zabbix][:hostname] %>
11
+ Hostname=<%= node[:zabbix][:hostname] %>
12
+ <% else %>
13
+ HostnameItem=system.hostname
14
+ HostMetadata=<%= node[:zabbix][:host_metadata] %>
15
+ <% end %>
16
+
17
+ AllowRoot=1
18
+ Include=/etc/zabbix/zabbix_agentd.d/
@@ -0,0 +1,9 @@
1
+ module Itamae
2
+ module Plugin
3
+ module Recipe
4
+ module Zabbix
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: itamae-plugin-recipe-zabbix
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - zaru
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-10-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Itamae plugin to install zabbix agent
56
+ email:
57
+ - zarutofu@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - itamae-plugin-recipe-zabbix.gemspec
71
+ - lib/itamae/plugin/recipe/zabbix.rb
72
+ - lib/itamae/plugin/recipe/zabbix/agent.rb
73
+ - lib/itamae/plugin/recipe/zabbix/templates/etc/zabbix/zabbix_agentd.conf.erb
74
+ - lib/itamae/plugin/recipe/zabbix/version.rb
75
+ homepage: https://github.com/zaru/itamae-plugin-recipe-zabbix
76
+ licenses: []
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.4.5.1
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Itamae plugin to install zabbix agent
98
+ test_files: []