Skip to content

Instantly share code, notes, and snippets.

@florentb
Last active August 29, 2015 14:07
Show Gist options
  • Save florentb/f66f077340b22d0a5948 to your computer and use it in GitHub Desktop.
Save florentb/f66f077340b22d0a5948 to your computer and use it in GitHub Desktop.
Vagrant ELK + Collectd
<VirtualHost *:80>
<Location "/server-status">
SetHandler server-status
Require all granted
</Location>
Alias /kibana /var/www/kibana-latest
<location "/kibana">
</location>
ErrorLog ${APACHE_LOG_DIR}/kibana_error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/kibana_access.log combined
</VirtualHost>
#!/usr/bin/env bash
apt-get update
apt-get -y upgrade
wget -qO - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add -
echo 'deb http://packages.elasticsearch.org/logstash/1.4/debian stable main' | tee /etc/apt/sources.list.d/logstash.list
apt-get update && apt-get install -y logstash
rm -f /etc/logstash/conf.d/logstash_collectd.conf
ln -sf /vagrant/logstash_collectd.conf /etc/logstash/conf.d/logstash_collectd.conf
echo 'deb http://packages.elasticsearch.org/elasticsearch/1.3/debian stable main' | tee /etc/apt/sources.list.d/elasticsearch.list
apt-get update && apt-get install -y elasticsearch
rm -f /etc/elasticsearch/elasticsearch.yml
ln -sf /vagrant/elasticsearch.yml /etc/elasticsearch/elasticsearch.yml
update-rc.d elasticsearch defaults 95 10
apt-get install -y apache2
cd /var/www/
wget -qO - https://download.elasticsearch.org/kibana/kibana/kibana-latest.tar.gz | tar xzf -
cd ~
a2dissite 000-default
ln -sf /vagrant/apache2-kibana.conf /etc/apache2/sites-available/apache2-kibana.conf
a2ensite apache2-kibana
service apache2 reload
apt-get install -y collectd collectd-utils
rm -f /etc/collectd/collectd.conf
ln -sf /vagrant/collectd.conf /etc/collectd/collectd.conf
service elasticsearch start
service logstash start
service collectd restart
Hostname "statshost"
LoadPlugin cpu
LoadPlugin df
LoadPlugin disk
LoadPlugin interface
LoadPlugin load
LoadPlugin memory
LoadPlugin processes
LoadPlugin users
LoadPlugin network
<Plugin df>
Device "/dev/sda1"
MountPoint "/"
FSType "ext3"
FSType rootfs
FSType sysfs
FSType proc
FSType devtmpfs
FSType devpts
FSType tmpfs
FSType fusectl
FSType cgroup
IgnoreSelected true
</Plugin>
<Plugin interface>
Interface "eth0"
IgnoreSelected false
</Plugin>
<Plugin "network">
Server "localhost"
</Plugin>
<Include "/etc/collectd/collectd.conf.d">
Filter "*.conf"
</Include>
cluster.name: elasticstats
input {
udp {
port => 25826
buffer_size => 1452
codec => collectd { }
type => "collectd"
}
}
output {
elasticsearch {
cluster => elasticstats
}
}
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision :shell, path: "bootstrap.sh"
config.vm.network "public_network"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment