Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Commit

Permalink
icinga2x-elastic: Refactor Vagrantfile, update to Kibana 5.3.1, cleanup
Browse files Browse the repository at this point in the history
refs #17
refs #53
  • Loading branch information
Michael Friedrich committed Apr 22, 2017
1 parent 6581df6 commit b42dca9
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 267 deletions.
125 changes: 80 additions & 45 deletions icinga2x-elastic/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

VAGRANTFILE_API_VERSION = "2"
VAGRANT_REQUIRED_VERSION = "1.6.5"
VAGRANT_REQUIRED_LINKED_CLONE_VERSION = "1.8.4"

# Require 1.6.5 at least
if ! defined? Vagrant.require_version
Expand All @@ -14,72 +15,106 @@ else
Vagrant.require_version ">= " + VAGRANT_REQUIRED_VERSION
end

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

servers = { 'icinga2-elastic' => '192.168.33.7'
# inspired by https://github.com/lbetz/vagrant-icinga-book/blob/master/Vagrantfile
nodes = { 'icinga2-elastic' => {
:box => 'centos/7',
:mac => '020027000110',
:net => 'icinga2-elastic.demo.local',
:hostonly => '192.168.33.7',
:memory => '2048',
:cpu => '2',
:fowarded => {
'443' => '8443',
'80' => '8082',
'22' => '2082',
}
http_port = { 'icinga2-elastic' => 8082
}
ssh_port = { 'icinga2-elastic' => 2082
}
graphite_web_port = { 'icinga2-elastic' => 8083
}

servers.each do |server_name, server_ip|
config.vm.define server_name do |app_config|

# network config
app_config.vm.hostname = "#{server_name.to_s}"
#app_config.vm.network :forwarded_port, guest: 22, host: 2222, id: "ssh", disabled: true
app_config.vm.network :forwarded_port, guest: 22, host: ssh_port[server_name], auto_correct: true
app_config.vm.network :forwarded_port, guest: 80, host: http_port[server_name], auto_correct: true
app_config.vm.network :forwarded_port, guest: 8003, host: graphite_web_port[server_name], auto_correct: true
app_config.vm.network :private_network, ip: "#{server_ip}"

app_config.vm.provision :shell, :path => "manifests/puppet.sh"
}
}

# workaround for Vagrant >1.8.4-1.9.1 not bringing up eth1 properly
# https://github.com/mitchellh/vagrant/issues/8096
app_config.vm.provision "shell", inline: "service network restart", run: "always"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
nodes.each_pair do |name, options|
config.vm.define name do |node_config|
node_config.vm.box = options[:box]
node_config.vm.hostname = name
node_config.vm.box_url = options[:url] if options[:url]
if options[:forwarded]
options[:forwarded].each_pair do |guest, local|
node_config.vm.network "forwarded_port", guest: guest, host: local
end
end

# parallels
app_config.vm.provider :parallels do |p, override|
override.vm.box = "parallels/centos-7.2"
node_config.vm.network :private_network, ip: options[:hostonly] if options[:hostonly]

p.name = "Icinga 2: #{server_name.to_s}"
# provider: parallels
node_config.vm.provider :parallels do |p, override|
override.vm.box = "parallels/centos-7.2"
override.vm.boot_timeout = 600

# Update Parallels Tools automatically
p.name = "Icinga 2: #{name.to_s}"
p.update_guest_tools = false

override.vm.boot_timeout = 600
p.linked_clone = true if Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new(VAGRANT_REQUIRED_LINKED_CLONE_VERSION)

# Set power consumption mode to "Better Performance"
p.customize ["set", :id, "--longer-battery-life", "off"]

p.memory = 2048
p.cpus = 2
p.memory = options[:memory] if options[:memory]
p.cpus = options[:cpus] if options[:cpus]
end

# virtualbox
app_config.vm.provider :virtualbox do |v, override|
override.vm.box = "centos-71-x64-vbox"
override.vm.box_url = "http://boxes.icinga.com/centos-71-x64-vbox.box"
# provider: virtualbox
node_config.vm.provider :virtualbox do |vb, override|
unless Vagrant.has_plugin?("vagrant-vbguest")
raise 'vagrant-vbguest is not installed! Run "vagrant plugin install vagrant-vbguest"'
end
node_config.vbguest.auto_update = true
vb.linked_clone = true if Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new(VAGRANT_REQUIRED_LINKED_CLONE_VERSION)
vb.name = name
vb.gui = options[:gui] if options[:gui]
vb.customize ["modifyvm", :id,
"--groups", "/Icinga Vagrant/" + options[:net],
"--memory", "512",
"--cpus", "1",
"--audio", "none",
"--usb", "on",
"--usbehci", "off",
"--natdnshostresolver1", "on",
#"--nic2", "intnet",
#"--intnet2", options[:net],
#"--macaddress2". options[:mac]
]
vb.memory = options[:memory] if options[:memory]
vb.cpus = options[:cpus] if options[:cpus]
end

v.customize ["modifyvm", :id, "--memory", "2048"]
v.customize ["modifyvm", :id, "--cpus", "2"]
# Using the host's resolver as a DNS proxy in NAT mode
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
# provider: libvirt
node_config.vm.provider :libvirt do |lv, override|
lv.memory = options[:memory] if options[:memory]
lv.cpus = options[:cpus] if options[:cpus]
end

# provisioner
app_config.vm.provision :puppet do |puppet|
# provisioner: ensure that hostonly network is up
#
# workaround for Vagrant >1.8.4-1.9.1 not bringing up eth1 properly
# https://github.com/mitchellh/vagrant/issues/8096
node_config.vm.provision "shell", inline: "service network restart", run: "always"

# provisioner: install requirements
node_config.vm.provision :shell, :path => "../scripts/shell_provisioner.sh"

# provisioner: install box using puppet manifest
node_config.vm.provision :puppet do |puppet|
puppet.module_path = "../modules"
puppet.manifests_path = "manifests"
puppet.hiera_config_path = "hiera.yaml"
#puppet.options = "--verbose --debug --parser=future"
puppet.options = "--parser=future"
end
app_config.vm.provision :shell, :path => "manifests/finalize.sh"

# print a friendly message
node_config.vm.provision "shell", inline: <<-SHELL
echo "Finished installing the Vagrant box '#{name}'."
echo "Navigate to http://#{options[:hostonly]}"
SHELL
end
end
end
Expand Down
4 changes: 0 additions & 4 deletions icinga2x-elastic/files/etc/gemrc

This file was deleted.

15 changes: 0 additions & 15 deletions icinga2x-elastic/files/etc/systemd/system/carbon-cache.service

This file was deleted.

5 changes: 0 additions & 5 deletions icinga2x-elastic/files/usr/local/bin/kibana-setup
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

ES_URL="http://localhost:9200"
ES_INDEX_URL="$ES_URL/.kibana/index-pattern/filebeat"
#ES_DEFAULT_INDEX_URL="$ES_URL/.kibana/config/5.0.1" #TODO on package update
TIMEOUT=300

START=$(date +%s)
Expand All @@ -24,7 +23,3 @@ done

echo -e "Adding filebeat index pattern"
curl -XPUT $ES_INDEX_URL -d '{ "title":"filebeat", "timeFieldName":"@timestamp" }'

# use icingabeat outside
#echo -e "Setting filebeat as default index"
#curl -XPUT $ES_DEFAULT_INDEX_URL -d '{ "defaultIndex":"filebeat" }'
19 changes: 0 additions & 19 deletions icinga2x-elastic/files/usr/local/nagvis/etc/maps/icinga2.cfg

This file was deleted.

This file was deleted.

5 changes: 1 addition & 4 deletions icinga2x-elastic/manifests/default.pp
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@
notify => Service['icinga2']
}

# enable the command pipe
icinga2::feature { 'command': }

file { '/etc/icinga2/conf.d/hosts.conf':
owner => icinga,
group => icinga,
Expand Down Expand Up @@ -222,7 +219,7 @@
####################################

# global vars
$kibanaVersion = '5.2.2'
$kibanaVersion = '5.3.1'
$icingabeatVersion = '1.1.0'
$icingabeatDashboardsChecksum = '9c98cf4341cbcf6d4419258ebcc2121c3dede020'
# keep this in sync with the icingabeat dashboard ids!
Expand Down
5 changes: 0 additions & 5 deletions icinga2x-elastic/manifests/finalize.sh

This file was deleted.

Loading

0 comments on commit b42dca9

Please sign in to comment.