├── .gitignore ├── README.md ├── Vagrantfile ├── ansible ├── graphite.yaml ├── logstash.d │ ├── graphite.conf.j2 │ ├── logstash-web-indexer.conf.j2 │ ├── minecraft-server.conf.j2 │ └── redis.conf.j2 ├── logstash.yaml ├── minecraft.yaml ├── redis.yaml ├── riemann.yaml ├── roles │ ├── collectd │ │ ├── tasks │ │ │ └── main.yaml │ │ └── templates │ │ │ ├── collectd.conf │ │ │ ├── collection.conf │ │ │ ├── filters.conf │ │ │ └── thresholds.conf │ ├── graphite │ │ ├── defaults │ │ │ └── main.yaml │ │ ├── meta │ │ │ └── main.yaml │ │ ├── tasks │ │ │ └── main.yaml │ │ └── templates │ │ │ ├── carbon-cache.conf.j2 │ │ │ ├── graphite-web.conf.j2 │ │ │ └── settings.py.j2 │ ├── logstash │ │ ├── defaults │ │ │ └── main.yaml │ │ ├── files │ │ │ └── .gitkeep │ │ ├── meta │ │ │ └── main.yaml │ │ ├── tasks │ │ │ └── main.yaml │ │ └── templates │ │ │ └── logstash.conf.j2 │ ├── minecraft │ │ ├── defaults │ │ │ └── main.yaml │ │ ├── files │ │ │ └── .gitkeep │ │ ├── meta │ │ │ └── main.yaml │ │ ├── tasks │ │ │ └── main.yaml │ │ └── templates │ │ │ ├── confs │ │ │ ├── banned-ips.txt.j2 │ │ │ ├── banned-players.txt.j2 │ │ │ ├── ops.txt.j2 │ │ │ ├── server.properties.j2 │ │ │ └── white-list.txt.j2 │ │ │ ├── log4j2.xml.j2 │ │ │ └── minecraft-server.conf.j2 │ ├── redis │ │ ├── defaults │ │ │ └── main.yaml │ │ ├── files │ │ │ └── .gitkeep │ │ ├── meta │ │ │ └── main.yaml │ │ ├── tasks │ │ │ └── main.yaml │ │ └── templates │ │ │ ├── redis-server.conf.j2 │ │ │ └── redis.conf.j2 │ ├── riemann-dash │ │ ├── defaults │ │ │ └── main.yaml │ │ ├── tasks │ │ │ └── main.yaml │ │ └── templates │ │ │ ├── config.rb.j2 │ │ │ └── riemann-dash.conf.j2 │ ├── riemann-tools │ │ ├── defaults │ │ │ └── main.yaml │ │ ├── meta │ │ │ └── main.yaml │ │ ├── tasks │ │ │ └── main.yaml │ │ └── templates │ │ │ └── riemann-tools.conf.j2 │ ├── riemann │ │ ├── defaults │ │ │ └── main.yaml │ │ ├── files │ │ │ └── .gitkeep │ │ ├── tasks │ │ │ └── main.yaml │ │ └── templates │ │ │ ├── riemann-graphite-relay.config.j2 │ │ │ └── riemann.config.j2 │ ├── statsd │ │ ├── defaults │ │ │ └── main.yaml │ │ ├── meta │ │ │ └── main.yaml │ │ ├── tasks │ │ │ └── main.yaml │ │ └── templates │ │ │ ├── statsd-config.js.j2 │ │ │ └── statsd.conf.j2 │ └── system_user │ │ ├── defaults │ │ └── main.yaml │ │ ├── meta │ │ └── main.yaml │ │ └── tasks │ │ └── main.yaml ├── shared-vars.yaml └── statsd.yaml ├── base-box ├── .gitignore ├── Vagrantfile ├── install.sh └── provision.sh ├── init.sh └── launch.sh /.gitignore: -------------------------------------------------------------------------------- 1 | /roles/supervise 2 | /roles/supervisord 3 | /.vagrant 4 | vagrant_ansible_inventory* 5 | /ansible/roles/minecraft/files/minecraft_server*.jar 6 | /ansible/roles/logstash/files/logstash*.jar 7 | /ansible/roles/redis/files/redis-*.tar.gz 8 | /ansible/roles/riemann/files/riemann_*.deb 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Monitorcraft 2 | 3 | An idealized production environment for running an application in, including logging, monitoring, alerting, metrics, etc. 4 | 5 | Using the Minecraft Server as an example application 6 | 7 | # Setup 8 | 9 | Simply run the following: 10 | 11 | ```shell 12 | ./init.sh 13 | ./launch.sh 14 | ``` 15 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! 5 | VAGRANTFILE_API_VERSION = "2" 6 | 7 | VM_BOX = "monitorcraft-base" 8 | 9 | Vagrant.require_plugin "vagrant-hostmanager" 10 | 11 | def consistent_box(config, name) 12 | config.vm.define name do |vm| 13 | vm.vm.box = VM_BOX 14 | vm.vm.hostname = name 15 | 16 | vm.vm.provision :ansible do |ansible| 17 | ansible.host_key_checking = false 18 | ansible.verbose = "v" 19 | ansible.playbook = "ansible/" + name + ".yaml" 20 | end 21 | end 22 | end 23 | 24 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 25 | 26 | config.hostmanager.enabled = true 27 | config.hostmanager.manage_host = true 28 | 29 | consistent_box(config, "graphite") 30 | consistent_box(config, "logstash") 31 | consistent_box(config, "minecraft") 32 | consistent_box(config, "redis") 33 | consistent_box(config, "riemann") 34 | consistent_box(config, "statsd") 35 | 36 | 37 | # All Vagrant configuration is done here. The most common configuration 38 | # options are documented and commented below. For a complete reference, 39 | # please see the online documentation at vagrantup.com. 40 | 41 | # Every Vagrant virtual environment requires a box to build off of. 42 | # config.vm.box = "ubuntu13-ansible" 43 | 44 | # The url from where the 'config.vm.box' box will be fetched if it 45 | # doesn't already exist on the user's system. 46 | # config.vm.box_url = "http://domain.com/path/to/above.box" 47 | 48 | # Create a forwarded port mapping which allows access to a specific port 49 | # within the machine from a port on the host machine. In the example below, 50 | # accessing "localhost:8080" will access port 80 on the guest machine. 51 | # config.vm.network :forwarded_port, guest: 80, host: 8080 52 | 53 | # Create a private network, which allows host-only access to the machine 54 | # using a specific IP. 55 | # config.vm.network :private_network, ip: "192.168.33.10" 56 | 57 | # Create a public network, which generally matched to bridged network. 58 | # Bridged networks make the machine appear as another physical device on 59 | # your network. 60 | # config.vm.network :public_network 61 | 62 | # If true, then any SSH connections made will enable agent forwarding. 63 | # Default value: false 64 | # config.ssh.forward_agent = true 65 | 66 | # Share an additional folder to the guest VM. The first argument is 67 | # the path on the host to the actual folder. The second argument is 68 | # the path on the guest to mount the folder. And the optional third 69 | # argument is a set of non-required options. 70 | # config.vm.synced_folder "../data", "/vagrant_data" 71 | 72 | # Provider-specific configuration so you can fine-tune various 73 | # backing providers for Vagrant. These expose provider-specific options. 74 | # Example for VirtualBox: 75 | # 76 | # config.vm.provider :virtualbox do |vb| 77 | # # Don't boot with headless mode 78 | # vb.gui = true 79 | # 80 | # # Use VBoxManage to customize the VM. For example to change memory: 81 | # vb.customize ["modifyvm", :id, "--memory", "1024"] 82 | # end 83 | # 84 | # View the documentation for the provider you're using for more 85 | # information on available options. 86 | 87 | # Enable provisioning with Puppet stand alone. Puppet manifests 88 | # are contained in a directory path relative to this Vagrantfile. 89 | # You will need to create the manifests directory and a manifest in 90 | # the file ubuntu13-ansible.pp in the manifests_path directory. 91 | # 92 | # An example Puppet manifest to provision the message of the day: 93 | # 94 | # # group { "puppet": 95 | # # ensure => "present", 96 | # # } 97 | # # 98 | # # File { owner => 0, group => 0, mode => 0644 } 99 | # # 100 | # # file { '/etc/motd': 101 | # # content => "Welcome to your Vagrant-built virtual machine! 102 | # # Managed by Puppet.\n" 103 | # # } 104 | # 105 | # config.vm.provision :puppet do |puppet| 106 | # puppet.manifests_path = "manifests" 107 | # puppet.manifest_file = "site.pp" 108 | # end 109 | 110 | # Enable provisioning with chef solo, specifying a cookbooks path, roles 111 | # path, and data_bags path (all relative to this Vagrantfile), and adding 112 | # some recipes and/or roles. 113 | # 114 | # config.vm.provision :chef_solo do |chef| 115 | # chef.cookbooks_path = "../my-recipes/cookbooks" 116 | # chef.roles_path = "../my-recipes/roles" 117 | # chef.data_bags_path = "../my-recipes/data_bags" 118 | # chef.add_recipe "mysql" 119 | # chef.add_role "web" 120 | # 121 | # # You may also specify custom JSON attributes: 122 | # chef.json = { :mysql_password => "foo" } 123 | # end 124 | 125 | # Enable provisioning with chef server, specifying the chef server URL, 126 | # and the path to the validation key (relative to this Vagrantfile). 127 | # 128 | # The Opscode Platform uses HTTPS. Substitute your organization for 129 | # ORGNAME in the URL and validation key. 130 | # 131 | # If you have your own Chef Server, use the appropriate URL, which may be 132 | # HTTP instead of HTTPS depending on your configuration. Also change the 133 | # validation key to validation.pem. 134 | # 135 | # config.vm.provision :chef_client do |chef| 136 | # chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME" 137 | # chef.validation_key_path = "ORGNAME-validator.pem" 138 | # end 139 | # 140 | # If you're using the Opscode platform, your validator client is 141 | # ORGNAME-validator, replacing ORGNAME with your organization name. 142 | # 143 | # If you have your own Chef Server, the default validation client name is 144 | # chef-validator, unless you changed the configuration. 145 | # 146 | # chef.validation_client_name = "ORGNAME-validator" 147 | end 148 | -------------------------------------------------------------------------------- /ansible/graphite.yaml: -------------------------------------------------------------------------------- 1 | - hosts: all 2 | sudo: yes 3 | 4 | vars_files: 5 | - shared-vars.yaml 6 | 7 | roles: 8 | - role: riemann-tools 9 | - role: riemann-tools 10 | riemann_tools_cmd: riemann-net 11 | - role: riemann-tools 12 | riemann_tools_cmd: riemann-memcached 13 | riemann_tools_options: --memcached-host graphite 14 | - role: graphite 15 | - role: logstash 16 | logstash_run_as: root 17 | logstash_conf_template: "logstash.d/graphite.conf.j2" 18 | -------------------------------------------------------------------------------- /ansible/logstash.d/graphite.conf.j2: -------------------------------------------------------------------------------- 1 | input { 2 | file { 3 | path => [ "{{ graphite_storage_location }}/log/webapp/*.log" ] 4 | tags => ["graphite_web"] 5 | } 6 | file { 7 | path => [ "/var/log/upstart/carbon-cache.log" ] 8 | tags => ["carbon_cache"] 9 | } 10 | file { 11 | path => [ "/var/log/syslog" ] 12 | tags => ["syslog"] 13 | } 14 | file { 15 | path => [ "/var/log/upstart/{{ logstash_upstart_name }}.log" ] 16 | tags => ["logstash"] 17 | } 18 | } 19 | 20 | filter { 21 | if "graphite_web" in [tags] { 22 | grok { 23 | match => [ "message", ".* :: (?.*)$" ] 24 | overwrite => [ "message" ] 25 | } 26 | } 27 | 28 | if "carbon_cache" in [tags] { 29 | grok { 30 | match => [ "message", ".* :: \[(?[a-z]*)\] (?.*)\r$" ] 31 | overwrite => [ "message" ] 32 | } 33 | } 34 | } 35 | 36 | output { 37 | redis { 38 | host => "{{ logstash_redis_host }}" 39 | port => "{{ logstash_redis_port }}" 40 | data_type => "channel" 41 | key => "logstash" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ansible/logstash.d/logstash-web-indexer.conf.j2: -------------------------------------------------------------------------------- 1 | input { 2 | redis { 3 | host => "{{ logstash_redis_host }}" 4 | port => "{{ logstash_redis_port }}" 5 | data_type => "channel" 6 | key => "logstash" 7 | } 8 | file { 9 | path => [ "/var/log/syslog" ] 10 | tags => ["syslog"] 11 | } 12 | file { 13 | path => [ "/var/log/upstart/{{ logstash_upstart_name }}.log" ] 14 | tags => ["logstash"] 15 | } 16 | } 17 | 18 | filter { 19 | if "syslog" in [tags] { 20 | grok { 21 | match => [ "message", "^%{SYSLOGBASE}(?.*)" ] 22 | } 23 | } 24 | } 25 | 26 | output { 27 | elasticsearch { embedded => true } 28 | } 29 | -------------------------------------------------------------------------------- /ansible/logstash.d/minecraft-server.conf.j2: -------------------------------------------------------------------------------- 1 | input { 2 | file { 3 | path => [ "{{ minecraft_home }}/*/logs/latest.log" ] 4 | tags => ["minecraft"] 5 | } 6 | file { 7 | path => [ "/var/log/syslog" ] 8 | tags => ["syslog"] 9 | } 10 | file { 11 | path => [ "/var/log/upstart/{{ logstash_upstart_name }}.log" ] 12 | tags => ["logstash"] 13 | } 14 | } 15 | 16 | filter { 17 | if "minecraft" in [tags] { 18 | grok { 19 | match => [ "message", "(?[^|])\|(?[^|]+)\|(?[^|]*)\|(?[^|]*)\|(?[^|]*)\|(?[^|]*)\|(?.*)" ] 20 | overwrite => [ "message" ] 21 | break_on_match => false 22 | } 23 | 24 | grok { 25 | match => [ "message", "^(?[a-zA-Z0-9_]+) joined the game$" ] 26 | add_tag => [ "player", "join" ] 27 | } 28 | 29 | grok { 30 | match => [ "message", "^(?[a-zA-Z0-9_]+) has just earned the achievement \[(?[^\[]+)\]$" ] 31 | add_tag => [ "player", "achievement" ] 32 | } 33 | 34 | grok { 35 | match => [ "message", "^(?[a-zA-Z0-9_]+) left the game$" ] 36 | add_tag => [ "player", "part" ] 37 | } 38 | 39 | grok { 40 | match => [ "message", "^<(?[a-zA-Z0-9_]+)> .*$" ] 41 | add_tag => [ "player", "chat" ] 42 | } 43 | } 44 | } 45 | 46 | output { 47 | redis { 48 | host => "{{ logstash_redis_host }}" 49 | port => "{{ logstash_redis_port }}" 50 | data_type => "channel" 51 | key => "logstash" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /ansible/logstash.d/redis.conf.j2: -------------------------------------------------------------------------------- 1 | input { 2 | file { 3 | path => [ "/var/log/upstart/{{ redis_upstart_name }}.log" ] 4 | tags => ["redis"] 5 | } 6 | file { 7 | path => [ "/var/log/syslog" ] 8 | tags => ["syslog"] 9 | } 10 | file { 11 | path => [ "/var/log/upstart/{{ logstash_upstart_name }}.log" ] 12 | tags => ["logstash"] 13 | } 14 | } 15 | 16 | filter { 17 | if "redis" in [tags] { 18 | grok { 19 | match => [ "message", "^\[(?[0-9]*)\] (?[0-9]* [a-zA-Z]* [0-9:.]*) (?.*)$" ] 20 | overwrite => [ "message" ] 21 | } 22 | } 23 | } 24 | 25 | output { 26 | redis { 27 | host => "{{ logstash_redis_host }}" 28 | port => "{{ logstash_redis_port }}" 29 | data_type => "channel" 30 | key => "logstash" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ansible/logstash.yaml: -------------------------------------------------------------------------------- 1 | - hosts: all 2 | sudo: yes 3 | 4 | vars_files: 5 | - shared-vars.yaml 6 | 7 | roles: 8 | - role: system_user 9 | system_user: "{{ logstash_user }}" 10 | system_user_dirs: 11 | - "{{ logstash_home }}" 12 | - "{{ logstash_conf_dir }}" 13 | 14 | - role: "logstash" 15 | logstash_run_as: root 16 | logstash_conf_template: logstash.d/logstash-web-indexer.conf.j2 17 | - role: riemann-tools 18 | - role: riemann-tools 19 | riemann_tools_cmd: riemann-net 20 | -------------------------------------------------------------------------------- /ansible/minecraft.yaml: -------------------------------------------------------------------------------- 1 | - hosts: all 2 | sudo: yes 3 | 4 | vars_files: 5 | - shared-vars.yaml 6 | 7 | roles: 8 | - role: riemann-tools 9 | - role: riemann-tools 10 | riemann_tools_cmd: riemann-net 11 | - role: minecraft 12 | 13 | - role: logstash 14 | logstash_run_as: root 15 | logstash_conf_template: "logstash.d/minecraft-server.conf.j2" 16 | logstash_opts: agent -f {{ logstash_conf_file }} 17 | 18 | tasks: 19 | - service: name=minecraft-server 20 | state=restarted 21 | 22 | -------------------------------------------------------------------------------- /ansible/redis.yaml: -------------------------------------------------------------------------------- 1 | - hosts: all 2 | sudo: yes 3 | 4 | vars_files: 5 | - shared-vars.yaml 6 | 7 | roles: 8 | - role: riemann-tools 9 | - role: riemann-tools 10 | riemann_tools_cmd: riemann-net 11 | - role: riemann-tools 12 | riemann_tools_cmd: riemann-redis 13 | riemann_tools_options: --redis-host redis 14 | - role: redis 15 | 16 | - role: logstash 17 | logstash_run_as: root 18 | logstash_conf_template: "logstash.d/redis.conf.j2" 19 | logstash_home: "{{ redis_home }}" 20 | -------------------------------------------------------------------------------- /ansible/riemann.yaml: -------------------------------------------------------------------------------- 1 | - hosts: all 2 | sudo: yes 3 | 4 | vars_files: 5 | - shared-vars.yaml 6 | 7 | roles: 8 | - role: riemann-tools 9 | - role: riemann-tools 10 | riemann_tools_cmd: riemann-net 11 | - role: riemann 12 | - role: riemann-dash 13 | -------------------------------------------------------------------------------- /ansible/roles/collectd/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install collectd 3 | apt: pkg=collectd state=latest 4 | 5 | - name: install confs 6 | template: src={{ item }} 7 | dest=/etc/collectd/ 8 | mode=0644 9 | with_items: 10 | - collectd.conf 11 | 12 | - name: restart collectd 13 | service: name=collectd 14 | state=restarted 15 | -------------------------------------------------------------------------------- /ansible/roles/collectd/templates/collectd.conf: -------------------------------------------------------------------------------- 1 | # Config file for collectd(1). 2 | # 3 | # Some plugins need additional configuration and are disabled by default. 4 | # Please read collectd.conf(5) for details. 5 | # 6 | # You should also read /usr/share/doc/collectd-core/README.Debian.plugins 7 | # before enabling any more plugins. 8 | 9 | #Hostname "localhost" 10 | FQDNLookup true 11 | #BaseDir "/var/lib/collectd" 12 | #PluginDir "/usr/lib/collectd" 13 | #TypesDB "/usr/share/collectd/types.db" "/etc/collectd/my_types.db" 14 | #Interval 10 15 | #Timeout 2 16 | #ReadThreads 5 17 | 18 | #LoadPlugin logfile 19 | LoadPlugin syslog 20 | 21 | # 22 | # LogLevel "info" 23 | # File STDOUT 24 | # Timestamp true 25 | # PrintSeverity false 26 | # 27 | 28 | 29 | LogLevel info 30 | 31 | 32 | #LoadPlugin amqp 33 | #LoadPlugin apache 34 | #LoadPlugin apcups 35 | #LoadPlugin ascent 36 | LoadPlugin battery 37 | #LoadPlugin bind 38 | #LoadPlugin conntrack 39 | #LoadPlugin contextswitch 40 | LoadPlugin cpu 41 | #LoadPlugin cpufreq 42 | #LoadPlugin csv 43 | #LoadPlugin curl 44 | #LoadPlugin curl_json 45 | #LoadPlugin curl_xml 46 | #LoadPlugin dbi 47 | LoadPlugin df 48 | LoadPlugin disk 49 | #LoadPlugin dns 50 | #LoadPlugin email 51 | LoadPlugin entropy 52 | #LoadPlugin ethstat 53 | #LoadPlugin exec 54 | #LoadPlugin filecount 55 | #LoadPlugin fscache 56 | #LoadPlugin gmond 57 | #LoadPlugin hddtemp 58 | LoadPlugin interface 59 | #LoadPlugin ipmi 60 | #LoadPlugin iptables 61 | #LoadPlugin ipvs 62 | LoadPlugin irq 63 | #LoadPlugin java 64 | #LoadPlugin libvirt 65 | LoadPlugin load 66 | #LoadPlugin madwifi 67 | #LoadPlugin mbmon 68 | #LoadPlugin md 69 | #LoadPlugin memcachec 70 | #LoadPlugin memcached 71 | LoadPlugin memory 72 | #LoadPlugin multimeter 73 | #LoadPlugin mysql 74 | #LoadPlugin netlink 75 | #LoadPlugin network 76 | #LoadPlugin nfs 77 | #LoadPlugin nginx 78 | #LoadPlugin notify_desktop 79 | #LoadPlugin notify_email 80 | #LoadPlugin ntpd 81 | #LoadPlugin numa 82 | #LoadPlugin nut 83 | #LoadPlugin olsrd 84 | #LoadPlugin openvpn 85 | # 86 | # Globals true 87 | # 88 | #LoadPlugin pinba 89 | #LoadPlugin ping 90 | #LoadPlugin postgresql 91 | #LoadPlugin powerdns 92 | LoadPlugin processes 93 | #LoadPlugin protocols 94 | # 95 | # Globals true 96 | # 97 | #LoadPlugin rrdcached 98 | #LoadPlugin rrdtool 99 | #LoadPlugin sensors 100 | #LoadPlugin serial 101 | #LoadPlugin snmp 102 | LoadPlugin swap 103 | #LoadPlugin table 104 | #LoadPlugin tail 105 | #LoadPlugin tcpconns 106 | #LoadPlugin teamspeak2 107 | #LoadPlugin ted 108 | #LoadPlugin thermal 109 | #LoadPlugin tokyotyrant 110 | #LoadPlugin unixsock 111 | #LoadPlugin uptime 112 | LoadPlugin users 113 | #LoadPlugin uuid 114 | #LoadPlugin varnish 115 | #LoadPlugin vmem 116 | #LoadPlugin vserver 117 | #LoadPlugin wireless 118 | LoadPlugin write_graphite 119 | #LoadPlugin write_http 120 | #LoadPlugin write_mongodb 121 | 122 | # 123 | # 124 | # Host "localhost" 125 | # Port "5672" 126 | # VHost "/" 127 | # User "guest" 128 | # Password "guest" 129 | # Exchange "amq.fanout" 130 | # RoutingKey "collectd" 131 | # Persistent false 132 | # StoreRates false 133 | # 134 | # 135 | 136 | # 137 | # 138 | # URL "http://localhost/server-status?auto" 139 | # User "www-user" 140 | # Password "secret" 141 | # VerifyPeer false 142 | # VerifyHost false 143 | # CACert "/etc/ssl/ca.crt" 144 | # Server "apache" 145 | # 146 | # 147 | # 148 | # URL "http://some.domain.tld/status?auto" 149 | # Host "some.domain.tld" 150 | # Server "lighttpd" 151 | # 152 | # 153 | 154 | # 155 | # Host "localhost" 156 | # Port "3551" 157 | # 158 | 159 | # 160 | # URL "http://localhost/ascent/status/" 161 | # User "www-user" 162 | # Password "secret" 163 | # VerifyPeer false 164 | # VerifyHost false 165 | # CACert "/etc/ssl/ca.crt" 166 | # 167 | 168 | # 169 | # URL "http://localhost:8053/" 170 | # 171 | # ParseTime false 172 | # 173 | # OpCodes true 174 | # QTypes true 175 | # ServerStats true 176 | # ZoneMaintStats true 177 | # ResolverStats false 178 | # MemoryStats true 179 | # 180 | # 181 | # QTypes true 182 | # ResolverStats true 183 | # CacheRRSets true 184 | # 185 | # Zone "127.in-addr.arpa/IN" 186 | # 187 | # 188 | 189 | # 190 | # DataDir "/var/lib/collectd/csv" 191 | # StoreRates false 192 | # 193 | 194 | # 195 | # 196 | # URL "http://finance.google.com/finance?q=NYSE%3AAMD" 197 | # User "foo" 198 | # Password "bar" 199 | # VerifyPeer false 200 | # VerifyHost false 201 | # CACert "/etc/ssl/ca.crt" 202 | # MeasureResponseTime false 203 | # 204 | # Regex "]*> *([0-9]*\\.[0-9]+) *" 205 | # DSType "GaugeAverage" 206 | # Type "stock_value" 207 | # Instance "AMD" 208 | # 209 | # 210 | # 211 | 212 | # 213 | ## See: http://wiki.apache.org/couchdb/Runtime_Statistics 214 | # 215 | # Instance "httpd" 216 | # 217 | # Type "http_requests" 218 | # 219 | # 220 | # 221 | # Type "http_request_methods" 222 | # 223 | # 224 | # 225 | # Type "http_response_codes" 226 | # 227 | # 228 | ## Database status metrics: 229 | # 230 | # Instance "dbs" 231 | # 232 | # Type "gauge" 233 | # 234 | # 235 | # Type "counter" 236 | # 237 | # 238 | # Type "bytes" 239 | # 240 | # 241 | # 242 | 243 | # 244 | # 245 | # Host "my_host" 246 | # Instance "some_instance" 247 | # User "collectd" 248 | # Password "thaiNg0I" 249 | # VerifyPeer true 250 | # VerifyHost true 251 | # CACert "/path/to/ca.crt" 252 | # 253 | # 254 | # Type "magic_level" 255 | # InstancePrefix "prefix-" 256 | # InstanceFrom "td[1]" 257 | # ValuesFrom "td[2]/span[@class=\"level\"]" 258 | # 259 | # 260 | # 261 | 262 | # 263 | # 264 | # Statement "SELECT 'customers' AS c_key, COUNT(*) AS c_value \ 265 | # FROM customers_tbl" 266 | # MinVersion 40102 267 | # MaxVersion 50042 268 | # 269 | # Type "gauge" 270 | # InstancePrefix "customer" 271 | # InstancesFrom "c_key" 272 | # ValuesFrom "c_value" 273 | # 274 | # 275 | # 276 | # 277 | # Driver "mysql" 278 | # DriverOption "host" "localhost" 279 | # DriverOption "username" "collectd" 280 | # DriverOption "password" "secret" 281 | # DriverOption "dbname" "custdb0" 282 | # SelectDB "custdb0" 283 | # Query "num_of_customers" 284 | # Query "..." 285 | # 286 | # 287 | 288 | # 289 | # Device "/dev/sda1" 290 | # Device "192.168.0.2:/mnt/nfs" 291 | # MountPoint "/home" 292 | # FSType "ext3" 293 | # IgnoreSelected false 294 | # ReportByDevice false 295 | # ReportReserved false 296 | # ReportInodes false 297 | # 298 | 299 | # 300 | # Disk "hda" 301 | # Disk "/sda[23]/" 302 | # IgnoreSelected false 303 | # 304 | 305 | # 306 | # Interface "eth0" 307 | # IgnoreSource "192.168.0.1" 308 | # SelectNumericQueryTypes false 309 | # 310 | 311 | # 312 | # SocketFile "/var/run/collectd-email" 313 | # SocketGroup "collectd" 314 | # SocketPerms "0770" 315 | # MaxConns 5 316 | # 317 | 318 | # 319 | # Interface "eth0" 320 | # Map "rx_csum_offload_errors" "if_rx_errors" "checksum_offload" 321 | # Map "multicast" "if_multicast" 322 | # MappedOnly false 323 | # 324 | 325 | # 326 | # Exec user "/path/to/exec" 327 | # Exec "user:group" "/path/to/exec" 328 | # NotificationExec user "/path/to/exec" 329 | # 330 | 331 | # 332 | # 333 | # Instance "foodir" 334 | # Name "*.conf" 335 | # MTime "-5m" 336 | # Size "+10k" 337 | # Recursive true 338 | # IncludeHidden false 339 | # 340 | # 341 | 342 | # 343 | # MCReceiveFrom "239.2.11.71" "8649" 344 | # 345 | # 346 | # Type "swap" 347 | # TypeInstance "total" 348 | # DataSource "value" 349 | # 350 | # 351 | # 352 | # Type "swap" 353 | # TypeInstance "free" 354 | # DataSource "value" 355 | # 356 | # 357 | 358 | # 359 | # Host "127.0.0.1" 360 | # Port 7634 361 | # 362 | 363 | # 364 | # Interface "eth0" 365 | # IgnoreSelected false 366 | # 367 | 368 | # 369 | # Sensor "some_sensor" 370 | # Sensor "another_one" 371 | # IgnoreSelected false 372 | # NotifySensorAdd false 373 | # NotifySensorRemove true 374 | # NotifySensorNotPresent false 375 | # 376 | 377 | # 378 | # Chain "table" "chain" 379 | # 380 | 381 | # 382 | # Irq 7 383 | # Irq 8 384 | # Irq 9 385 | # IgnoreSelected true 386 | # 387 | 388 | # 389 | # JVMArg "-verbose:jni" 390 | # JVMArg "-Djava.class.path=/usr/share/collectd/java/collectd-api.jar" 391 | # 392 | # LoadPlugin "org.collectd.java.GenericJMX" 393 | # 394 | # # See /usr/share/doc/collectd/examples/GenericJMX.conf 395 | # # for an example config. 396 | # 397 | # 398 | 399 | # 400 | # Connection "xen:///" 401 | # RefreshInterval 60 402 | # Domain "name" 403 | # BlockDevice "name:device" 404 | # InterfaceDevice "name:device" 405 | # IgnoreSelected false 406 | # HostnameFormat name 407 | # InterfaceFormat name 408 | # 409 | 410 | # 411 | # Interface "wlan0" 412 | # IgnoreSelected false 413 | # Source "SysFS" 414 | # WatchSet "None" 415 | # WatchAdd "node_octets" 416 | # WatchAdd "node_rssi" 417 | # WatchAdd "is_rx_acl" 418 | # WatchAdd "is_scan_active" 419 | # 420 | 421 | # 422 | # Host "127.0.0.1" 423 | # Port 411 424 | # 425 | 426 | # 427 | # Device "/dev/md0" 428 | # IgnoreSelected false 429 | # 430 | 431 | # 432 | # 433 | # Server "localhost" 434 | # Key "page_key" 435 | # 436 | # Regex "(\\d+) bytes sent" 437 | # ExcludeRegex "" 438 | # DSType CounterAdd 439 | # Type "ipt_octets" 440 | # Instance "type_instance" 441 | # 442 | # 443 | # 444 | 445 | # 446 | # Socket "/var/run/memcached.sock" 447 | # or: 448 | # Host "127.0.0.1" 449 | # Port "11211" 450 | # 451 | 452 | # 453 | # 454 | # Host "database.serv.er" 455 | # Port "3306" 456 | # User "db_user" 457 | # Password "secret" 458 | # Database "db_name" 459 | # MasterStats true 460 | # 461 | # 462 | # 463 | # Host "localhost" 464 | # Socket "/var/run/mysql/mysqld.sock" 465 | # SlaveStats true 466 | # SlaveNotifications true 467 | # 468 | # 469 | 470 | # 471 | # Interface "All" 472 | # VerboseInterface "All" 473 | # QDisc "eth0" "pfifo_fast-1:0" 474 | # Class "ppp0" "htb-1:10" 475 | # Filter "ppp0" "u32-1:0" 476 | # IgnoreSelected false 477 | # 478 | 479 | # 480 | # # client setup: 481 | # Server "ff18::efc0:4a42" "25826" 482 | # 483 | # SecurityLevel Encrypt 484 | # Username "user" 485 | # Password "secret" 486 | # Interface "eth0" 487 | # 488 | # TimeToLive "128" 489 | # 490 | # # server setup: 491 | # Listen "ff18::efc0:4a42" "25826" 492 | # 493 | # SecurityLevel Sign 494 | # AuthFile "/etc/collectd/passwd" 495 | # Interface "eth0" 496 | # 497 | # MaxPacketSize 1024 498 | # 499 | # # proxy setup (client and server as above): 500 | # Forward true 501 | # 502 | # # statistics about the network plugin itself 503 | # ReportStats false 504 | # 505 | # # "garbage collection" 506 | # CacheFlush 1800 507 | # 508 | 509 | # 510 | # URL "http://localhost/status?auto" 511 | # User "www-user" 512 | # Password "secret" 513 | # VerifyPeer false 514 | # VerifyHost false 515 | # CACert "/etc/ssl/ca.crt" 516 | # 517 | 518 | # 519 | # OkayTimeout 1000 520 | # WarningTimeout 5000 521 | # FailureTimeout 0 522 | # 523 | 524 | # 525 | # SMTPServer "localhost" 526 | # SMTPPort 25 527 | # SMTPUser "my-username" 528 | # SMTPPassword "my-password" 529 | # From "collectd@main0server.com" 530 | # # on . 531 | # # Beware! Do not use not more than two placeholders (%)! 532 | # Subject "[collectd] %s on %s!" 533 | # Recipient "email1@domain1.net" 534 | # Recipient "email2@domain2.com" 535 | # 536 | 537 | # 538 | # Host "localhost" 539 | # Port 123 540 | # ReverseLookups false 541 | # 542 | 543 | # 544 | # UPS "upsname@hostname:port" 545 | # 546 | 547 | # 548 | # Host "127.0.0.1" 549 | # Port "2006" 550 | # CollectLinks "Summary" 551 | # CollectRoutes "Summary" 552 | # CollectTopology "Summary" 553 | # 554 | 555 | # 556 | # StatusFile "/etc/openvpn/openvpn-status.log" 557 | # ImprovedNamingSchema false 558 | # CollectCompression true 559 | # CollectIndividualUsers true 560 | # CollectUserCount false 561 | # 562 | 563 | # 564 | # IncludeDir "/my/include/path" 565 | # BaseName "Collectd::Plugins" 566 | # EnableDebugger "" 567 | # LoadPlugin Monitorus 568 | # LoadPlugin OpenVZ 569 | # 570 | # 571 | # Foo "Bar" 572 | # Qux "Baz" 573 | # 574 | # 575 | 576 | # 577 | # Address "::0" 578 | # Port "30002" 579 | # 580 | # Host "host name" 581 | # Server "server name" 582 | # Script "script name" 583 | # 584 | # 585 | 586 | # 587 | # Host "host.foo.bar" 588 | # Host "host.baz.qux" 589 | # Interval 1.0 590 | # Timeout 0.9 591 | # TTL 255 592 | # SourceAddress "1.2.3.4" 593 | # Device "eth0" 594 | # MaxMissed -1 595 | # 596 | 597 | # 598 | # 599 | # Statement "SELECT magic FROM wizard WHERE host = $1;" 600 | # Param hostname 601 | # 602 | # 603 | # Type gauge 604 | # InstancePrefix "magic" 605 | # ValuesFrom "magic" 606 | # 607 | # 608 | # 609 | # 610 | # Statement "SELECT COUNT(type) AS count, type \ 611 | # FROM (SELECT CASE \ 612 | # WHEN resolved = 'epoch' THEN 'open' \ 613 | # ELSE 'resolved' END AS type \ 614 | # FROM tickets) type \ 615 | # GROUP BY type;" 616 | # 617 | # 618 | # Type counter 619 | # InstancePrefix "rt36_tickets" 620 | # InstancesFrom "type" 621 | # ValuesFrom "count" 622 | # 623 | # 624 | # 625 | # 626 | # Host "hostname" 627 | # Port 5432 628 | # User "username" 629 | # Password "secret" 630 | # 631 | # SSLMode "prefer" 632 | # KRBSrvName "kerberos_service_name" 633 | # 634 | # Query magic 635 | # 636 | # 637 | # 638 | # Interval 60 639 | # Service "service_name" 640 | # 641 | # Query backend # predefined 642 | # Query rt36_tickets 643 | # 644 | # 645 | 646 | # 647 | # 648 | # Collect "latency" 649 | # Collect "udp-answers" "udp-queries" 650 | # Socket "/var/run/pdns.controlsocket" 651 | # 652 | # 653 | # Collect "questions" 654 | # Collect "cache-hits" "cache-misses" 655 | # Socket "/var/run/pdns_recursor.controlsocket" 656 | # 657 | # LocalSocket "/opt/collectd/var/run/collectd-powerdns" 658 | # 659 | 660 | # 661 | # Process "name" 662 | # ProcessMatch "foobar" "/usr/bin/perl foobar\\.pl.*" 663 | # 664 | 665 | # 666 | # Value "/^Tcp:/" 667 | # IgnoreSelected false 668 | # 669 | 670 | # 671 | # ModulePath "/path/to/your/python/modules" 672 | # LogTraces true 673 | # Interactive true 674 | # Import "spam" 675 | # 676 | # 677 | # spam "wonderful" "lovely" 678 | # 679 | # 680 | 681 | # 682 | # DaemonAddress "unix:/var/run/rrdcached.sock" 683 | # DataDir "/var/lib/rrdcached/db/collectd" 684 | # CreateFiles true 685 | # CollectStatistics true 686 | # 687 | 688 | # 689 | # DataDir "/var/lib/collectd/rrd" 690 | # CacheTimeout 120 691 | # CacheFlush 900 692 | # WritesPerSecond 30 693 | # RandomTimeout 0 694 | # 695 | # The following settings are rather advanced 696 | # and should usually not be touched: 697 | # StepSize 10 698 | # HeartBeat 20 699 | # RRARows 1200 700 | # RRATimespan 158112000 701 | # XFF 0.1 702 | # 703 | 704 | # 705 | # SensorConfigFile "/etc/sensors3.conf" 706 | # Sensor "it8712-isa-0290/temperature-temp1" 707 | # Sensor "it8712-isa-0290/fanspeed-fan3" 708 | # Sensor "it8712-isa-0290/voltage-in8" 709 | # IgnoreSelected false 710 | # 711 | 712 | # See /usr/share/doc/collectd/examples/snmp-data.conf.gz for a 713 | # comprehensive sample configuration. 714 | # 715 | # 716 | # Type "voltage" 717 | # Table false 718 | # Instance "input_line1" 719 | # Scale 0.1 720 | # Values "SNMPv2-SMI::enterprises.6050.5.4.1.1.2.1" 721 | # 722 | # 723 | # Type "users" 724 | # Table false 725 | # Instance "" 726 | # Shift -1 727 | # Values "HOST-RESOURCES-MIB::hrSystemNumUsers.0" 728 | # 729 | # 730 | # Type "if_octets" 731 | # Table true 732 | # InstancePrefix "traffic" 733 | # Instance "IF-MIB::ifDescr" 734 | # Values "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets" 735 | # 736 | # 737 | # 738 | # Address "192.168.0.2" 739 | # Version 1 740 | # Community "community_string" 741 | # Collect "std_traffic" 742 | # Inverval 120 743 | # 744 | # 745 | # Address "192.168.0.42" 746 | # Version 2 747 | # Community "another_string" 748 | # Collect "std_traffic" "hr_users" 749 | # 750 | # 751 | # Address "192.168.0.3" 752 | # Version 1 753 | # Community "more_communities" 754 | # Collect "powerplus_voltge_input" 755 | # Interval 300 756 | # 757 | # 758 | 759 | # 760 | # ReportByDevice false 761 | # 762 | 763 | # 764 | # 765 | # Instance "slabinfo" 766 | # Separator " " 767 | # 768 | # Type gauge 769 | # InstancePrefix "active_objs" 770 | # InstancesFrom 0 771 | # ValuesFrom 1 772 | # 773 | # 774 | # Type gauge 775 | # InstancePrefix "objperslab" 776 | # InstancesFrom 0 777 | # ValuesFrom 4 778 | # 779 | #
780 | #
781 | 782 | # 783 | # 784 | # Instance "exim" 785 | # 786 | # Regex "S=([1-9][0-9]*)" 787 | # DSType "CounterAdd" 788 | # Type "ipt_bytes" 789 | # Instance "total" 790 | # 791 | # 792 | # Regex "\\" 793 | # ExcludeRegex "\\.*mail_spool defer" 794 | # DSType "CounterInc" 795 | # Type "counter" 796 | # Instance "local_user" 797 | # 798 | # 799 | # 800 | 801 | # 802 | # ListeningPorts false 803 | # LocalPort "25" 804 | # RemotePort "25" 805 | # 806 | 807 | # 808 | # Host "127.0.0.1" 809 | # Port "51234" 810 | # Server "8767" 811 | # 812 | 813 | # 814 | # Device "/dev/ttyUSB0" 815 | # Retries 0 816 | # 817 | 818 | # 819 | # ForceUseProcfs false 820 | # Device "THRM" 821 | # IgnoreSelected false 822 | # 823 | 824 | # 825 | # Host "localhost" 826 | # Port "1978" 827 | # 828 | 829 | # 830 | # SocketFile "/var/run/collectd-unixsock" 831 | # SocketGroup "collectd" 832 | # SocketPerms "0660" 833 | # DeleteSocket false 834 | # 835 | 836 | # 837 | # UUIDFile "/etc/uuid" 838 | # 839 | 840 | # 841 | # 842 | # CollectCache true 843 | # CollectBackend true 844 | # CollectConnections true 845 | # CollectSHM true 846 | # CollectESI false 847 | # CollectFetch false 848 | # CollectHCB false 849 | # CollectSMA false 850 | # CollectSMS false 851 | # CollectSM false 852 | # CollectTotals false 853 | # CollectWorkers false 854 | # 855 | # 856 | # 857 | # CollectCache true 858 | # 859 | # 860 | 861 | # 862 | # Verbose false 863 | # 864 | 865 | 866 | 867 | Host "{{ carbon_host }}" 868 | Port "{{ carbon_port }}" 869 | #Prefix "collectd" 870 | #Postfix "collectd" 871 | Protocol "udp" 872 | StoreRates false 873 | AlwaysAppendDS false 874 | EscapeCharacter "_" 875 | 876 | 877 | 878 | # 879 | # 880 | # User "collectd" 881 | # Password "secret" 882 | # VerifyPeer true 883 | # VerifyHost true 884 | # CACert "/etc/ssl/ca.crt" 885 | # Format "Command" 886 | # StoreRates false 887 | # 888 | # 889 | 890 | # 891 | # 892 | # Host "localhost" 893 | # Port "27017" 894 | # Timeout 1000 895 | # StoreRates false 896 | # 897 | # 898 | 899 | Include "/etc/collectd/filters.conf" 900 | Include "/etc/collectd/thresholds.conf" 901 | 902 | -------------------------------------------------------------------------------- /ansible/roles/collectd/templates/collection.conf: -------------------------------------------------------------------------------- 1 | datadir: "/var/lib/collectd/rrd/" 2 | libdir: "/usr/lib/collectd/" 3 | 4 | -------------------------------------------------------------------------------- /ansible/roles/collectd/templates/filters.conf: -------------------------------------------------------------------------------- 1 | # Filter configuration for collectd(1). 2 | # 3 | # See the section "FILTER CONFIGURATION" in collectd.conf(5) for details. 4 | 5 | #PreCacheChain "PreCache" 6 | #PostCacheChain "PostCache" 7 | 8 | #LoadPlugin match_empty_counter 9 | #LoadPlugin match_hashed 10 | #LoadPlugin match_regex 11 | #LoadPlugin match_timediff 12 | #LoadPlugin match_value 13 | 14 | #LoadPlugin target_notification 15 | #LoadPlugin target_replace 16 | #LoadPlugin target_scale 17 | #LoadPlugin target_set 18 | #LoadPlugin target_v5upgrade 19 | 20 | # 21 | # 22 | # 23 | # Host "^[^\.]*$" 24 | # Invert false 25 | # 26 | # Target "stop" 27 | # 28 | # 29 | 30 | # Default behavior: 31 | # 32 | # Target "write" 33 | # 34 | 35 | -------------------------------------------------------------------------------- /ansible/roles/collectd/templates/thresholds.conf: -------------------------------------------------------------------------------- 1 | # Threshold configuration for collectd(1). 2 | # 3 | # See the section "THRESHOLD CONFIGURATION" in collectd.conf(5) for details. 4 | 5 | #LoadPlugin "threshold" 6 | # 7 | # 8 | # WarningMin 0.00 9 | # WarningMax 1000.00 10 | # FailureMin 0 11 | # FailureMax 1200.00 12 | # Invert false 13 | # Persist false 14 | # Instance "some_instance" 15 | # 16 | # 17 | # 18 | # DataSource "midterm" 19 | # WarningMax 1 20 | # Hysteresis 0.3 21 | # 22 | # 23 | # 24 | # Instance "user" 25 | # WarningMax 85 26 | # Hits 6 27 | # 28 | # 29 | # 30 | # Instance "eth0" 31 | # 32 | # DataSource "rx" 33 | # FailureMax 10000000 34 | # 35 | # 36 | # 37 | # 38 | # 39 | # Instance "idle" 40 | # FailureMin 10 41 | # 42 | # 43 | # 44 | # 45 | # Instance "cached" 46 | # WarningMin 100000000 47 | # 48 | # 49 | # 50 | # 51 | 52 | -------------------------------------------------------------------------------- /ansible/roles/graphite/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | graphite_home: /var/graphite 2 | graphite_user: graphite 3 | graphite_group: graphite 4 | graphite_resources_dir: /opt/graphite 5 | virtualenv_home: "{{ graphite_resources_dir }}/.virtualenvs" 6 | graphite_repos_dir: "{{ graphite_resources_dir }}/repos" 7 | 8 | graphite_virtualenv: "{{virtualenv_home}}/graphite" 9 | graphite_bin: "{{ graphite_virtualenv }}/bin" 10 | graphite_python: "{{ graphite_bin }}/python" 11 | graphite_gunicorn_django: "{{ graphite_virtualenv }}/bin/gunicorn_django" 12 | graphite_storage_location: "{{ graphite_home }}/storage" 13 | graphite_db_name: "graphite_db" 14 | graphite_db_engine: "django.db.backends.sqlite3" 15 | graphite_secret_key: "UNSAFE_DEFAULT" 16 | 17 | # comma separated strings 18 | graphite_memcache_hosts: "'localhost:11211'" 19 | 20 | 21 | graphite_packages: 22 | - graphite-web 23 | - carbon 24 | - ceres 25 | 26 | graphite_version: "master" 27 | 28 | graphite_carbon_conf_files: 29 | - carbon.conf 30 | - storage-schemas.conf 31 | 32 | graphite_web_bind: 0.0.0.0:8000 33 | 34 | carbon_command: "{{ graphite_home }}/bin/carbon-cache.py" 35 | -------------------------------------------------------------------------------- /ansible/roles/graphite/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - role: system_user 4 | system_user: "{{ graphite_user }}" 5 | system_user_dirs: 6 | - "{{ system_user_home }}" 7 | - "{{ graphite_resources_dir }}" 8 | - "{{ graphite_repos_dir }}" 9 | -------------------------------------------------------------------------------- /ansible/roles/graphite/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | - name: system packages 2 | apt: pkg={{ item }} 3 | state=latest 4 | with_items: 5 | - libcairo2-dev 6 | - python-cairo 7 | - python-rrdtool 8 | - memcached 9 | 10 | - name: download graphite packages 11 | git: repo=https://github.com/graphite-project/{{ item }} 12 | version={{ graphite_version }} 13 | dest={{ graphite_repos_dir }}/{{ item }} 14 | depth=1 15 | with_items: graphite_packages 16 | sudo_user: "{{ graphite_user }}" 17 | 18 | - name: workaround for network blocking git:// 19 | command: sed -i -e "s/git+git/git+https/" {{ graphite_repos_dir }}/{{ item }}/requirements.txt 20 | with_items: graphite_packages 21 | sudo_user: "{{ graphite_user }}" 22 | 23 | - name: install graphite deps 24 | pip: requirements={{ graphite_repos_dir }}/{{ item }}/requirements.txt 25 | virtualenv={{ graphite_virtualenv }} 26 | with_items: graphite_packages 27 | sudo_user: "{{ graphite_user }}" 28 | 29 | - name: set install dir 30 | lineinfile: dest={{ graphite_repos_dir }}/{{ item }}/setup.cfg 31 | state=present 32 | regexp=^prefix.* 33 | line=prefix={{ graphite_home }} 34 | backup=yes 35 | when: item != "ceres" 36 | with_items: graphite_packages 37 | sudo_user: "{{ graphite_user }}" 38 | 39 | - name: setup graphite apps 40 | command: chdir={{graphite_repos_dir }}/{{ item }} 41 | {{ graphite_python }} setup.py build install 42 | with_items: graphite_packages 43 | sudo_user: "{{ graphite_user }}" 44 | 45 | - name: copy example confs to main conf 46 | command: chdir={{ graphite_home }}/conf 47 | creates={{ graphite_home }}/conf/{{ item }} 48 | cp {{ item }}.example {{ item }} 49 | with_items: graphite_carbon_conf_files 50 | sudo_user: "{{ graphite_user }}" 51 | 52 | - name: change sqlite storage location 53 | template: src=settings.py.j2 54 | dest={{ graphite_home }}/webapp/graphite/settings.py 55 | mode=0755 56 | sudo_user: "{{ graphite_user }}" 57 | 58 | - name: workaround for change in graphite install 59 | command: cp {{ graphite_repos_dir }}/graphite-web/webapp/manage.py {{ graphite_home }}/webapp/graphite/ 60 | sudo_user: "{{ graphite_user }}" 61 | 62 | - name: setup sqlite 63 | command: chdir={{ graphite_home }}/webapp/graphite 64 | {{ graphite_python }} manage.py syncdb --noinput 65 | environment: 66 | PYTHONPATH: "{{ graphite_home }}/webapp" 67 | sudo_user: "{{ graphite_user }}" 68 | 69 | - name: install carbon-cache server upstart 70 | template: src={{ item }}.conf.j2 71 | dest=/etc/init/{{ item }}.conf 72 | mode=0644 73 | with_items: [ "carbon-cache", "graphite-web" ] 74 | 75 | - name: get graphite running 76 | service: name={{ item }} state=restarted 77 | with_items: [ "carbon-cache", "graphite-web" ] 78 | -------------------------------------------------------------------------------- /ansible/roles/graphite/templates/carbon-cache.conf.j2: -------------------------------------------------------------------------------- 1 | # description "start and stop the minecraft-server" 2 | 3 | console log 4 | 5 | exec start-stop-daemon \ 6 | --chdir {{ graphite_home }} --chuid {{ graphite_user }}:{{ graphite_group }} \ 7 | --user {{ graphite_user}} --pidfile /var/graphite/carbon-cache.pid \ 8 | --exec {{ carbon_command }} --start -- --pidfile=/var/graphite/carbon-cache.pid --logdir=/var/graphite --nodaemon start 9 | 10 | start on runlevel [2345] 11 | stop on runlevel [^2345] 12 | 13 | respawn 14 | respawn limit 20 5 15 | -------------------------------------------------------------------------------- /ansible/roles/graphite/templates/graphite-web.conf.j2: -------------------------------------------------------------------------------- 1 | # description "start and stop the minecraft-server" 2 | 3 | console log 4 | 5 | exec start-stop-daemon \ 6 | --chdir {{ graphite_home }}/webapp/graphite --chuid {{ graphite_user }}:{{ graphite_group }} \ 7 | --user {{ graphite_user }} \ 8 | --exec {{ graphite_gunicorn_django }} --start -- --bind={{ graphite_web_bind }} 9 | 10 | start on runlevel [2345] 11 | stop on runlevel [^2345] 12 | 13 | respawn 14 | respawn limit 20 5 15 | -------------------------------------------------------------------------------- /ansible/roles/graphite/templates/settings.py.j2: -------------------------------------------------------------------------------- 1 | """Copyright 2008 Orbitz WorldWide 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License.""" 14 | # Django settings for graphite project. 15 | # DO NOT MODIFY THIS FILE DIRECTLY - use local_settings.py instead 16 | import sys, os 17 | from django import VERSION as DJANGO_VERSION 18 | from os.path import abspath, dirname, join 19 | from warnings import warn 20 | 21 | 22 | GRAPHITE_WEB_APP_SETTINGS_LOADED = False 23 | WEBAPP_VERSION = '0.10.0-alpha' 24 | DEBUG = False 25 | JAVASCRIPT_DEBUG = False 26 | 27 | # Filesystem layout 28 | WEB_DIR = dirname( abspath(__file__) ) 29 | WEBAPP_DIR = dirname(WEB_DIR) 30 | GRAPHITE_ROOT = dirname(WEBAPP_DIR) 31 | # Initialize additional path variables 32 | # Defaults for these are set after local_settings is imported 33 | CONTENT_DIR = '' 34 | CSS_DIR = '' 35 | CONF_DIR = '' 36 | DASHBOARD_CONF = '' 37 | GRAPHTEMPLATES_CONF = '' 38 | STORAGE_DIR = '' 39 | WHITELIST_FILE = '' 40 | INDEX_FILE = '' 41 | LOG_DIR = '' 42 | CERES_DIR = '' 43 | WHISPER_DIR = '' 44 | RRD_DIR = '' 45 | STANDARD_DIRS = [] 46 | 47 | CLUSTER_SERVERS = [] 48 | 49 | sys.path.insert(0, WEBAPP_DIR) 50 | 51 | # Cluster settings 52 | CLUSTER_SERVERS = [] 53 | REMOTE_FIND_TIMEOUT = 3.0 54 | REMOTE_FETCH_TIMEOUT = 6.0 55 | REMOTE_RETRY_DELAY = 60.0 56 | REMOTE_READER_CACHE_SIZE_LIMIT = 1000 57 | CARBONLINK_HOSTS = ["127.0.0.1:7002"] 58 | CARBONLINK_TIMEOUT = 1.0 59 | CARBONLINK_HASHING_KEYFUNC = None 60 | CARBONLINK_RETRY_DELAY = 15 61 | REPLICATION_FACTOR = 1 62 | MEMCACHE_HOSTS = [{{ graphite_memcache_hosts }}] 63 | FIND_CACHE_DURATION = 300 64 | FIND_TOLERANCE = 2 * FIND_CACHE_DURATION 65 | DEFAULT_CACHE_DURATION = 60 #metric data and graphs are cached for one minute by default 66 | LOG_CACHE_PERFORMANCE = False 67 | 68 | #Remote rendering settings 69 | REMOTE_RENDERING = False #if True, rendering is delegated to RENDERING_HOSTS 70 | RENDERING_HOSTS = [] 71 | REMOTE_RENDER_CONNECT_TIMEOUT = 1.0 72 | LOG_RENDERING_PERFORMANCE = False 73 | 74 | #Miscellaneous settings 75 | SMTP_SERVER = "localhost" 76 | DOCUMENTATION_URL = "http://graphite.readthedocs.org/" 77 | ALLOW_ANONYMOUS_CLI = True 78 | LOG_METRIC_ACCESS = False 79 | LEGEND_MAX_ITEMS = 10 80 | RRD_CF = 'AVERAGE' 81 | 82 | #Authentication settings 83 | USE_LDAP_AUTH = False 84 | LDAP_SERVER = "" # "ldapserver.mydomain.com" 85 | LDAP_PORT = 389 86 | LDAP_USE_TLS = False 87 | LDAP_SEARCH_BASE = "" # "OU=users,DC=mydomain,DC=com" 88 | LDAP_BASE_USER = "" # "CN=some_readonly_account,DC=mydomain,DC=com" 89 | LDAP_BASE_PASS = "" # "my_password" 90 | LDAP_USER_QUERY = "" # "(username=%s)" For Active Directory use "(sAMAccountName=%s)" 91 | LDAP_URI = None 92 | 93 | #Set this to True to delegate authentication to the web server 94 | USE_REMOTE_USER_AUTHENTICATION = False 95 | 96 | # Django 1.5 requires this so we set a default but warn the user 97 | SECRET_KEY = '{{ graphite_secret_key }}' 98 | 99 | # Django 1.5 requires this to be set. Here we default to prior behavior and allow all 100 | ALLOWED_HOSTS = [ '*' ] 101 | 102 | # Override to link a different URL for login (e.g. for django_openid_auth) 103 | LOGIN_URL = '/account/login' 104 | 105 | # Set to True to require authentication to save or delete dashboards 106 | DASHBOARD_REQUIRE_AUTHENTICATION = False 107 | # Require Django change/delete permissions to save or delete dashboards. 108 | # NOTE: Requires DASHBOARD_REQUIRE_AUTHENTICATION to be set 109 | DASHBOARD_REQUIRE_PERMISSIONS = False 110 | # Name of a group to which the user must belong to save or delete dashboards. Alternative to 111 | # DASHBOARD_REQUIRE_PERMISSIONS, particularly useful when using only LDAP (without Admin app) 112 | # NOTE: Requires DASHBOARD_REQUIRE_AUTHENTICATION to be set 113 | DASHBOARD_REQUIRE_EDIT_GROUP = None 114 | 115 | if DJANGO_VERSION < (1,4): 116 | #Initialize database settings - Old style (pre 1.2) 117 | DATABASE_ENGINE = '{{ graphite_db_engine }}' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. 118 | DATABASE_NAME = '' # Or path to database file if using sqlite3. 119 | DATABASE_USER = '' # Not used with sqlite3. 120 | DATABASE_PASSWORD = '' # Not used with sqlite3. 121 | DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. 122 | DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. 123 | else: 124 | DATABASES = { 125 | 'default': { 126 | 'NAME': '{{ graphite_storage_location}}/{{ graphite_db_name }}', 127 | 'ENGINE': '{{ graphite_db_engine }}', 128 | 'USER': '', 129 | 'PASSWORD': '', 130 | 'HOST': '', 131 | 'PORT': '' 132 | } 133 | } 134 | 135 | # If using rrdcached, set to the address or socket of the daemon 136 | FLUSHRRDCACHED = '' 137 | 138 | ## Load our local_settings 139 | try: 140 | from graphite.local_settings import * 141 | except ImportError: 142 | print >> sys.stderr, "Could not import graphite.local_settings, using defaults!" 143 | 144 | ## Load Django settings if they werent picked up in local_settings 145 | if not GRAPHITE_WEB_APP_SETTINGS_LOADED: 146 | from graphite.app_settings import * 147 | 148 | ## Set config dependent on flags set in local_settings 149 | # Path configuration 150 | if not CONTENT_DIR: 151 | CONTENT_DIR = join(WEBAPP_DIR, 'content') 152 | if not CSS_DIR: 153 | CSS_DIR = join(CONTENT_DIR, 'css') 154 | 155 | if not CONF_DIR: 156 | CONF_DIR = os.environ.get('GRAPHITE_CONF_DIR', join(GRAPHITE_ROOT, 'conf')) 157 | if not DASHBOARD_CONF: 158 | DASHBOARD_CONF = join(CONF_DIR, 'dashboard.conf') 159 | if not GRAPHTEMPLATES_CONF: 160 | GRAPHTEMPLATES_CONF = join(CONF_DIR, 'graphTemplates.conf') 161 | 162 | if not STORAGE_DIR: 163 | STORAGE_DIR = os.environ.get('GRAPHITE_STORAGE_DIR', join(GRAPHITE_ROOT, 'storage')) 164 | if not WHITELIST_FILE: 165 | WHITELIST_FILE = join(STORAGE_DIR, 'lists', 'whitelist') 166 | if not INDEX_FILE: 167 | INDEX_FILE = join(STORAGE_DIR, 'index') 168 | if not LOG_DIR: 169 | LOG_DIR = join(STORAGE_DIR, 'log', 'webapp') 170 | if not WHISPER_DIR: 171 | WHISPER_DIR = join(STORAGE_DIR, 'whisper/') 172 | if not CERES_DIR: 173 | CERES_DIR = join(STORAGE_DIR, 'ceres/') 174 | if not RRD_DIR: 175 | RRD_DIR = join(STORAGE_DIR, 'rrd/') 176 | if not STANDARD_DIRS: 177 | try: 178 | import whisper 179 | if os.path.exists(WHISPER_DIR): 180 | STANDARD_DIRS.append(WHISPER_DIR) 181 | except ImportError: 182 | print >> sys.stderr, "WARNING: whisper module could not be loaded, whisper support disabled" 183 | try: 184 | import rrdtool 185 | if os.path.exists(RRD_DIR): 186 | STANDARD_DIRS.append(RRD_DIR) 187 | except ImportError: 188 | pass 189 | 190 | # Default sqlite db file 191 | # This is set here so that a user-set STORAGE_DIR is available 192 | if DJANGO_VERSION < (1,4): 193 | if 'sqlite3' in DATABASE_ENGINE \ 194 | and not DATABASE_NAME: 195 | DATABASE_NAME = join(STORAGE_DIR, 'graphite.db') 196 | else: 197 | if 'sqlite3' in DATABASES.get('default',{}).get('ENGINE','') \ 198 | and not DATABASES.get('default',{}).get('NAME'): 199 | DATABASES['default']['NAME'] = join(STORAGE_DIR, 'graphite.db') 200 | 201 | # Caching shortcuts 202 | if MEMCACHE_HOSTS: 203 | CACHE_BACKEND = 'memcached://' + ';'.join(MEMCACHE_HOSTS) + ('/?timeout=%d' % DEFAULT_CACHE_DURATION) 204 | 205 | # Authentication shortcuts 206 | if USE_LDAP_AUTH and LDAP_URI is None: 207 | LDAP_URI = "ldap://%s:%d/" % (LDAP_SERVER, LDAP_PORT) 208 | 209 | if USE_REMOTE_USER_AUTHENTICATION: 210 | MIDDLEWARE_CLASSES += ('django.contrib.auth.middleware.RemoteUserMiddleware',) 211 | AUTHENTICATION_BACKENDS.insert(0,'django.contrib.auth.backends.RemoteUserBackend') 212 | 213 | if USE_LDAP_AUTH: 214 | AUTHENTICATION_BACKENDS.insert(0,'graphite.account.ldapBackend.LDAPBackend') 215 | 216 | if SECRET_KEY == 'UNSAFE_DEFAULT': 217 | warn('SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security') 218 | -------------------------------------------------------------------------------- /ansible/roles/logstash/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | logstash_jar: logstash-1.3.2-flatjar.jar 2 | logstash_lib_dir: /opt/logstash 3 | logstash_home: /var/logstash 4 | logstash_conf_dir: /etc/logstash.d 5 | logstash_user: logstash 6 | logstash_group: logstash 7 | 8 | logstash_run_as: "{{ logstash_user }}" 9 | logstash_run_as_group: "{{ logstash_group }}" 10 | logstash_run_dir: /var/logstash 11 | 12 | logstash_java_opts: "" 13 | logstash_upstart_name: logstash 14 | logstash_conf_template: "" 15 | logstash_conf_file: "{{ logstash_conf_dir }}/{{ logstash_upstart_name }}.conf" 16 | 17 | logstash_opts: "agent -f {{ logstash_conf_file }} -- web" 18 | -------------------------------------------------------------------------------- /ansible/roles/logstash/files/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeroem/monitorcraft/c32c64958ad348a6adc6d7222bc526a6c0da9c90/ansible/roles/logstash/files/.gitkeep -------------------------------------------------------------------------------- /ansible/roles/logstash/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | allow_duplicates: yes 3 | dependencies: 4 | - role: system_user 5 | system_user: "{{ logstash_user }}" 6 | system_user_dirs: 7 | - "{{ logstash_lib_dir }}" 8 | - "{{ logstash_conf_dir }}" 9 | -------------------------------------------------------------------------------- /ansible/roles/logstash/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | - name: Get Logstash jar 2 | copy: src={{ logstash_jar }} 3 | dest={{ logstash_lib_dir }}/logstash-flat.jar 4 | owner={{ logstash_user }} 5 | group={{ logstash_group }} 6 | mode=0555 7 | 8 | - name: Install logstash Conf 9 | template: src={{ logstash_conf_template }} 10 | dest={{ logstash_conf_file }} 11 | owner={{ logstash_user }} 12 | group={{ logstash_group }} 13 | mode=0664 14 | when: logstash_conf_template != "" 15 | 16 | - name: install logstash into upstart 17 | template: src=logstash.conf.j2 18 | dest=/etc/init/{{ logstash_upstart_name }}.conf 19 | mode=0664 20 | 21 | - name: Start up logstash 22 | service: name={{ logstash_upstart_name }} 23 | state=restarted 24 | 25 | -------------------------------------------------------------------------------- /ansible/roles/logstash/templates/logstash.conf.j2: -------------------------------------------------------------------------------- 1 | description "logstash: {{ logstash_upstart_name }}" 2 | 3 | start on virtual-filesystems 4 | stop on runlevel [06] 5 | 6 | respawn 7 | respawn limit 5 30 8 | limit nofile 65550 65550 9 | 10 | # set HOME to point to where you want the embedded elasticsearch 11 | # data directory to be created and ensure /opt/logstash is owned 12 | # by logstash:adm 13 | 14 | env HOME={{ logstash_home }} 15 | 16 | #env JAVA_OPTS='-Xms512m -Xmx512m' 17 | 18 | chdir {{ logstash_run_dir }} 19 | setuid {{ logstash_run_as }} 20 | setgid {{ logstash_run_as_group }} 21 | emits {{ logstash_upstart_name }}-running 22 | console log 23 | 24 | # for versions 1.1.1 - 1.1.4 the internal web service crashes when touched 25 | # and the current workaround is to just not run it and run Kibana instead 26 | 27 | script 28 | exec java {{ logstash_java_opts }} \ 29 | -jar {{ logstash_lib_dir}}/logstash-flat.jar {{ logstash_opts }} 30 | 31 | initctl --no-wait emit {{ logstash_upstart_name }}-running 32 | end script 33 | -------------------------------------------------------------------------------- /ansible/roles/minecraft/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | minecraft_binary: minecraft_server.1.7.4.jar 2 | minecraft_bin_dir: /opt/lib/minecraft 3 | minecraft_home: /var/minecraft 4 | minecraft_user: minecraft 5 | minecraft_group: minecraft 6 | 7 | minecraft_java_opts: "-Xms1G -Xmx2G" 8 | minecraft_logging_opts: "-Dlog4j.configurationFile={{ minecraft_bin_dir }}/log4j2.xml" 9 | 10 | minecraft_server_name: "server" 11 | minecraft_server_home: "{{ minecraft_home }}/{{ minecraft_server_name }}" 12 | 13 | minecraft_server_confs_dir: "confs" 14 | minecraft_server_confs: 15 | - banned-ips.txt 16 | - banned-players.txt 17 | - ops.txt 18 | - server.properties 19 | - white-list.txt 20 | 21 | -------------------------------------------------------------------------------- /ansible/roles/minecraft/files/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeroem/monitorcraft/c32c64958ad348a6adc6d7222bc526a6c0da9c90/ansible/roles/minecraft/files/.gitkeep -------------------------------------------------------------------------------- /ansible/roles/minecraft/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | allow_duplicates: yes 3 | dependencies: 4 | - role: system_user 5 | system_user: "{{ minecraft_user }}" 6 | system_user_dirs: 7 | - "{{ minecraft_bin_dir }}" 8 | - "{{ minecraft_home }}" 9 | -------------------------------------------------------------------------------- /ansible/roles/minecraft/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | - name: Get Minecraft Server jar 2 | copy: src={{ minecraft_binary }} 3 | dest={{ minecraft_bin_dir }}/minecraft-server.jar 4 | owner={{ minecraft_user }} 5 | group={{ minecraft_group }} 6 | mode=0555 7 | 8 | - name: server directory 9 | file: dest={{ minecraft_server_home }} 10 | state=directory 11 | owner={{ minecraft_user }} 12 | group={{ minecraft_group }} 13 | mode=0755 14 | 15 | - name: install confs 16 | template: src={{ minecraft_server_confs_dir }}/{{ item }}.j2 17 | dest={{ minecraft_server_home }}/{{ item }} 18 | owner={{ minecraft_user }} 19 | group={{ minecraft_group }} 20 | mode=0644 21 | with_items: minecraft_server_confs 22 | 23 | - name: Setup Log4j 24 | template: src=log4j2.xml.j2 25 | dest={{ minecraft_bin_dir}}/log4j2.xml 26 | owner={{ minecraft_user }} 27 | group={{ minecraft_group }} 28 | mode=0444 29 | 30 | - name: install minecraft server upstart 31 | template: src=minecraft-server.conf.j2 32 | dest=/etc/init/minecraft-{{ minecraft_server_name }}.conf 33 | mode=0644 34 | 35 | -------------------------------------------------------------------------------- /ansible/roles/minecraft/templates/confs/banned-ips.txt.j2: -------------------------------------------------------------------------------- 1 | # victim name | ban date | banned by | banned until | reason 2 | 3 | -------------------------------------------------------------------------------- /ansible/roles/minecraft/templates/confs/banned-players.txt.j2: -------------------------------------------------------------------------------- 1 | # victim name | ban date | banned by | banned until | reason 2 | 3 | -------------------------------------------------------------------------------- /ansible/roles/minecraft/templates/confs/ops.txt.j2: -------------------------------------------------------------------------------- 1 | {%- for player in minecraft_server_ops | default([]) %} 2 | {{ player }} 3 | {%- endfor %} 4 | -------------------------------------------------------------------------------- /ansible/roles/minecraft/templates/confs/server.properties.j2: -------------------------------------------------------------------------------- 1 | #Minecraft server properties 2 | #Tue Dec 31 21:50:02 UTC 2013 3 | generator-settings= 4 | op-permission-level=4 5 | allow-nether=true 6 | level-name=world 7 | enable-query=false 8 | allow-flight=false 9 | announce-player-achievements=true 10 | server-port={{ minecraft_server_port | default(25565)}} 11 | level-type=DEFAULT 12 | enable-rcon=false 13 | level-seed={{ minecraft_server_level_seed | default('') }} 14 | force-gamemode=false 15 | server-ip= 16 | max-build-height=256 17 | spawn-npcs=true 18 | white-list=false 19 | spawn-animals=true 20 | hardcore=false 21 | snooper-enabled=true 22 | online-mode=true 23 | resource-pack= 24 | pvp=true 25 | difficulty=1 26 | enable-command-block=false 27 | gamemode=0 28 | player-idle-timeout=0 29 | max-players=20 30 | spawn-monsters=true 31 | generate-structures=true 32 | view-distance=10 33 | motd={{ minecraft_server_modtd | default('A Minecraft Server') }} 34 | -------------------------------------------------------------------------------- /ansible/roles/minecraft/templates/confs/white-list.txt.j2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeroem/monitorcraft/c32c64958ad348a6adc6d7222bc526a6c0da9c90/ansible/roles/minecraft/templates/confs/white-list.txt.j2 -------------------------------------------------------------------------------- /ansible/roles/minecraft/templates/log4j2.xml.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /ansible/roles/minecraft/templates/minecraft-server.conf.j2: -------------------------------------------------------------------------------- 1 | # minecraft server 2 | # 3 | 4 | description "minecraft server: {{ minecraft_server_name }}" 5 | 6 | start on virtual-filesystems 7 | stop on runlevel [06] 8 | 9 | respawn 10 | respawn limit 5 30 11 | 12 | env HOME={{ minecraft_home }}/{{ minecraft_server_name }} 13 | 14 | chdir {{ minecraft_home }}/{{ minecraft_server_name }} 15 | setuid {{ minecraft_user }} 16 | setgid {{ minecraft_group }} 17 | console log 18 | 19 | # for versions 1.1.1 - 1.1.4 the internal web service crashes when touched 20 | # and the current workaround is to just not run it and run Kibana instead 21 | 22 | script 23 | exec java {{ minecraft_java_opts }} {{ minecraft_logging_opts }} \ 24 | -jar {{ minecraft_bin_dir }}/minecraft-server.jar nogui 25 | end script 26 | -------------------------------------------------------------------------------- /ansible/roles/redis/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | redis_extracted_dir: redis-2.8.3 2 | redis_binary: "{{ redis_extracted_dir }}.tar.gz" 3 | redis_bin_dir: /opt/redis 4 | redis_src_dir: "{{ redis_bin_dir }}/{{ redis_extracted_dir }}" 5 | redis_home: /var/redis 6 | redis_conf_dir: /etc/redis.d 7 | redis_user: redis 8 | redis_group: redis 9 | 10 | redis_upstart_name: redis 11 | redis_conf_template: redis-server.conf.j2 12 | redis_conf_file: "{{ redis_home }}/{{ redis_upstart_name }}.conf" 13 | -------------------------------------------------------------------------------- /ansible/roles/redis/files/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeroem/monitorcraft/c32c64958ad348a6adc6d7222bc526a6c0da9c90/ansible/roles/redis/files/.gitkeep -------------------------------------------------------------------------------- /ansible/roles/redis/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | allow_duplicates: yes 3 | dependencies: 4 | - role: system_user 5 | system_user: "{{ redis_user }}" 6 | system_user_dirs: 7 | - "{{ redis_bin_dir }}" 8 | - "{{ redis_home }}" 9 | - "{{ redis_conf_dir }}" 10 | -------------------------------------------------------------------------------- /ansible/roles/redis/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | - name: Get redis tarball 2 | copy: src={{ redis_binary }} 3 | dest={{ redis_bin_dir }}/ 4 | owner={{ redis_user }} 5 | group={{ redis_group }} 6 | mode=0555 7 | 8 | - name: untar the source 9 | command: chdir={{ redis_bin_dir }} 10 | creates={{ redis_extracted_dir }} 11 | tar -xzf {{ redis_bin_dir}}/{{ redis_binary }} 12 | 13 | - name: perms 14 | file: path={{ redis_src_dir }} 15 | state=directory 16 | group={{ redis_group }} 17 | owner={{ redis_user }} 18 | recurse=yes 19 | 20 | - name: Make! 21 | command: chdir={{ redis_src_dir }} 22 | creates={{redis_src_dir }}/src/redis-server 23 | make 24 | 25 | - name: Redis conf file 26 | template: src={{ redis_conf_template }} 27 | dest={{ redis_conf_file }} 28 | mode=0644 29 | 30 | - name: install redis into upstart 31 | template: src=redis.conf.j2 32 | dest=/etc/init/{{ redis_upstart_name }}.conf 33 | mode=0664 34 | 35 | - name: Start up redis 36 | service: name={{ redis_upstart_name }} 37 | state=started 38 | 39 | -------------------------------------------------------------------------------- /ansible/roles/redis/templates/redis-server.conf.j2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeroem/monitorcraft/c32c64958ad348a6adc6d7222bc526a6c0da9c90/ansible/roles/redis/templates/redis-server.conf.j2 -------------------------------------------------------------------------------- /ansible/roles/redis/templates/redis.conf.j2: -------------------------------------------------------------------------------- 1 | # description "start and stop the redis-server" 2 | 3 | console log 4 | 5 | exec start-stop-daemon --start --chdir {{ redis_home }} --chuid {{ redis_user }} \ 6 | --user {{ redis_user }} --exec {{ redis_src_dir}}/src/redis-server {{ redis_conf_file }} 2>&1 7 | 8 | start on runlevel [2345] 9 | stop on runlevel [^2345] 10 | 11 | respawn 12 | respawn limit 20 5 13 | -------------------------------------------------------------------------------- /ansible/roles/riemann-dash/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | riemann_dash_config: "" 3 | riemann_dash_config_dir: /etc/riemann-dash 4 | riemann_dash_home: /var/riemann-dash 5 | -------------------------------------------------------------------------------- /ansible/roles/riemann-dash/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install Ruby 3 | apt: pkg={{ item }} 4 | state=latest 5 | with_items: 6 | - ruby 7 | - ruby-dev 8 | 9 | - name: Install Riemann Dash 10 | gem: name=riemann-dash 11 | state=latest 12 | user_install=no 13 | 14 | - name: Setup riemann-dash run dir 15 | file: path={{ item }} 16 | state=directory 17 | mode=0775 18 | owner=riemann 19 | group=riemann 20 | with_items: 21 | - "{{ riemann_dash_home }}" 22 | - "{{ riemann_dash_config_dir }}" 23 | 24 | - name: install riemann-dash confs 25 | template: src=config.rb.j2 26 | dest={{ riemann_dash_home }}/config.rb 27 | owner=riemann 28 | group=riemann 29 | mode=0664 30 | 31 | - name: install upstart confs 32 | template: src={{ item }} 33 | dest=/etc/init/riemann-dash.conf 34 | mode=0644 35 | with_items: 36 | - riemann-dash.conf.j2 37 | 38 | - name: restart riemann-dash 39 | service: name=riemann-dash 40 | state=restarted 41 | -------------------------------------------------------------------------------- /ansible/roles/riemann-dash/templates/config.rb.j2: -------------------------------------------------------------------------------- 1 | set :bind, "0.0.0.0" 2 | -------------------------------------------------------------------------------- /ansible/roles/riemann-dash/templates/riemann-dash.conf.j2: -------------------------------------------------------------------------------- 1 | description "riemann dashboard" 2 | 3 | start on virtual-filesystems 4 | stop on runlevel [06] 5 | 6 | respawn 7 | respawn limit 5 30 8 | limit nofile 65550 65550 9 | 10 | # set HOME to point to where you want the embedded elasticsearch 11 | # data directory to be created and ensure /opt/logstash is owned 12 | # by logstash:adm 13 | 14 | env HOME={{ riemann_dash_home }} 15 | 16 | chdir {{ riemann_dash_home }} 17 | setuid riemann 18 | setgid riemann 19 | emits riemann-dash-running 20 | console log 21 | 22 | # for versions 1.1.1 - 1.1.4 the internal web service crashes when touched 23 | # and the current workaround is to just not run it and run Kibana instead 24 | 25 | script 26 | exec riemann-dash {{ riemann_dash_config }} 27 | initctl --no-wait emit riemann-dash-running 28 | end script 29 | -------------------------------------------------------------------------------- /ansible/roles/riemann-tools/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | riemann_tools_user: "riemann" 3 | riemann_tools_cmd: "riemann-health" 4 | riemann_tools_options: "" 5 | riemann_tools_upstart_template: "riemann-tools.conf.j2" 6 | riemann_tools_upstart_name: "{{ riemann_tools_cmd }}" 7 | riemann_tools_dest_host: "{{ riemann_host }}" 8 | riemann_tools_dest_port: "{{ riemann_port }}" 9 | -------------------------------------------------------------------------------- /ansible/roles/riemann-tools/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | allow_duplicates: yes 3 | dependencies: 4 | - role: system_user 5 | system_user: "{{ riemann_tools_user }}" 6 | -------------------------------------------------------------------------------- /ansible/roles/riemann-tools/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: install gem 3 | gem: > 4 | name=riemann-tools 5 | state=latest 6 | 7 | - name: install confs 8 | template: > 9 | src={{ riemann_tools_upstart_template }} 10 | dest=/etc/init/{{ riemann_tools_upstart_name }}.conf 11 | mode=0644 12 | 13 | - name: "start {{ riemann_tools_upstart_name }}" 14 | service: name={{ riemann_tools_upstart_name }} 15 | state=restarted 16 | enabled=yes 17 | -------------------------------------------------------------------------------- /ansible/roles/riemann-tools/templates/riemann-tools.conf.j2: -------------------------------------------------------------------------------- 1 | description "riemann_tools: {{ riemann_tools_upstart_name }}" 2 | 3 | start on virtual-filesystems 4 | stop on runlevel [06] 5 | 6 | respawn 7 | respawn limit 5 30 8 | limit nofile 65550 65550 9 | 10 | setuid {{ riemann_tools_user }} 11 | setgid {{ riemann_tools_user }} 12 | 13 | emits {{ riemann_tools_upstart_name }}-running 14 | console log 15 | 16 | script 17 | exec {{ riemann_tools_cmd }} --host "{{ riemann_tools_dest_host }}" --port {{ riemann_tools_dest_port }} {{ riemann_tools_options }} 18 | 19 | initctl --no-wait emit {{ riemann_tools_upstart_name }}-running 20 | end script 21 | -------------------------------------------------------------------------------- /ansible/roles/riemann/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | riemann_config: riemann.config.j2 2 | -------------------------------------------------------------------------------- /ansible/roles/riemann/files/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeroem/monitorcraft/c32c64958ad348a6adc6d7222bc526a6c0da9c90/ansible/roles/riemann/files/.gitkeep -------------------------------------------------------------------------------- /ansible/roles/riemann/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install Riemann 3 | command: dpkg -i /vagrant/ansible/roles/riemann/files/riemann_0.2.4_all.deb 4 | 5 | - name: install confs 6 | template: src={{ riemann_config }} 7 | dest=/etc/riemann/riemann.config 8 | mode=0644 9 | 10 | - name: restart riemann 11 | service: name=riemann 12 | state=reloaded 13 | enabled=yes 14 | -------------------------------------------------------------------------------- /ansible/roles/riemann/templates/riemann-graphite-relay.config.j2: -------------------------------------------------------------------------------- 1 | ; -*- mode: clojure; -*- 2 | ; vim: filetype=clojure 3 | 4 | (logging/init :file "/var/log/riemann/riemann.log") 5 | 6 | ; Listen on the local interface over TCP (5555), UDP (5555), and websockets 7 | ; (5556) 8 | (let [host "{{ carbon_relay_host }}"] 9 | (tcp-server :host host) 10 | (udp-server :host host) 11 | (ws-server :host host) 12 | (graphite-server :host host :port {{ carbon_relay_port }})) 13 | 14 | (def riemann-indexer (tcp-client :host "{{ metrics_collection_host }}" :port {{ metrics_collection_port }})) 15 | 16 | ; Inbound events will be passed to these streams: 17 | (streams 18 | (forward riemann-indexer)) 19 | -------------------------------------------------------------------------------- /ansible/roles/riemann/templates/riemann.config.j2: -------------------------------------------------------------------------------- 1 | ; -*- mode: clojure; -*- 2 | ; vim: filetype=clojure 3 | 4 | (logging/init :file "/var/log/riemann/riemann.log") 5 | 6 | ; Listen on the local interface over TCP (5555), UDP (5555), and websockets 7 | ; (5556) 8 | (let [host "0.0.0.0"] 9 | (tcp-server :host host) 10 | (udp-server :host host) 11 | (ws-server :host host) 12 | (graphite-server :host host :port {{ carbon_relay_port }})) 13 | 14 | 15 | (def graph (graphite {:host "{{ carbon_host }}" :port {{ carbon_port }}})) 16 | 17 | ; Expire old events from the index every 5 seconds. 18 | (periodically-expire 5) 19 | 20 | ; Keep events in the index for 5 minutes by default. 21 | (let [index (default :ttl 300 (update-index (index)))] 22 | 23 | ; Inbound events will be passed to these streams: 24 | (streams 25 | ; log everything to graphite for midterm storage 26 | graph 27 | 28 | ; Index all events immediately. 29 | index 30 | 31 | ; Calculate an overall rate of events. 32 | (with {:metric 1 :host nil :state "ok" :service "events/sec"} 33 | (rate 5 index)) 34 | 35 | ; Log expired events. 36 | (expired 37 | (fn [event] (info "expired" event))) 38 | )) 39 | -------------------------------------------------------------------------------- /ansible/roles/statsd/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | statsd_user: statsd 2 | statsd_group: "{{ statsd_user }}" 3 | statsd_home: "/var/{{ statsd_user }}" 4 | statsd_port: 8125 5 | 6 | statsd_repo: https://github.com/etsy/statsd 7 | statsd_version: 'v0.6.0' 8 | statsd_lib_dir: /opt/ 9 | 10 | -------------------------------------------------------------------------------- /ansible/roles/statsd/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | allow_duplicates: yes 3 | dependencies: 4 | - role: system_user 5 | system_user: "{{ statsd_user }}" 6 | -------------------------------------------------------------------------------- /ansible/roles/statsd/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: install node 3 | apt: pkg=nodejs state=latest 4 | 5 | - name: get statsd 6 | git: > 7 | repo={{ statsd_repo }} 8 | version={{ statsd_version }} 9 | dest={{ statsd_lib_dir }}/statsd 10 | 11 | - name: change ownership 12 | file: > 13 | path={{ statsd_lib_dir }}/statsd 14 | state=directory 15 | recurse=yes 16 | owner={{ statsd_user }} 17 | group={{ statsd_group }} 18 | 19 | - name: install config 20 | template: > 21 | src=statsd-config.js.j2 22 | dest=/etc/statsd-config.js 23 | owner={{ statsd_user }} 24 | group={{ statsd_group }} 25 | mode=0644 26 | 27 | - name: install upstart 28 | template: > 29 | src=statsd.conf.j2 30 | dest=/etc/init/statsd.conf 31 | 32 | - name: get it going 33 | service: > 34 | name=statsd 35 | state=restarted 36 | -------------------------------------------------------------------------------- /ansible/roles/statsd/templates/statsd-config.js.j2: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Required Variables: 4 | 5 | port: StatsD listening port [default: 8125] 6 | 7 | Graphite Required Variables: 8 | 9 | (Leave these unset to avoid sending stats to Graphite. 10 | Set debug flag and leave these unset to run in 'dry' debug mode - 11 | useful for testing statsd clients without a Graphite server.) 12 | 13 | graphiteHost: hostname or IP of Graphite server 14 | graphitePort: port of Graphite server 15 | 16 | Optional Variables: 17 | 18 | backends: an array of backends to load. Each backend must exist 19 | by name in the directory backends/. If not specified, 20 | the default graphite backend will be loaded. 21 | debug: debug flag [default: false] 22 | address: address to listen on over UDP [default: 0.0.0.0] 23 | address_ipv6: defines if the address is an IPv4 or IPv6 address [true or false, default: false] 24 | port: port to listen for messages on over UDP [default: 8125] 25 | mgmt_address: address to run the management TCP interface on 26 | [default: 0.0.0.0] 27 | mgmt_port: port to run the management TCP interface on [default: 8126] 28 | title : Allows for overriding the process title. [default: statsd] 29 | if set to false, will not override the process title and let the OS set it. 30 | The length of the title has to be less than or equal to the binary name + cli arguments 31 | NOTE: This does not work on Mac's with node versions prior to v0.10 32 | 33 | healthStatus: default health status to be returned and statsd process starts ['up' or 'down', default: 'up'] 34 | dumpMessages: log all incoming messages 35 | flushInterval: interval (in ms) to flush to Graphite 36 | percentThreshold: for time information, calculate the Nth percentile(s) 37 | (can be a single value or list of floating-point values) 38 | negative values mean to use "top" Nth percentile(s) values 39 | [%, default: 90] 40 | flush_counts: send stats_counts metrics [default: true] 41 | 42 | keyFlush: log the most frequently sent keys [object, default: undefined] 43 | interval: how often to log frequent keys [ms, default: 0] 44 | percent: percentage of frequent keys to log [%, default: 100] 45 | log: location of log file for frequent keys [default: STDOUT] 46 | deleteIdleStats: don't send values to graphite for inactive counters, sets, gauges, or timeers 47 | as opposed to sending 0. For gauges, this unsets the gauge (instead of sending 48 | the previous value). Can be indivdually overriden. [default: false] 49 | deleteGauges : don't send values to graphite for inactive gauges, as opposed to sending the previous value [default: false] 50 | deleteTimers: don't send values to graphite for inactive timers, as opposed to sending 0 [default: false] 51 | deleteSets: don't send values to graphite for inactive sets, as opposed to sending 0 [default: false] 52 | deleteCounters: don't send values to graphite for inactive counters, as opposed to sending 0 [default: false] 53 | prefixStats: prefix to use for the statsd statistics data for this running instance of statsd [default: statsd] 54 | applies to both legacy and new namespacing 55 | 56 | console: 57 | prettyprint: whether to prettyprint the console backend 58 | output [true or false, default: true] 59 | 60 | log: log settings [object, default: undefined] 61 | backend: where to log: stdout or syslog [string, default: stdout] 62 | application: name of the application for syslog [string, default: statsd] 63 | level: log level for [node-]syslog [string, default: LOG_INFO] 64 | 65 | graphite: 66 | legacyNamespace: use the legacy namespace [default: true] 67 | globalPrefix: global prefix to use for sending stats to graphite [default: "stats"] 68 | prefixCounter: graphite prefix for counter metrics [default: "counters"] 69 | prefixTimer: graphite prefix for timer metrics [default: "timers"] 70 | prefixGauge: graphite prefix for gauge metrics [default: "gauges"] 71 | prefixSet: graphite prefix for set metrics [default: "sets"] 72 | globalSuffix: global suffix to use for sending stats to graphite [default: ""] 73 | This is particularly useful for sending per host stats by 74 | settings this value to: require('os').hostname().split('.')[0] 75 | 76 | repeater: an array of hashes of the for host: and port: 77 | that details other statsd servers to which the received 78 | packets should be "repeated" (duplicated to). 79 | e.g. [ { host: '10.10.10.10', port: 8125 }, 80 | { host: 'observer', port: 88125 } ] 81 | 82 | repeaterProtocol: whether to use udp4 or udp6 for repeaters. 83 | ["udp4" or "udp6", default: "udp4"] 84 | 85 | histogram: for timers, an array of mappings of strings (to match metrics) and 86 | corresponding ordered non-inclusive upper limits of bins. 87 | For all matching metrics, histograms are maintained over 88 | time by writing the frequencies for all bins. 89 | 'inf' means infinity. A lower limit of 0 is assumed. 90 | default: [], meaning no histograms for any timer. 91 | First match wins. examples: 92 | * histogram to only track render durations, with unequal 93 | class intervals and catchall for outliers: 94 | [ { metric: 'render', bins: [ 0.01, 0.1, 1, 10, 'inf'] } ] 95 | * histogram for all timers except 'foo' related, 96 | equal class interval and catchall for outliers: 97 | [ { metric: 'foo', bins: [] }, 98 | { metric: '', bins: [ 50, 100, 150, 200, 'inf'] } ] 99 | 100 | */ 101 | { 102 | graphitePort: {{ metrics_collection_host }} 103 | , graphiteHost: "{{ metrics_collection_port}}" 104 | , port: {{ statsd_port }} 105 | , backends: [ "./backends/graphite" ] 106 | } 107 | -------------------------------------------------------------------------------- /ansible/roles/statsd/templates/statsd.conf.j2: -------------------------------------------------------------------------------- 1 | # statsd server 2 | # 3 | 4 | description "statsd server" 5 | 6 | start on virtual-filesystems 7 | stop on runlevel [06] 8 | 9 | respawn 10 | respawn limit 5 30 11 | 12 | env HOME={{ statsd_home }} 13 | 14 | chdir {{ statsd_home }} 15 | setuid {{ statsd_user }} 16 | setgid {{ statsd_group }} 17 | console log 18 | 19 | # for versions 1.1.1 - 1.1.4 the internal web service crashes when touched 20 | # and the current workaround is to just not run it and run Kibana instead 21 | 22 | script 23 | exec nodejs {{ statsd_lib_dir }}/statsd/stats.js /etc/statsd-config.js 24 | end script 25 | -------------------------------------------------------------------------------- /ansible/roles/system_user/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | system_user_group: "{{ system_user }}" 2 | system_user_additional_groups: "" 3 | system_user_home: "/var/{{ system_user }}" 4 | system_user_create_home: yes 5 | system_user_dirs: [ "{{ system_user_home }}" ] 6 | -------------------------------------------------------------------------------- /ansible/roles/system_user/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | allow_duplicates: yes 3 | -------------------------------------------------------------------------------- /ansible/roles/system_user/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | - name: create group 2 | group: name={{ system_user_group }} 3 | state=present 4 | system=yes 5 | 6 | - name: make user 7 | user: name={{ system_user }} 8 | group={{ system_user_group }} 9 | groups={{ system_user_additional_groups }} 10 | createhome={{ system_user_create_home }} 11 | home={{ system_user_home }} 12 | system=yes 13 | state=present 14 | 15 | - file: state=directory 16 | path={{ item }} 17 | owner={{ system_user }} 18 | group={{ system_user_group }} 19 | mode=0775 20 | with_items: system_user_dirs 21 | 22 | -------------------------------------------------------------------------------- /ansible/shared-vars.yaml: -------------------------------------------------------------------------------- 1 | logstash_redis_host: redis 2 | logstash_redis_port: 6379 3 | 4 | carbon_host: graphite 5 | carbon_port: 2003 6 | 7 | carbon_relay_host: riemann 8 | carbon_relay_port: 5553 9 | 10 | riemann_host: riemann 11 | riemann_port: 5555 12 | -------------------------------------------------------------------------------- /ansible/statsd.yaml: -------------------------------------------------------------------------------- 1 | - hosts: all 2 | sudo: yes 3 | 4 | vars_files: 5 | - shared-vars.yaml 6 | 7 | roles: 8 | - role: riemann-tools 9 | - role: riemann-tools 10 | riemann_tools_cmd: riemann-net 11 | - role: statsd 12 | 13 | # - role: logstash 14 | # logstash_run_as: root 15 | # logstash_conf_template: "logstash.d/redis.conf.j2" 16 | # logstash_home: "{{ redis_home }}" 17 | -------------------------------------------------------------------------------- /base-box/.gitignore: -------------------------------------------------------------------------------- 1 | /.vagrant 2 | package.box 3 | -------------------------------------------------------------------------------- /base-box/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! 5 | VAGRANTFILE_API_VERSION = "2" 6 | 7 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 8 | config.vm.box = "raring64" 9 | config.vm.box_url = "http://bit.ly/vagrant-lxc-raring64-2013-10-23" 10 | 11 | config.vm.provision :shell, path: "provision.sh" 12 | end 13 | -------------------------------------------------------------------------------- /base-box/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | BOX_NAME=monitorcraft-base 6 | 7 | rm -f package.box 8 | vagrant up --provider lxc 9 | vagrant package 10 | vagrant box add $BOX_NAME package.box --force --provider lxc 11 | 12 | # Hack to deal with using a pre 0.7.0 box with a 0.7.0+ box 13 | cp ~/.vagrant.d/gems/gems/vagrant-lxc*/boxes/common/lxc-template ~/.vagrant.d/boxes/$BOX_NAME/lxc/ 14 | 15 | #vagrant destroy --force 16 | -------------------------------------------------------------------------------- /base-box/provision.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | apt-get update 6 | apt-get -y --fix-missing install \ 7 | python-pip python-virtualenv python-apt python-pycurl python-dev \ 8 | python-setuptools python-setuptools-git python-pkg-resources git \ 9 | openjdk-7-jre-headless openjdk-7-jdk ruby1.9.3 10 | 11 | gem install riemann-tools --no-rdoc --no-ri 12 | 13 | apt-get -y remove --auto-remove puppet 14 | 15 | echo "UseDNS no" >> /etc/ssh/sshd_config 16 | 17 | # work around for the vagrant-lxc boxes not having appropriate sudoers permissions for vagrant 18 | echo "vagrant ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/vagrant 19 | chmod 0440 /etc/sudoers.d/vagrant 20 | -------------------------------------------------------------------------------- /init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | ROLE_DIR=./ansible/roles 6 | 7 | wget -q -P $ROLE_DIR/minecraft/files https://s3.amazonaws.com/Minecraft.Download/versions/1.7.4/minecraft_server.1.7.4.jar & 8 | wget -q -P $ROLE_DIR/logstash/files https://download.elasticsearch.org/logstash/logstash/logstash-1.3.2-flatjar.jar & 9 | wget -q -P $ROLE_DIR/redis/files wget http://download.redis.io/releases/redis-2.8.3.tar.gz & 10 | wget -q -P $ROLE_DIR/riemann/files http://aphyr.com/riemann/riemann_0.2.4_all.deb & 11 | 12 | cd base-box 13 | ./install.sh 14 | -------------------------------------------------------------------------------- /launch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | vagrant up riemann 6 | 7 | # These boxes recieve data from other boxes and should be 8 | # running before anything else 9 | vagrant up redis graphite 10 | 11 | # start up everything else 12 | vagrant up 13 | --------------------------------------------------------------------------------