From 26cacb247f5fbbfc846560313b585ec69a0a27db Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Sun, 16 Jun 2013 22:11:11 +0300 Subject: [PATCH 01/56] port cookbook to centos. --- attributes/default.rb | 12 ++++ files/centos/shinken-arbiter | 50 ++++++++++++++++ files/centos/shinken-broker | 56 ++++++++++++++++++ files/centos/shinken-poller | 57 +++++++++++++++++++ files/centos/shinken-reactionner | 56 ++++++++++++++++++ files/centos/shinken-receiver | 56 ++++++++++++++++++ files/centos/shinken-scheduler | 56 ++++++++++++++++++ recipes/arbiter.rb | 11 ++-- recipes/base.rb | 57 +++++++++++-------- recipes/broker-webui.rb | 4 +- recipes/broker.rb | 10 +++- recipes/poller.rb | 8 ++- recipes/reactionner.rb | 12 ++-- recipes/receiver.rb | 8 ++- recipes/scheduler.rb | 8 ++- templates/default/arbiter/arbiter.cfg.erb | 6 +- templates/default/broker/brokerd.ini.erb | 4 +- templates/default/default/shinken.erb | 10 ++-- templates/default/poller/pollerd.ini.erb | 4 +- .../default/reactionner/reactionnerd.ini.erb | 5 +- templates/default/receiver/receiverd.ini.erb | 4 +- .../default/scheduler/schedulerd.ini.erb | 4 +- 22 files changed, 434 insertions(+), 64 deletions(-) create mode 100755 files/centos/shinken-arbiter create mode 100755 files/centos/shinken-broker create mode 100755 files/centos/shinken-poller create mode 100755 files/centos/shinken-reactionner create mode 100755 files/centos/shinken-receiver create mode 100755 files/centos/shinken-scheduler diff --git a/attributes/default.rb b/attributes/default.rb index 8c443e9..88b981f 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -24,6 +24,18 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # +case node['platform_family'] +when 'rhel' + default["shinken"]["core_package"] = "shinken" + default["shinken"]["run_dir"] = "/var/run/shinken" + default["shinken"]["work_dir"] = "/var/lib/shinken" + default["shinken"]["bin_dir"] = "/usr/sbin" +else + default["shinken"]["core_package"] = "shinken-core" + default["shinken"]["run_dir"] = "/var/run/nagios" + default["shinken"]["work_dir"] = "/var/lib/nagios" + default["shinken"]["bin_dir"] = "/usr/bin" +end default["shinken"]["scheduler" ]["port"] = 7768 default["shinken"]["reactionner"]["port"] = 7769 diff --git a/files/centos/shinken-arbiter b/files/centos/shinken-arbiter new file mode 100755 index 0000000..02ca504 --- /dev/null +++ b/files/centos/shinken-arbiter @@ -0,0 +1,50 @@ +#! /bin/sh + +# Copyright (C) 2009-2011: +# Gabes Jean, naparuba@gmail.com +# Gerhard Lausser, Gerhard.Lausser@consol.de +# Gregory Starck, g.starck@gmail.com +# Hartmut Goebel, h.goebel@goebel-consult.de +# +# This file is part of Shinken. +# +# Shinken is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Shinken is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Shinken. If not, see . + +### BEGIN INIT INFO +# Provides: shinken-arbiter +# Required-Start: $all +# Required-Stop: $all +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Shinken arbiter daemon +# Description: Shinken is a monitoring tool and the Arbiter +# is one of its daemon. This one reads the configuration, +# cuts it into parts and dispatches it. Then it waits +# for orders from the users to dispatch them too. +### END INIT INFO + +# Author: Gabes Jean +# Olivier LI-KIANG-CHEONG + + +NAME="shinken-arbiter" + +curdir=$(dirname "$0") + +export SHINKEN_MODULE_FILE="$NAME" ## for 'shinken' init script to see that it's called by us + +"$curdir/shinken" $@ arbiter + +exit $? + diff --git a/files/centos/shinken-broker b/files/centos/shinken-broker new file mode 100755 index 0000000..b92f0ad --- /dev/null +++ b/files/centos/shinken-broker @@ -0,0 +1,56 @@ +#! /bin/sh + +# Copyright (C) 2009-2011: +# Gabes Jean, naparuba@gmail.com +# Gerhard Lausser, Gerhard.Lausser@consol.de +# Gregory Starck, g.starck@gmail.com +# Hartmut Goebel, h.goebel@goebel-consult.de +# +# This file is part of Shinken. +# +# Shinken is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Shinken is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Shinken. If not, see . + +### BEGIN INIT INFO +# Provides: shinken-broker +# Required-Start: $all +# Required-Stop: $all +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Shinken broker daemon +# Description: Shinken is a monitoring tool and the Broker +# is one of its daemon. This one gets the configuration from the arbiter +# His purpose is to get the broks from the schedulers specified in the +# configuration +### END INIT INFO + +### BEGIN INIT INFO Redhat +# Shinken Starts Shinken Broker +# +# chkconfig: 345 99 01 +# description: Start Shinken broker daemon +### END INIT INFO + +# Author: Gabes Jean +# Olivier LI-KIANG-CHEONG + + +NAME="shinken-broker" + +curdir=$(dirname "$0") + +export SHINKEN_MODULE_FILE="$NAME" ## for 'shinken' init script to see that it's called by us + +"$curdir/shinken" $@ broker + +exit $? diff --git a/files/centos/shinken-poller b/files/centos/shinken-poller new file mode 100755 index 0000000..04a6cfa --- /dev/null +++ b/files/centos/shinken-poller @@ -0,0 +1,57 @@ +#! /bin/sh + +# Copyright (C) 2009-2011: +# Gabes Jean, naparuba@gmail.com +# Gerhard Lausser, Gerhard.Lausser@consol.de +# Gregory Starck, g.starck@gmail.com +# Hartmut Goebel, h.goebel@goebel-consult.de +# +# This file is part of Shinken. +# +# Shinken is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Shinken is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Shinken. If not, see . + +### BEGIN INIT INFO +# Provides: shinken-poller +# Required-Start: $all +# Required-Stop: $all +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Shinken poller daemon +# Description: Shinken is a monitoring tool and the Poller +# is one of its daemon. This one gets the configuration from the arbiter +# His purpose is to actually do the checks ordered by the schedulers, +# and then sends the results to the schedulers specified in the +# configuration +### END INIT INFO + +### BEGIN INIT INFO Redhat +# Shinken Starts Shinken Poller +# +# chkconfig: 345 99 01 +# description: Start Shinken poller daemon +### END INIT INFO + +# Author: Gabes Jean +# Olivier LI-KIANG-CHEONG + + +NAME="shinken-poller" + +curdir=$(dirname "$0") + +export SHINKEN_MODULE_FILE="$NAME" ## for 'shinken' init script to see that it's called by us + +"$curdir/shinken" $@ poller + +exit $? diff --git a/files/centos/shinken-reactionner b/files/centos/shinken-reactionner new file mode 100755 index 0000000..db29e3e --- /dev/null +++ b/files/centos/shinken-reactionner @@ -0,0 +1,56 @@ +#! /bin/sh + +# Copyright (C) 2009-2011: +# Gabes Jean, naparuba@gmail.com +# Gerhard Lausser, Gerhard.Lausser@consol.de +# Gregory Starck, g.starck@gmail.com +# Hartmut Goebel, h.goebel@goebel-consult.de +# +# This file is part of Shinken. +# +# Shinken is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Shinken is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Shinken. If not, see . + +### BEGIN INIT INFO +# Provides: shinken-reactionner +# Required-Start: $all +# Required-Stop: $all +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Shinken reactionner daemon +# Description: Shinken is a monitoring tool and the Reactionner +# is one of its daemon. This one gets the configuration from the arbiter +# His purpose is to get the actually do the actions like sending an email +# ordered by the schedulers specified in the configuration +### END INIT INFO + +### BEGIN INIT INFO Redhat +# Shinken Starts Shinken Reactionner +# +# chkconfig: 345 99 01 +# description: Start Shinken reactionner daemon +### END INIT INFO + +# Author: Gabes Jean +# Olivier LI-KIANG-CHEONG + + +NAME="shinken-reactionner" + +curdir=$(dirname "$0") + +export SHINKEN_MODULE_FILE="$NAME" ## for 'shinken' init script to see that it's called by us + +"$curdir/shinken" $@ reactionner + +exit $? diff --git a/files/centos/shinken-receiver b/files/centos/shinken-receiver new file mode 100755 index 0000000..e7b8b5f --- /dev/null +++ b/files/centos/shinken-receiver @@ -0,0 +1,56 @@ +#! /bin/sh + +# Copyright (C) 2009-2011: +# Gabes Jean, naparuba@gmail.com +# Gerhard Lausser, Gerhard.Lausser@consol.de +# Gregory Starck, g.starck@gmail.com +# Hartmut Goebel, h.goebel@goebel-consult.de +# +# This file is part of Shinken. +# +# Shinken is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Shinken is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Shinken. If not, see . + +### BEGIN INIT INFO +# Provides: shinken-receiver +# Required-Start: $all +# Required-Stop: $all +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Shinken receiver daemon +# Description: Shinken is a monitoring tool and the Receiver +# is one of its daemon. This one gets the configuration from the arbiter +# His purpose is to get the broks from the schedulers specified in the +# configuration +### END INIT INFO + +### BEGIN INIT INFO Redhat +# Shinken Starts Shinken Receiver +# +# chkconfig: 345 99 01 +# description: Start Shinken receiver daemon +### END INIT INFO + +# Author: Gabes Jean +# Olivier LI-KIANG-CHEONG + + +NAME="shinken-receiver" + +curdir=$(dirname "$0") + +export SHINKEN_MODULE_FILE="$NAME" ## for 'shinken' init script to see that it's called by us + +"$curdir/shinken" $@ receiver + +exit $? diff --git a/files/centos/shinken-scheduler b/files/centos/shinken-scheduler new file mode 100755 index 0000000..5af33ff --- /dev/null +++ b/files/centos/shinken-scheduler @@ -0,0 +1,56 @@ +#! /bin/sh + +# Copyright (C) 2009-2011: +# Gabes Jean, naparuba@gmail.com +# Gerhard Lausser, Gerhard.Lausser@consol.de +# Gregory Starck, g.starck@gmail.com +# Hartmut Goebel, h.goebel@goebel-consult.de +# +# This file is part of Shinken. +# +# Shinken is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Shinken is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Shinken. If not, see . + +### BEGIN INIT INFO +# Provides: shinken-scheduler +# Required-Start: $all +# Required-Stop: $all +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Shinken scheduler daemon +# Description: Shinken is a monitoring tool and the Scheduler +# is one of its daemon. This one get configuration from the arbiter +# His purpose is only to schedule do the checks and actions specified +# in the configuration received from the arbiter +### END INIT INFO + +### BEGIN INIT INFO Redhat +# Shinken Starts Shinken Scheduler +# +# chkconfig: 345 99 01 +# description: Start Shinken scheduler daemon +### END INIT INFO + +# Author: Gabes Jean +# Olivier LI-KIANG-CHEONG + + +NAME="shinken-scheduler" + +curdir=$(dirname "$0") + +export SHINKEN_MODULE_FILE="$NAME" ## for 'shinken' init script to see that it's called by us + +"$curdir/shinken" $@ scheduler + +exit $? diff --git a/recipes/arbiter.rb b/recipes/arbiter.rb index cfd6e2c..21a1413 100644 --- a/recipes/arbiter.rb +++ b/recipes/arbiter.rb @@ -33,11 +33,9 @@ include_recipe "shinken::base" ### Package install -# For now we only handle debian packages package "shinken-arbiter" - ### Layout #### Directories @@ -168,6 +166,12 @@ notifies :restart, "service[shinken-arbiter]", :delayed end +if node[:platform] == "centos" + cookbook_file "/etc/init.d/shinken-arbiter" do + mode "0755" + end +end + ### Service stuff # Declare arbiter service service "shinken-arbiter" do @@ -175,8 +179,7 @@ action [:enable, :start] # If ``/etc/default/shinken`` is changed, we'll restart - subscribes :restart, "template[shinken/default/debian]", :delayed \ - if node["platform"] == "debian" + subscribes :restart, "template[shinken/default/debian]", :delayed end diff --git a/recipes/base.rb b/recipes/base.rb index ad4a5ee..fad9498 100644 --- a/recipes/base.rb +++ b/recipes/base.rb @@ -33,38 +33,32 @@ # at the end. node.run_state["shinken"] = {} -### Packaging -#### Shinken's repository -# Shinken resides in its own directory -apt_repository "shinken-dev" do - uri "http://shinken.apt.znx.fr/" - distribution "sid" - components ["main"] - key "http://shinken.apt.znx.fr/packages@zenexity.com.gpg.key" - - action :add +if node['platform_family'] == "debian" + ### Packaging + #### Shinken's repository + # Shinken resides in its own directory + apt_repository "shinken-dev" do + uri "http://shinken.apt.znx.fr/" + distribution "sid" + components ["main"] + key "http://shinken.apt.znx.fr/packages@zenexity.com.gpg.key" + action :add + end end - #### Package install # We'll install core package which contains common files and common # configuration -package "shinken-core" - +package node["shinken"]["core_package"] -### Common files -directory "/var/cache/shinken" do - owner "nagios" - group "nagios" +template "shinken/default/debian" do + path "/etc/default/shinken" + source "default/shinken.erb" + mode "0644" end -# On debian we'll need to override /etc/default/shinken file -if node["platform"] == "debian" - template "shinken/default/debian" do - path "/etc/default/shinken" - source "default/shinken.erb" - mode "0644" - end +template "/etc/init.d/shinken" do + mode 0755 end ### Cleanup @@ -74,6 +68,15 @@ 'reactionnerd-windows.ini', 'receiverd-windows.ini', 'schedulerd-windows.ini', + 'commands.cfg', + 'contactgroups.cfg', + 'discovery.cfg', + 'discovery_rules.cfg', + 'discovery_runs.cfg', + 'escalations.cfg', + 'servicegroups.cfg', + 'templates.cfg', + 'timeperiods.cfg', 'shinken-specific-high-availability.cfg', 'shinken-specific-load-balanced-only.cfg'].each do |f| file ::File.join('/etc/shinken', f) do @@ -81,3 +84,9 @@ end end +directory "/etc/shinken/objects" do + action :delete + recursive true +end + +cookbook_file "/etc/shinken/resource.cfg" diff --git a/recipes/broker-webui.rb b/recipes/broker-webui.rb index 9ece093..18a3305 100644 --- a/recipes/broker-webui.rb +++ b/recipes/broker-webui.rb @@ -33,7 +33,9 @@ ### Package install # For now we only handle debian packages -package "shinken-webui" +if node['platform_family'] == "debian" + package "shinken-webui" +end ### Webui module declaration # Store in db diff --git a/recipes/broker.rb b/recipes/broker.rb index 7c766ef..7da53cb 100644 --- a/recipes/broker.rb +++ b/recipes/broker.rb @@ -37,20 +37,24 @@ package "shinken-broker" ### Service stuff +if node[:platform] == "centos" + cookbook_file "/etc/init.d/shinken-broker" do + mode "0755" + end +end + # Declare broker service service "shinken-broker" do # Ensure it is started by default and running action [:enable, :start] # If ``/etc/default/shinken`` is changed, we'll restart - subscribes :restart, "template[shinken/default/debian]", :delayed \ - if node["platform"] == "debian" + subscribes :restart, "template[shinken/default/debian]", :delayed end ### Configuration files template "shinken/broker/ini" do path "/etc/shinken/brokerd.ini" - source "broker/brokerd.ini.erb" end diff --git a/recipes/poller.rb b/recipes/poller.rb index ac3a9f6..2305a6a 100644 --- a/recipes/poller.rb +++ b/recipes/poller.rb @@ -24,16 +24,20 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # - package "shinken-poller" +if node[:platform] == "centos" + cookbook_file "/etc/init.d/shinken-poller" do + mode "0755" + end +end + service "shinken-poller" do action [:enable, :start] end template "shinken/poller/ini" do path "/etc/shinken/pollerd.ini" - source "poller/pollerd.ini.erb" end diff --git a/recipes/reactionner.rb b/recipes/reactionner.rb index ac0682b..2671d39 100644 --- a/recipes/reactionner.rb +++ b/recipes/reactionner.rb @@ -24,19 +24,19 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # - package "shinken-reactionner" +if node[:platform] == "centos" + cookbook_file "/etc/init.d/shinken-reactionner" do + mode "0755" + end +end + service "shinken-reactionner" do action [:enable, :start] end template "shinken/reactionner/ini" do path "/etc/shinken/reactionnerd.ini" - source "reactionner/reactionnerd.ini.erb" end - - - - diff --git a/recipes/receiver.rb b/recipes/receiver.rb index 4c28d95..9ea0b8b 100644 --- a/recipes/receiver.rb +++ b/recipes/receiver.rb @@ -24,16 +24,20 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # - package "shinken-receiver" +if node[:platform] == "centos" + cookbook_file "/etc/init.d/shinken-receiver" do + mode "0755" + end +end + service "shinken-receiver" do action [:enable, :start] end template "shinken/receiver/ini" do path "/etc/shinken/receiverd.ini" - source "receiver/receiverd.ini.erb" end diff --git a/recipes/scheduler.rb b/recipes/scheduler.rb index 4d9fcf6..0e31ff3 100644 --- a/recipes/scheduler.rb +++ b/recipes/scheduler.rb @@ -24,16 +24,20 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # - package "shinken-scheduler" +if node[:platform] == "centos" + cookbook_file "/etc/init.d/shinken-scheduler" do + mode "0755" + end +end + service "shinken-scheduler" do action [:enable, :start] end template "shinken/scheduler/ini" do path "/etc/shinken/schedulerd.ini" - source "scheduler/schedulerd.ini.erb" end diff --git a/templates/default/arbiter/arbiter.cfg.erb b/templates/default/arbiter/arbiter.cfg.erb index d364749..dce5bd4 100644 --- a/templates/default/arbiter/arbiter.cfg.erb +++ b/templates/default/arbiter/arbiter.cfg.erb @@ -166,7 +166,7 @@ daemon_enabled=1 shinken_user=nagios shinken_group=nagios -lock_file=/var/run/nagios/arbiterd.pid +lock_file=<%= node['shinken']['run_dir'] %>/arbiterd.pid local_log=/var/log/shinken/arbiterd.log @@ -210,7 +210,3 @@ cfg_file=objects-chef/<%= nwf %> <% @timeperiod_files.each do |tpf| %> cfg_file=objects-chef/<%= tpf %> <% end %> - - - - diff --git a/templates/default/broker/brokerd.ini.erb b/templates/default/broker/brokerd.ini.erb index a92cc6f..6bfb0a1 100644 --- a/templates/default/broker/brokerd.ini.erb +++ b/templates/default/broker/brokerd.ini.erb @@ -47,5 +47,5 @@ max_queue_size=100000 user=nagios group=nagios -workdir=/var/lib/nagios -pidfile=/var/run/nagios/brokerd.pid +workdir=<%= node['shinken']['work_dir'] %> +pidfile=<%= node['shinken']['run_dir'] %>/brokerd.pid diff --git a/templates/default/default/shinken.erb b/templates/default/default/shinken.erb index 4337ddb..9ac003f 100644 --- a/templates/default/default/shinken.erb +++ b/templates/default/default/shinken.erb @@ -25,17 +25,17 @@ # /etc/default/shinken # /etc/shinken is where we put all configuration files -# /var/lib/nagios is where we put some variables files (replaced by /home/superbaloo/dev/packages/build/shinken-1.2.2/debian/tmp/var/run/nagios and /home/superbaloo/dev/packages/build/shinken-1.2.2/debian/tmp/var/log/shinken for now) -# /var/run/nagios is where we put pid files +# <%= node['shinken']['work_dir'] %> is where we put some variables files (replaced by /home/superbaloo/dev/packages/build/shinken-1.2.2/debian/tmp<%= node['shinken']['run_dir'] %> and /home/superbaloo/dev/packages/build/shinken-1.2.2/debian/tmp/var/log/shinken for now) +# <%= node['shinken']['run_dir'] %> is where we put pid files # /var/log/shinken is where we put log files # /usr/bin is where the launch scripts will be send ## These vars will override the hardcoded ones in init script ## ETC=/etc/shinken -VAR=/var/lib/nagios -BIN=/usr/bin -RUN=/var/run/nagios +VAR=<%= node['shinken']['work_dir'] %> +BIN=<%= node['shinken']['bin_dir'] %> +RUN=<%= node['shinken']['run_dir'] %> LOG=/var/log/shinken diff --git a/templates/default/poller/pollerd.ini.erb b/templates/default/poller/pollerd.ini.erb index 542c9a9..4888b08 100644 --- a/templates/default/poller/pollerd.ini.erb +++ b/templates/default/poller/pollerd.ini.erb @@ -42,5 +42,5 @@ log_level=WARNING user=nagios group=nagios -workdir=/var/lib/nagios -pidfile=/var/run/nagios/pollerd.pid +workdir=<%= node['shinken']['work_dir'] %> +pidfile=<%= node['shinken']['run_dir'] %>/pollerd.pid diff --git a/templates/default/reactionner/reactionnerd.ini.erb b/templates/default/reactionner/reactionnerd.ini.erb index 84fbe2c..61eb2b2 100644 --- a/templates/default/reactionner/reactionnerd.ini.erb +++ b/templates/default/reactionner/reactionnerd.ini.erb @@ -33,5 +33,6 @@ log_level=WARNING user=nagios group=nagios -workdir=/var/lib/nagios -pidfile=/var/run/nagios/reactionnerd.pid +workdir=<%= node['shinken']['work_dir'] %> +pidfile=<%= node['shinken']['run_dir'] %>/reactionnerd.pid + diff --git a/templates/default/receiver/receiverd.ini.erb b/templates/default/receiver/receiverd.ini.erb index 97d8e8c..a2c828b 100644 --- a/templates/default/receiver/receiverd.ini.erb +++ b/templates/default/receiver/receiverd.ini.erb @@ -33,5 +33,5 @@ log_level=WARNING user=nagios group=nagios -workdir=/var/lib/nagios -pidfile=/var/run/nagios/receiverd.pid +workdir=<%= node['shinken']['work_dir'] %> +pidfile=<%= node['shinken']['run_dir'] %>/receiverd.pid diff --git a/templates/default/scheduler/schedulerd.ini.erb b/templates/default/scheduler/schedulerd.ini.erb index d3f038a..ac25d94 100644 --- a/templates/default/scheduler/schedulerd.ini.erb +++ b/templates/default/scheduler/schedulerd.ini.erb @@ -31,5 +31,5 @@ log_level=INFO user=nagios group=nagios -workdir=/var/lib/nagios -pidfile=/var/run/nagios/schedulerd.pid +workdir=<%= node['shinken']['work_dir'] %> +pidfile=<%= node['shinken']['run_dir'] %>/schedulerd.pid From 095ec4e1c5eae26c2030943336e42dd62f47e743 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Mon, 17 Jun 2013 22:33:44 +0300 Subject: [PATCH 02/56] straighten up formatting --- .../definitions/services/service.cfg.erb | 90 +++++++++---------- 1 file changed, 41 insertions(+), 49 deletions(-) diff --git a/templates/default/definitions/services/service.cfg.erb b/templates/default/definitions/services/service.cfg.erb index 5c7d2a0..b740839 100644 --- a/templates/default/definitions/services/service.cfg.erb +++ b/templates/default/definitions/services/service.cfg.erb @@ -2,134 +2,126 @@ define service { <% if not @register %> - name <%= @service_key %> + name <%= @service_key %> <% end %> - - <% if not @service_alias.nil? %> - alias <%= @service_alias %> + alias <%= @service_alias %> <% end %> <% if not @host_name.nil? %> - host_name <%= @host_name %> + host_name <%= @host_name %> <% end %> - <% if not @service_description.nil? %> - service_description <%= @service_description %> + service_description <%= @service_description %> <% end %> <% if not @display_name.nil? %> - display_name <%= @display_name %> + display_name <%= @display_name %> <% end %> <% if not @servicegroups.nil? %> - servicegroups <%= @servicegroups.join(",") %> + servicegroups <%= @servicegroups.join(",") %> <% end %> <% if not @check_command.nil? %> - check_command <%= @check_command.command_identifier %> + check_command <%= @check_command.command_identifier %> <% end %> <% if not @initial_state.nil? %> - initial_state <%= @initial_state.to_s[0,1] %> + initial_state <%= @initial_state.to_s[0,1] %> <% end %> <% if not @max_check_attempts.nil? %> - max_check_attempts <%= @max_check_attempts %> + max_check_attempts <%= @max_check_attempts %> <% end %> <% if not @check_interval.nil? %> - check_interval <%= @check_interval %> + check_interval <%= @check_interval %> <% end %> <% if not @retry_interval.nil? %> - retry_interval <%= @retry_interval %> + retry_interval <%= @retry_interval %> <% end %> <% if not @active_checks_enabled.nil? %> - active_checks_enabled <%= @active_checks_enabled ? "1": "0" %> + active_checks_enabled <%= @active_checks_enabled ? "1": "0" %> <% end %> <% if not @passive_checks_enabled.nil? %> - passive_checks_enabled <%= @passive_checks_enabled ? "1": "0" %> + passive_checks_enabled <%= @passive_checks_enabled ? "1": "0" %> <% end %> <% if not @check_period.nil? %> - check_period <%= @check_period %> + check_period <%= @check_period %> <% end %> <% if not @obsess_over_service.nil? %> - obsess_over_service <%= @obsess_over_service ? "1": "0" %> + obsess_over_service <%= @obsess_over_service ? "1": "0" %> <% end %> <% if not @check_freshness.nil? %> - check_freshness <%= @check_freshness ? "1": "0" %> + check_freshness <%= @check_freshness ? "1": "0" %> <% end %> <% if not @freshness_threshold.nil? %> - freshness_threshold <%= @freshness_threshold %> + freshness_threshold <%= @freshness_threshold %> <% end %> <% if not @event_handler.nil? %> - event_handler <%= @event_handler %> + event_handler <%= @event_handler %> <% end %> <% if not @event_handler_enabled.nil? %> - event_handler_enabled <%= @event_handler_enabled? "1": "0" %> + event_handler_enabled <%= @event_handler_enabled? "1": "0" %> <% end %> <% if not @low_flap_threshold.nil? %> - low_flap_threshold <%= @low_flap_threshold %> + low_flap_threshold <%= @low_flap_threshold %> <% end %> <% if not @high_flap_threshold.nil? %> - high_flap_threshold <%= @high_flap_threshold %> + high_flap_threshold <%= @high_flap_threshold %> <% end %> <% if not @flap_detection_enabled.nil? %> - flap_detection_enabled <%= @flap_detection_enabled ? "1": "0"%> + flap_detection_enabled <%= @flap_detection_enabled ? "1": "0"%> <% end %> <% if not @flap_detection_options.nil? %> - flap_detection_options <%= @flap_detection_options.map{|e| e.to_s[0,1]}.join(",") %> + flap_detection_options <%= @flap_detection_options.map{|e| e.to_s[0,1]}.join(",") %> <% end %> <% if not @process_perf_data.nil? %> - process_perf_data <%= @process_perf_data? "1": "0" %> + process_perf_data <%= @process_perf_data? "1": "0" %> <% end %> <% if not @retain_status_information.nil? %> - retain_status_information <%= @retain_status_information ? "1": "0" %> + retain_status_information <%= @retain_status_information ? "1": "0" %> <% end %> <% if not @retain_nonstatus_information.nil? %> - retain_nonstatus_information <%= @retain_nonstatus_information? "1": "0" %> + retain_nonstatus_information <%= @retain_nonstatus_information? "1": "0" %> <% end %> <% if not @notification_interval.nil? %> - notification_interval <%= @notification_interval %> + notification_interval <%= @notification_interval %> <% end %> <% if not @first_notification_delay.nil? %> - first_notification_delay <%= @first_notification_delay %> + first_notification_delay <%= @first_notification_delay %> <% end %> <% if not @notification_period.nil? %> - notification_period <%= @notification_period %> + notification_period <%= @notification_period %> <% end %> <% if not @notification_options.nil? %> - notification_options <%= @notification_options.map{|e| e.to_s[0,1]}.join(",") %> + notification_options <%= @notification_options.map{|e| e.to_s[0,1]}.join(",") %> <% end %> <% if not @notifications_enabled.nil? %> - notifications_enabled <%= @notifications_enabled?"1":"0" %> + notifications_enabled <%= @notifications_enabled?"1":"0" %> <% end %> <% if not @contacts.nil? and not @contacts.empty?%> - contacts <%= @contacts.join(",") %> + contacts <%= @contacts.join(",") %> <% end %> <% if not @contact_groups.nil? %> - contact_groups <%= @contact_groups.join(",") %> + contact_groups <%= @contact_groups.join(",") %> <% end %> <% if not @stalking_options.nil? %> - stalking_options <%= @stalking_options.map{|e| e.to_s[0,1]}.join(",") %> + stalking_options <%= @stalking_options.map{|e| e.to_s[0,1]}.join(",") %> <% end %> <% if not @notes.nil? %> - notes <%= @notes %> + notes <%= @notes %> <% end %> <% if not @notes_url.nil? %> - notes_url <%= @notes_url %> + notes_url <%= @notes_url %> <% end %> <% if not @action_url.nil? %> - action_url <%= @action_url %> + action_url <%= @action_url %> <% end %> <% if not @icon_image.nil? %> - icon_image <%= @icon_image %> + icon_image <%= @icon_image %> <% end %> <% if not @icon_image_alt.nil? %> - icon_image_alt <%= @icon_image_alt %> + icon_image_alt <%= @icon_image_alt %> <% end %> - - - - - register <%= @register ? "1": "0" %> - + register <%= @register ? "1": "0" %> <% if @use %> - use <%= @use.join(",") %> + use <%= @use.join(",") %> <% end %> } From 9adde67c6e259783b77abbd2112df4232393a22f Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Mon, 17 Jun 2013 23:19:43 +0300 Subject: [PATCH 03/56] change daemon module list to use parameter. --- providers/daemon.rb | 1 + recipes/arbiter.rb | 8 +------- resources/daemon.rb | 1 + templates/default/arbiter/daemon.cfg.erb | 4 ++-- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/providers/daemon.rb b/providers/daemon.rb index 54f9a71..e3922a2 100644 --- a/providers/daemon.rb +++ b/providers/daemon.rb @@ -7,6 +7,7 @@ variables({ "daemon_type" => new_resource.daemon_type, "variables" => new_resource.variables, + "modules" => new_resource.modules, "address" => new_resource.address, "port" => new_resource.port, "name" => new_resource.name diff --git a/recipes/arbiter.rb b/recipes/arbiter.rb index 21a1413..b6716ef 100644 --- a/recipes/arbiter.rb +++ b/recipes/arbiter.rb @@ -84,15 +84,9 @@ port n["shinken"][daemon.to_s]["port"] variables n["shinken"][daemon.to_s]["variables"] + modules n["shinken"][daemon.to_s]["modules"] end - (n["shinken"][daemon.to_s]["modules"] || {}).each_pair do |k, v| - shinken_module k do - module_type v["type"].to_sym - variables v["variables"] - modules v["modules"] || [] - end - end end end diff --git a/resources/daemon.rb b/resources/daemon.rb index 5046e4e..9b5183b 100644 --- a/resources/daemon.rb +++ b/resources/daemon.rb @@ -13,6 +13,7 @@ } attribute :variables, :kind_of => Hash +attribute :modules, :kind_of => Array attribute :address, :kind_of => String, :required => true attribute :port, :kind_of => Integer, :required => true diff --git a/templates/default/arbiter/daemon.cfg.erb b/templates/default/arbiter/daemon.cfg.erb index 3940798..60a168c 100644 --- a/templates/default/arbiter/daemon.cfg.erb +++ b/templates/default/arbiter/daemon.cfg.erb @@ -7,10 +7,10 @@ define <%= @daemon_type.to_s %> { port <%= @port %> <% if @modules %> - modules <%= @modules.join(" ") %> + modules <%= @modules.join(", ") %> <% end %> -<% Hash.new(@variables.to_a.sort).each do |key, value| %> +<% @variables.to_a.sort.each do |key, value| %> <%= key %> <%= value %> <% end %> From 48f7d531c6b311c8d9a54649d49ab5cac98605c4 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Mon, 17 Jun 2013 23:27:02 +0300 Subject: [PATCH 04/56] add missing attributes to host template --- .../default/definitions/hosts/host.cfg.erb | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/templates/default/definitions/hosts/host.cfg.erb b/templates/default/definitions/hosts/host.cfg.erb index 82a6d70..dd434e1 100644 --- a/templates/default/definitions/hosts/host.cfg.erb +++ b/templates/default/definitions/hosts/host.cfg.erb @@ -59,8 +59,21 @@ define host { <% if not @process_perf_data.nil? %> process_perf_data <%= @process_perf_data %> <% end %> - - +<% if not @notes.nil? %> + notes <%= @notes %> +<% end %> +<% if not @notes_url.nil? %> + notes_url <%= @notes_url %> +<% end %> +<% if not @action_url.nil? %> + action_url <%= @action_url %> +<% end %> +<% if not @icon_image.nil? %> + icon_image <%= @icon_image %> +<% end %> +<% if not @icon_image_alt.nil? %> + icon_image_alt <%= @icon_image_alt %> +<% end %> register <%= @register ? "1": "0" %> From 4a4203d28de044fb717104de0c0a18a4941ff0dd Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Mon, 17 Jun 2013 23:28:28 +0300 Subject: [PATCH 05/56] allow no content for timeperiods. --- templates/default/definitions/timeperiods/timeperiod.cfg.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/default/definitions/timeperiods/timeperiod.cfg.erb b/templates/default/definitions/timeperiods/timeperiod.cfg.erb index bfde1a6..7bb691f 100644 --- a/templates/default/definitions/timeperiods/timeperiod.cfg.erb +++ b/templates/default/definitions/timeperiods/timeperiod.cfg.erb @@ -15,9 +15,11 @@ define timeperiod { <% if not @exclude.nil? %> exclude <%= @exclude.join(",") %> <% end %> +<% if not @content.nil? %> <% @content.each do |line| %> <%= line %> <% end %> +<% end %> <% if not @register.nil? %> register <%= @register?"1":"0" %> From a4276de5258df777d445de5804f55fb356aee90d Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Mon, 17 Jun 2013 23:31:07 +0300 Subject: [PATCH 06/56] add example roles and data bags. bump version. --- README.md | 18 +++++++++ .../shinken_commands/check_host_alive.json | 7 ++++ .../notify_host_by_email.json | 6 +++ .../shinken_commands/notify_host_by_xmpp.json | 6 +++ .../notify_service_by_email.json | 6 +++ .../notify_service_by_xmpp.json | 6 +++ .../shinken_contact_templates/admin.json | 11 +++++ .../client-contact.json | 6 +++ .../deployment-contact.json | 10 +++++ .../generic_contact.json | 11 +++++ .../shinken_contacts/deployment.json | 7 ++++ .../shinken_escalations/deployment_email.json | 9 +++++ .../shinken_escalations/sysadmin_email.json | 9 +++++ .../shinken_host_templates/centos-host.json | 7 ++++ .../shinken_host_templates/generic-host.json | 20 ++++++++++ .../shinken_host_templates/no-chef-host.json | 6 +++ .../shinken_host_templates/windows-host.json | 7 ++++ .../data_bags/shinken_hostgroups/all.json | 5 +++ .../data_bags/shinken_hostgroups/no_chef.json | 5 +++ examples/data_bags/shinken_hosts/jira.json | 8 ++++ examples/data_bags/shinken_hosts/tomcat.json | 8 ++++ examples/data_bags/shinken_hosts/windows.json | 8 ++++ .../data_bags/shinken_hosts/wordpress.json | 8 ++++ .../shinken_modules/apache_passwd.json | 7 ++++ .../shinken_modules/commandfile.json | 7 ++++ .../data_bags/shinken_modules/livestatus.json | 9 +++++ .../data_bags/shinken_modules/mongodb.json | 8 ++++ .../data_bags/shinken_modules/mongologs.json | 7 ++++ .../data_bags/shinken_modules/npcdmod.json | 7 ++++ .../shinken_modules/nrpe_booster.json | 4 ++ .../shinken_modules/pickle_retention.json | 7 ++++ .../pickle_retention_arbiter.json | 7 ++++ .../pickle_retention_broker.json | 7 ++++ .../data_bags/shinken_modules/pnp_ui.json | 7 ++++ .../data_bags/shinken_modules/simplelog.json | 8 ++++ .../data_bags/shinken_modules/syslog.json | 4 ++ examples/data_bags/shinken_modules/webui.json | 14 +++++++ .../shinken_notificationways/email.json | 9 +++++ .../shinken_notificationways/xmpp.json | 9 +++++ .../daily-service.json | 11 +++++ .../generic-service.json | 25 ++++++++++++ examples/data_bags/shinken_services/disk.json | 12 ++++++ examples/data_bags/shinken_services/dns.json | 11 +++++ examples/data_bags/shinken_services/http.json | 11 +++++ .../data_bags/shinken_services/https.json | 11 +++++ .../data_bags/shinken_services/iftraffic.json | 11 +++++ examples/data_bags/shinken_services/load.json | 12 ++++++ .../data_bags/shinken_services/mailq.json | 11 +++++ examples/data_bags/shinken_services/mem.json | 13 ++++++ examples/data_bags/shinken_services/nrpe.json | 11 +++++ examples/data_bags/shinken_services/ntp.json | 11 +++++ .../data_bags/shinken_services/procs.json | 12 ++++++ .../shinken_services/shinken_arbiter.json | 11 +++++ .../shinken_services/shinken_broker.json | 12 ++++++ .../shinken_services/shinken_poller.json | 12 ++++++ .../shinken_services/shinken_reactionner.json | 12 ++++++ .../shinken_services/shinken_scheduler.json | 12 ++++++ examples/data_bags/shinken_services/ssh.json | 11 +++++ examples/data_bags/shinken_services/swap.json | 12 ++++++ .../data_bags/shinken_services/updates.json | 13 ++++++ .../data_bags/shinken_services/win_disk.json | 12 ++++++ .../data_bags/shinken_services/win_fw.json | 12 ++++++ .../data_bags/shinken_services/win_load.json | 12 ++++++ .../data_bags/shinken_services/win_mem.json | 12 ++++++ .../data_bags/shinken_services/win_nrpe.json | 11 +++++ .../shinken_services/win_rdesktop.json | 11 +++++ .../shinken_services/win_updates.json | 13 ++++++ .../shinken_services/zombie_procs.json | 12 ++++++ .../data_bags/shinken_timeperiods/24x7.json | 6 +++ .../data_bags/shinken_timeperiods/none.json | 5 +++ .../shinken_timeperiods/work_hours.json | 6 +++ examples/roles/shinken.rb | 40 +++++++++++++++++++ examples/roles/shinken_poller.rb | 10 +++++ examples/roles/shinken_remotepoller.rb | 13 ++++++ metadata.rb | 2 +- 75 files changed, 748 insertions(+), 1 deletion(-) create mode 100644 examples/data_bags/shinken_commands/check_host_alive.json create mode 100644 examples/data_bags/shinken_commands/notify_host_by_email.json create mode 100644 examples/data_bags/shinken_commands/notify_host_by_xmpp.json create mode 100644 examples/data_bags/shinken_commands/notify_service_by_email.json create mode 100644 examples/data_bags/shinken_commands/notify_service_by_xmpp.json create mode 100644 examples/data_bags/shinken_contact_templates/admin.json create mode 100644 examples/data_bags/shinken_contact_templates/client-contact.json create mode 100644 examples/data_bags/shinken_contact_templates/deployment-contact.json create mode 100644 examples/data_bags/shinken_contact_templates/generic_contact.json create mode 100644 examples/data_bags/shinken_contacts/deployment.json create mode 100644 examples/data_bags/shinken_escalations/deployment_email.json create mode 100644 examples/data_bags/shinken_escalations/sysadmin_email.json create mode 100644 examples/data_bags/shinken_host_templates/centos-host.json create mode 100644 examples/data_bags/shinken_host_templates/generic-host.json create mode 100644 examples/data_bags/shinken_host_templates/no-chef-host.json create mode 100644 examples/data_bags/shinken_host_templates/windows-host.json create mode 100644 examples/data_bags/shinken_hostgroups/all.json create mode 100644 examples/data_bags/shinken_hostgroups/no_chef.json create mode 100644 examples/data_bags/shinken_hosts/jira.json create mode 100644 examples/data_bags/shinken_hosts/tomcat.json create mode 100644 examples/data_bags/shinken_hosts/windows.json create mode 100644 examples/data_bags/shinken_hosts/wordpress.json create mode 100644 examples/data_bags/shinken_modules/apache_passwd.json create mode 100644 examples/data_bags/shinken_modules/commandfile.json create mode 100644 examples/data_bags/shinken_modules/livestatus.json create mode 100644 examples/data_bags/shinken_modules/mongodb.json create mode 100644 examples/data_bags/shinken_modules/mongologs.json create mode 100644 examples/data_bags/shinken_modules/npcdmod.json create mode 100644 examples/data_bags/shinken_modules/nrpe_booster.json create mode 100644 examples/data_bags/shinken_modules/pickle_retention.json create mode 100644 examples/data_bags/shinken_modules/pickle_retention_arbiter.json create mode 100644 examples/data_bags/shinken_modules/pickle_retention_broker.json create mode 100644 examples/data_bags/shinken_modules/pnp_ui.json create mode 100644 examples/data_bags/shinken_modules/simplelog.json create mode 100644 examples/data_bags/shinken_modules/syslog.json create mode 100644 examples/data_bags/shinken_modules/webui.json create mode 100644 examples/data_bags/shinken_notificationways/email.json create mode 100644 examples/data_bags/shinken_notificationways/xmpp.json create mode 100644 examples/data_bags/shinken_service_templates/daily-service.json create mode 100644 examples/data_bags/shinken_service_templates/generic-service.json create mode 100644 examples/data_bags/shinken_services/disk.json create mode 100644 examples/data_bags/shinken_services/dns.json create mode 100644 examples/data_bags/shinken_services/http.json create mode 100644 examples/data_bags/shinken_services/https.json create mode 100644 examples/data_bags/shinken_services/iftraffic.json create mode 100644 examples/data_bags/shinken_services/load.json create mode 100644 examples/data_bags/shinken_services/mailq.json create mode 100644 examples/data_bags/shinken_services/mem.json create mode 100644 examples/data_bags/shinken_services/nrpe.json create mode 100644 examples/data_bags/shinken_services/ntp.json create mode 100644 examples/data_bags/shinken_services/procs.json create mode 100644 examples/data_bags/shinken_services/shinken_arbiter.json create mode 100644 examples/data_bags/shinken_services/shinken_broker.json create mode 100644 examples/data_bags/shinken_services/shinken_poller.json create mode 100644 examples/data_bags/shinken_services/shinken_reactionner.json create mode 100644 examples/data_bags/shinken_services/shinken_scheduler.json create mode 100644 examples/data_bags/shinken_services/ssh.json create mode 100644 examples/data_bags/shinken_services/swap.json create mode 100644 examples/data_bags/shinken_services/updates.json create mode 100644 examples/data_bags/shinken_services/win_disk.json create mode 100644 examples/data_bags/shinken_services/win_fw.json create mode 100644 examples/data_bags/shinken_services/win_load.json create mode 100644 examples/data_bags/shinken_services/win_mem.json create mode 100644 examples/data_bags/shinken_services/win_nrpe.json create mode 100644 examples/data_bags/shinken_services/win_rdesktop.json create mode 100644 examples/data_bags/shinken_services/win_updates.json create mode 100644 examples/data_bags/shinken_services/zombie_procs.json create mode 100644 examples/data_bags/shinken_timeperiods/24x7.json create mode 100644 examples/data_bags/shinken_timeperiods/none.json create mode 100644 examples/data_bags/shinken_timeperiods/work_hours.json create mode 100644 examples/roles/shinken.rb create mode 100644 examples/roles/shinken_poller.rb create mode 100644 examples/roles/shinken_remotepoller.rb diff --git a/README.md b/README.md index 2dd1db1..0a75a99 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,24 @@ There is a number of roles which are available to you: - ``shinken-poller`` - ``shinken-scheduler`` +To use the recipes, you must create the following data bags: + +shinken_commands +shinken_contacts +shinken_contact_templates +shinken_escalations +shinken_hostgroups +shinken_hosts +shinken_host_templates +shinken_modules +shinken_notificationways +shinken_servicegroups +shinken_services +shinken_service_templates +shinken_timeperiods + +See the examples directory for example roles and data bag entries. + ## License and author Copyright 2013, Arthur Gautier diff --git a/examples/data_bags/shinken_commands/check_host_alive.json b/examples/data_bags/shinken_commands/check_host_alive.json new file mode 100644 index 0000000..7770e12 --- /dev/null +++ b/examples/data_bags/shinken_commands/check_host_alive.json @@ -0,0 +1,7 @@ +{ + "id": "check_host_alive", + "command_name": "check_host_alive", + "command": "$PLUGINSDIR$/check_ping", + "arguments": ["-H", "$HOSTADDRESS$", "-w", "1000,100%", "-c", "3000,100%", "-p", "1"] +} + diff --git a/examples/data_bags/shinken_commands/notify_host_by_email.json b/examples/data_bags/shinken_commands/notify_host_by_email.json new file mode 100644 index 0000000..42bd590 --- /dev/null +++ b/examples/data_bags/shinken_commands/notify_host_by_email.json @@ -0,0 +1,6 @@ +{ + "id": "notify_host_by_email", + "command_name": "notify_host_by_email", + "command": "/usr/bin/printf", + "arguments": [ "\"%b\"", "\"Shinken Notification\\n\\nType:$NOTIFICATIONTYPE$\\nHost: $HOSTNAME$\\nState: $HOSTSTATE$\\nAddress: $HOSTADDRESS$\\nInfo: $HOSTOUTPUT$\\nDate/Time: $DATE$\\n\"", "|", "/bin/mail", "-s", "\"Host $HOSTSTATE$ alert for $HOSTNAME$!\" $CONTACTEMAIL$"] +} diff --git a/examples/data_bags/shinken_commands/notify_host_by_xmpp.json b/examples/data_bags/shinken_commands/notify_host_by_xmpp.json new file mode 100644 index 0000000..dde5f7f --- /dev/null +++ b/examples/data_bags/shinken_commands/notify_host_by_xmpp.json @@ -0,0 +1,6 @@ +{ + "id": "notify_host_by_xmpp", + "command_name": "notify_host_by_xmpp", + "command": "/usr/local/bin/xmppsend", + "arguments": ["-a", "/usr/local/etc/xmppsend.ini", "\"$NOTIFICATIONTYPE$: Host '$HOSTNAME$' is $HOSTSTATE$: $HOSTOUTPUT$\"", "$CONTACTPAGER$"] +} diff --git a/examples/data_bags/shinken_commands/notify_service_by_email.json b/examples/data_bags/shinken_commands/notify_service_by_email.json new file mode 100644 index 0000000..8a9cf1e --- /dev/null +++ b/examples/data_bags/shinken_commands/notify_service_by_email.json @@ -0,0 +1,6 @@ +{ + "id": "notify_service_by_email", + "command_name": "notify_service_by_email", + "command": "/usr/bin/printf", + "arguments": [ "\"%b\"", "\"Shinken Notification\\n\\nNotification Type: $NOTIFICATIONTYPE$\\n\\nService: $SERVICEDESC$\\nHost: $HOSTALIAS$\\nAddress: $HOSTADDRESS$\\nState: $SERVICESTATE$\\n\\nDate/Time: $DATE$ Additional Info : $SERVICEOUTPUT$\\n\"", "|", "/bin/mail", "-s", "\"** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **\" $CONTACTEMAIL$"] +} diff --git a/examples/data_bags/shinken_commands/notify_service_by_xmpp.json b/examples/data_bags/shinken_commands/notify_service_by_xmpp.json new file mode 100644 index 0000000..b3b1557 --- /dev/null +++ b/examples/data_bags/shinken_commands/notify_service_by_xmpp.json @@ -0,0 +1,6 @@ +{ + "id": "notify_service_by_xmpp", + "command_name": "notify_service_by_xmpp", + "command": "/usr/local/bin/xmppsend", + "arguments": ["-a", "/usr/local/etc/xmppsend.ini", "\"$NOTIFICATIONTYPE$: Service $HOSTNAME$ $SERVICEDESC$ is $SERVICESTATE$: $SERVICEOUTPUT$\"", "$CONTACTPAGER$"] +} diff --git a/examples/data_bags/shinken_contact_templates/admin.json b/examples/data_bags/shinken_contact_templates/admin.json new file mode 100644 index 0000000..1549bc8 --- /dev/null +++ b/examples/data_bags/shinken_contact_templates/admin.json @@ -0,0 +1,11 @@ +{ + "id": "admin", + "use": ["generic-contact"], + "host_notifications_enabled": true, + "service_notifications_enabled": true, + "email": "sitealerts@example.com", + "can_submit_commands": true, + "notificationways": ["xmpp"], + "is_admin": true, + "register": false +} diff --git a/examples/data_bags/shinken_contact_templates/client-contact.json b/examples/data_bags/shinken_contact_templates/client-contact.json new file mode 100644 index 0000000..aa51eef --- /dev/null +++ b/examples/data_bags/shinken_contact_templates/client-contact.json @@ -0,0 +1,6 @@ +{ + "id": "client-contact", + "use": ["generic-contact"], + "is_admin": false, + "register": false +} diff --git a/examples/data_bags/shinken_contact_templates/deployment-contact.json b/examples/data_bags/shinken_contact_templates/deployment-contact.json new file mode 100644 index 0000000..ecd1f1b --- /dev/null +++ b/examples/data_bags/shinken_contact_templates/deployment-contact.json @@ -0,0 +1,10 @@ +{ + "id": "deployment-contact", + "use": ["generic-contact"], + "host_notifications_enabled": true, + "service_notifications_enabled": true, + "email": "deployment@exampl.com", + "notificationways": ["email"], + "is_admin": false, + "register": false +} diff --git a/examples/data_bags/shinken_contact_templates/generic_contact.json b/examples/data_bags/shinken_contact_templates/generic_contact.json new file mode 100644 index 0000000..827a490 --- /dev/null +++ b/examples/data_bags/shinken_contact_templates/generic_contact.json @@ -0,0 +1,11 @@ +{ + "id": "generic-contact", + "host_notifications_enabled": false, + "service_notifications_enabled": false, + "email": "root@localhost", + "can_submit_commands": false, + "notificationways": ["email"], + "contactgroups": "+all", + "is_admin": true, + "register": false +} diff --git a/examples/data_bags/shinken_contacts/deployment.json b/examples/data_bags/shinken_contacts/deployment.json new file mode 100644 index 0000000..179acc7 --- /dev/null +++ b/examples/data_bags/shinken_contacts/deployment.json @@ -0,0 +1,7 @@ +{ + "id": "deployment", + "comment": "Deployment User", + "email": "deployment@example.com", + "groups": ["deployment"], + "use": ["deployment-contact"] +} diff --git a/examples/data_bags/shinken_escalations/deployment_email.json b/examples/data_bags/shinken_escalations/deployment_email.json new file mode 100644 index 0000000..333e3b1 --- /dev/null +++ b/examples/data_bags/shinken_escalations/deployment_email.json @@ -0,0 +1,9 @@ +{ + "id": "deployment_email", + "first_notification_time": 30, + "last_notification_time": 0, + "notification_interval": 60, + "escalation_period": "24x7", + "escalation_options": [ "critical", "recovery"], + "contact_groups": ["deployment"] +} diff --git a/examples/data_bags/shinken_escalations/sysadmin_email.json b/examples/data_bags/shinken_escalations/sysadmin_email.json new file mode 100644 index 0000000..dca7287 --- /dev/null +++ b/examples/data_bags/shinken_escalations/sysadmin_email.json @@ -0,0 +1,9 @@ +{ + "id": "sysadmin_email", + "first_notification_time": 60, + "last_notification_time": 0, + "notification_interval": 60, + "escalation_period": "24x7", + "escalation_options": ["warning", "unknown", "critical", "recovery"], + "contact_groups": ["sysadmin"] +} \ No newline at end of file diff --git a/examples/data_bags/shinken_host_templates/centos-host.json b/examples/data_bags/shinken_host_templates/centos-host.json new file mode 100644 index 0000000..de69a8b --- /dev/null +++ b/examples/data_bags/shinken_host_templates/centos-host.json @@ -0,0 +1,7 @@ +{ + "id": "centos-host", + "use": ["generic-service"], + "hostgroups": ["+linux", "centos"], + "icon_image": "centos.png", + "icon_image_alt": "Centos" +} \ No newline at end of file diff --git a/examples/data_bags/shinken_host_templates/generic-host.json b/examples/data_bags/shinken_host_templates/generic-host.json new file mode 100644 index 0000000..82837a8 --- /dev/null +++ b/examples/data_bags/shinken_host_templates/generic-host.json @@ -0,0 +1,20 @@ +{ + "id": "generic-host", + "hostgroups": ["+all"], + "check_command": "check_host_alive", + "max_check_attempts": 2, + "check_interval": 5, + "active_checks_enabled": true, + "check_period": "24x7", + "contact_groups": ["sysadmin"], + "notification_interval": 60, + "notification_period": "24x7", + "notification_options": ["down", "unreachable", "recovery", "flapping"], + "notifications_enabled": true, + "event_handler_enabled": true, + "flap_detection_enabled": true, + "process_perf_data": true, + "notes_url": "/pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_", + "escalations": "deployment_email", + "register": false +} diff --git a/examples/data_bags/shinken_host_templates/no-chef-host.json b/examples/data_bags/shinken_host_templates/no-chef-host.json new file mode 100644 index 0000000..75e305e --- /dev/null +++ b/examples/data_bags/shinken_host_templates/no-chef-host.json @@ -0,0 +1,6 @@ +{ + "id": "no-chef-host", + "hostgroups": ["+no_chef", "monitoring"], + "use": ["generic-host"], + "register": false +} diff --git a/examples/data_bags/shinken_host_templates/windows-host.json b/examples/data_bags/shinken_host_templates/windows-host.json new file mode 100644 index 0000000..683d445 --- /dev/null +++ b/examples/data_bags/shinken_host_templates/windows-host.json @@ -0,0 +1,7 @@ +{ + "id": "windows-host", + "use": ["generic-service"], + "hostgroups": ["windows"], + "icon_image": "win40.png", + "icon_image_alt": "Windows" +} \ No newline at end of file diff --git a/examples/data_bags/shinken_hostgroups/all.json b/examples/data_bags/shinken_hostgroups/all.json new file mode 100644 index 0000000..e22768b --- /dev/null +++ b/examples/data_bags/shinken_hostgroups/all.json @@ -0,0 +1,5 @@ +{ + "id": "all", + "hostgroup_name": "all", + "hostgroup_alias": "All" +} \ No newline at end of file diff --git a/examples/data_bags/shinken_hostgroups/no_chef.json b/examples/data_bags/shinken_hostgroups/no_chef.json new file mode 100644 index 0000000..546f12d --- /dev/null +++ b/examples/data_bags/shinken_hostgroups/no_chef.json @@ -0,0 +1,5 @@ +{ + "id": "no_chef", + "hostgroup_name": "no_chef", + "hostgroup_alias": "no_chef" +} \ No newline at end of file diff --git a/examples/data_bags/shinken_hosts/jira.json b/examples/data_bags/shinken_hosts/jira.json new file mode 100644 index 0000000..43aa8e7 --- /dev/null +++ b/examples/data_bags/shinken_hosts/jira.json @@ -0,0 +1,8 @@ +{ + "id": "jira", + "host_name": "jira", + "address": " 1.2.3.5", + "host_alias": "jira.example.com", + "hostgroups": ["+prod", "mysql-master", "mysql", "jira"], + "use": ["no-chef-host","centos-host","generic-host"] +} diff --git a/examples/data_bags/shinken_hosts/tomcat.json b/examples/data_bags/shinken_hosts/tomcat.json new file mode 100644 index 0000000..9f4515c --- /dev/null +++ b/examples/data_bags/shinken_hosts/tomcat.json @@ -0,0 +1,8 @@ +{ + "id": "tomcat", + "host_name": "tomcat", + "address": "1.2.3.8", + "host_alias": "tomcat.example.com", + "hostgroups": ["+prod", "example.com", "tomcat"], + "use": ["no-chef-host","centos-host","generic-host"] +} diff --git a/examples/data_bags/shinken_hosts/windows.json b/examples/data_bags/shinken_hosts/windows.json new file mode 100644 index 0000000..bec205e --- /dev/null +++ b/examples/data_bags/shinken_hosts/windows.json @@ -0,0 +1,8 @@ +{ + "id": "windows", + "host_name": "windows", + "address": "1.2.3.7", + "host_alias": "windows.example.com", + "hostgroups": ["+prod", "bi"], + "use": ["no-chef-host","windows-host","generic-host"] +} diff --git a/examples/data_bags/shinken_hosts/wordpress.json b/examples/data_bags/shinken_hosts/wordpress.json new file mode 100644 index 0000000..40cb41f --- /dev/null +++ b/examples/data_bags/shinken_hosts/wordpress.json @@ -0,0 +1,8 @@ +{ + "id": "wordpress", + "host_name": "wordpress", + "address": "1.2.3.6", + "host_alias": "wordpress.example.com", + "hostgroups": ["+prod", "mysql-master", "wordpress"], + "use": ["no-chef-host","centos-host","generic-host"] +} diff --git a/examples/data_bags/shinken_modules/apache_passwd.json b/examples/data_bags/shinken_modules/apache_passwd.json new file mode 100644 index 0000000..fbb1b53 --- /dev/null +++ b/examples/data_bags/shinken_modules/apache_passwd.json @@ -0,0 +1,7 @@ +{ + "id": "Apache_passwd", + "type": "passwd_webui", + "variables": { + "passwd": "/etc/shinken/htpasswd.users" + } +} diff --git a/examples/data_bags/shinken_modules/commandfile.json b/examples/data_bags/shinken_modules/commandfile.json new file mode 100644 index 0000000..e6c804d --- /dev/null +++ b/examples/data_bags/shinken_modules/commandfile.json @@ -0,0 +1,7 @@ +{ + "id": "CommandFile", + "type": "named_pipe", + "variables": { + "command_file": "rw/nagios.cmd" + } +} diff --git a/examples/data_bags/shinken_modules/livestatus.json b/examples/data_bags/shinken_modules/livestatus.json new file mode 100644 index 0000000..4da7de2 --- /dev/null +++ b/examples/data_bags/shinken_modules/livestatus.json @@ -0,0 +1,9 @@ +{ + "id": "Livestatus", + "type": "livestatus", + "variables": { + "host": "*", + "port": "50000" + }, + "modules": ["mongologs"] +} diff --git a/examples/data_bags/shinken_modules/mongodb.json b/examples/data_bags/shinken_modules/mongodb.json new file mode 100644 index 0000000..fb76506 --- /dev/null +++ b/examples/data_bags/shinken_modules/mongodb.json @@ -0,0 +1,8 @@ +{ + "id": "Mongodb", + "type": "mongodb", + "variables": { + "uri": "mongodb://localhost/?safe=true", + "database": "shinken" + } +} diff --git a/examples/data_bags/shinken_modules/mongologs.json b/examples/data_bags/shinken_modules/mongologs.json new file mode 100644 index 0000000..0b31905 --- /dev/null +++ b/examples/data_bags/shinken_modules/mongologs.json @@ -0,0 +1,7 @@ +{ + "id": "mongologs", + "type": "logstore_mongodb", + "variables": { + "mongodb_uri": "mongodb://localhost/?safe=true" + } +} diff --git a/examples/data_bags/shinken_modules/npcdmod.json b/examples/data_bags/shinken_modules/npcdmod.json new file mode 100644 index 0000000..b456364 --- /dev/null +++ b/examples/data_bags/shinken_modules/npcdmod.json @@ -0,0 +1,7 @@ +{ + "id": "NPCDMOD", + "type": "npcdmod", + "variables": { + "config_file": "/etc/pnp4nagios/npcd.cfg" + } +} diff --git a/examples/data_bags/shinken_modules/nrpe_booster.json b/examples/data_bags/shinken_modules/nrpe_booster.json new file mode 100644 index 0000000..c3c7e59 --- /dev/null +++ b/examples/data_bags/shinken_modules/nrpe_booster.json @@ -0,0 +1,4 @@ +{ + "id": "NrpeBooster", + "type": "nrpe_poller" +} diff --git a/examples/data_bags/shinken_modules/pickle_retention.json b/examples/data_bags/shinken_modules/pickle_retention.json new file mode 100644 index 0000000..d47de58 --- /dev/null +++ b/examples/data_bags/shinken_modules/pickle_retention.json @@ -0,0 +1,7 @@ +{ + "id": "PickleRetention", + "type": "pickle_retention_file_generic", + "variables": { + "path": "/tmp/retention.dat" + } +} diff --git a/examples/data_bags/shinken_modules/pickle_retention_arbiter.json b/examples/data_bags/shinken_modules/pickle_retention_arbiter.json new file mode 100644 index 0000000..a8a326d --- /dev/null +++ b/examples/data_bags/shinken_modules/pickle_retention_arbiter.json @@ -0,0 +1,7 @@ +{ + "id": "PickleRetentionAribiter", + "type": "pickle_retention_file_generic", + "variables": { + "path": "/var/tmp/retention_arbiter.dat" + } +} diff --git a/examples/data_bags/shinken_modules/pickle_retention_broker.json b/examples/data_bags/shinken_modules/pickle_retention_broker.json new file mode 100644 index 0000000..40e5931 --- /dev/null +++ b/examples/data_bags/shinken_modules/pickle_retention_broker.json @@ -0,0 +1,7 @@ +{ + "id": "PickleRetentionBroker", + "type": "pickle_retention_file_generic", + "variables": { + "path": "/var/tmp/retention_broker.dat" + } +} diff --git a/examples/data_bags/shinken_modules/pnp_ui.json b/examples/data_bags/shinken_modules/pnp_ui.json new file mode 100644 index 0000000..b7434a0 --- /dev/null +++ b/examples/data_bags/shinken_modules/pnp_ui.json @@ -0,0 +1,7 @@ +{ + "id": "PNP_UI", + "type": "pnp_webui", + "variables": { + "uri": "http://mysite.example.com/pnp4nagios/" + } +} diff --git a/examples/data_bags/shinken_modules/simplelog.json b/examples/data_bags/shinken_modules/simplelog.json new file mode 100644 index 0000000..5bc0477 --- /dev/null +++ b/examples/data_bags/shinken_modules/simplelog.json @@ -0,0 +1,8 @@ +{ + "id": "Simple-log", + "type": "simple_log", + "variables": { + "path": "/var/log/shinken/shinken.log", + "archive_path": "archives/" + } +} diff --git a/examples/data_bags/shinken_modules/syslog.json b/examples/data_bags/shinken_modules/syslog.json new file mode 100644 index 0000000..3fe610c --- /dev/null +++ b/examples/data_bags/shinken_modules/syslog.json @@ -0,0 +1,4 @@ +{ + "id": "Syslog", + "type": "syslog" +} diff --git a/examples/data_bags/shinken_modules/webui.json b/examples/data_bags/shinken_modules/webui.json new file mode 100644 index 0000000..5c6202b --- /dev/null +++ b/examples/data_bags/shinken_modules/webui.json @@ -0,0 +1,14 @@ +{ + "id": "WebUI", + "type": "webui", + "variables": { + "host": "0.0.0.0", + "port": "7767", + "auth_secret": "put your secret here!", + "allow_html_output": "0", + "max_output_length": "100", + "manage_acl": "1", + "play_sound": "0" + }, + "modules": ["Apache_passwd", "Mongodb", "PNP_UI"] +} diff --git a/examples/data_bags/shinken_notificationways/email.json b/examples/data_bags/shinken_notificationways/email.json new file mode 100644 index 0000000..b650cf8 --- /dev/null +++ b/examples/data_bags/shinken_notificationways/email.json @@ -0,0 +1,9 @@ +{ + "id": "email", + "service_notification_period": "24x7", + "host_notification_period": "24x7", + "service_notification_options": ["warning", "unknown", "critical", "recovery"], + "host_notification_options": ["down", "unreachable", "recovery", "flapping"], + "service_notification_commands": "notify_service_by_email", + "host_notification_commands": "notify_host_by_email" +} diff --git a/examples/data_bags/shinken_notificationways/xmpp.json b/examples/data_bags/shinken_notificationways/xmpp.json new file mode 100644 index 0000000..beb60aa --- /dev/null +++ b/examples/data_bags/shinken_notificationways/xmpp.json @@ -0,0 +1,9 @@ +{ + "id": "xmpp", + "service_notification_period": "24x7", + "host_notification_period": "24x7", + "service_notification_options": ["warning", "unknown", "critical", "recovery"], + "host_notification_options": ["down", "unreachable", "recovery", "flapping"], + "service_notification_commands": "notify_service_by_xmpp", + "host_notification_commands": "notify_host_by_xmpp" +} diff --git a/examples/data_bags/shinken_service_templates/daily-service.json b/examples/data_bags/shinken_service_templates/daily-service.json new file mode 100644 index 0000000..82d4b62 --- /dev/null +++ b/examples/data_bags/shinken_service_templates/daily-service.json @@ -0,0 +1,11 @@ +{ + "id": "daily-service", + "use": ["generic-service"], + "notification_interval": 1440, + "check_interval": 1440, + "retry_interval": 60, + "max_check_attempts": 2, + "check_period": "work_hours", + "register": false +} + diff --git a/examples/data_bags/shinken_service_templates/generic-service.json b/examples/data_bags/shinken_service_templates/generic-service.json new file mode 100644 index 0000000..d4ed109 --- /dev/null +++ b/examples/data_bags/shinken_service_templates/generic-service.json @@ -0,0 +1,25 @@ +{ + "id": "generic-service", + "contact_groups": ["sysadmin"], + "active_checks_enabled": true, + "passive_checks_enabled": true, + "check_interval": 5, + "retry_interval": 2, + "max_check_attempts": 5, + "check_period": "24x7", + "notifications_enabled": true, + "notification_options": ["warning", "unknown", "critical", "recovery"], + "notification_interval": 60, + "notification_period": "24x7", + "event_handler_enabled": true, + "flap_detection_enabled": true, + "check_freshness": false, + "freshness_threshold": 3600, + "obsess_over_service": false, + "process_perf_data": true, + "is_volatile": false, + "notes_url": "/pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$", + "escalations": "deployment_email", + "register": false +} + diff --git a/examples/data_bags/shinken_services/disk.json b/examples/data_bags/shinken_services/disk.json new file mode 100644 index 0000000..94261f8 --- /dev/null +++ b/examples/data_bags/shinken_services/disk.json @@ -0,0 +1,12 @@ +{ + "id": "disk", + "use": ["generic-service"], + "service_description": "Free disk space", + "servicegroups": ["Disk"], + "hostgroup_name": "linux", + "service_dependencies": ",NRPE", + "check_command": "check_disk", + "command_line": "$PLUGINSDIR$/check_nrpe", + "arguments": ["-H", "$HOSTADDRESS$", "-c", "check_disk"] +} + diff --git a/examples/data_bags/shinken_services/dns.json b/examples/data_bags/shinken_services/dns.json new file mode 100644 index 0000000..891d739 --- /dev/null +++ b/examples/data_bags/shinken_services/dns.json @@ -0,0 +1,11 @@ +{ + "id": "dns", + "use": ["generic-service"], + "service_description": "DNS", + "servicegroups": ["DNS"], + "hostgroup_name": "linux", + "service_dependencies": ",NRPE", + "check_command": "check_dns", + "command_line": "$PLUGINSDIR$/check_nrpe", + "arguments": ["-H", "$HOSTADDRESS$", "-c", "check_dns"] +} diff --git a/examples/data_bags/shinken_services/http.json b/examples/data_bags/shinken_services/http.json new file mode 100644 index 0000000..3b98d28 --- /dev/null +++ b/examples/data_bags/shinken_services/http.json @@ -0,0 +1,11 @@ +{ + "id": "http", + "use": ["generic-service"], + "service_description": "HTTP", + "servicegroups": ["HTTP"], + "hostgroup_name": "shinken,chef_server,wordpress,wiki,bi", + "check_command": "check_http", + "command_line": "$PLUGINSDIR$/check_http", + "arguments": ["-H", "$HOSTADDRESS$", "-u", "/monitor-ignore", "-e", "404,301,302"] +} + diff --git a/examples/data_bags/shinken_services/https.json b/examples/data_bags/shinken_services/https.json new file mode 100644 index 0000000..6c6e1c1 --- /dev/null +++ b/examples/data_bags/shinken_services/https.json @@ -0,0 +1,11 @@ +{ + "id": "https", + "use": ["generic-service"], + "service_description": "HTTPS", + "servicegroups": ["HTTPS"], + "hostgroup_name": "chef_server,jira", + "check_command": "check_https", + "command_line": "$PLUGINSDIR$/check_http", + "arguments": ["-H", "$HOSTADDRESS$", "-S", "-u", "/monitor-ignore", "-e", "404,301"] +} + diff --git a/examples/data_bags/shinken_services/iftraffic.json b/examples/data_bags/shinken_services/iftraffic.json new file mode 100644 index 0000000..72f7542 --- /dev/null +++ b/examples/data_bags/shinken_services/iftraffic.json @@ -0,0 +1,11 @@ +{ + "id": "iftraffic", + "use": ["generic-service"], + "service_description": "Network traffic", + "servicegroups": ["Network traffic"], + "hostgroup_name": "linux", + "service_dependencies": ",NRPE", + "check_command": "check_iftraffic", + "command_line": "$PLUGINSDIR$/check_nrpe", + "arguments": ["-H", "$HOSTADDRESS$", "-c", "check_iftraffic"] +} diff --git a/examples/data_bags/shinken_services/load.json b/examples/data_bags/shinken_services/load.json new file mode 100644 index 0000000..58cf726 --- /dev/null +++ b/examples/data_bags/shinken_services/load.json @@ -0,0 +1,12 @@ +{ + "id": "load", + "use": ["generic-service"], + "service_description": "CPU load", + "servicegroups": ["CPU load"], + "hostgroup_name": "linux", + "service_dependencies": ",NRPE", + "check_command": "check_load", + "command_line": "$PLUGINSDIR$/check_nrpe", + "arguments": ["-H", "$HOSTADDRESS$", "-c", "check_load"] +} + diff --git a/examples/data_bags/shinken_services/mailq.json b/examples/data_bags/shinken_services/mailq.json new file mode 100644 index 0000000..0dbcf12 --- /dev/null +++ b/examples/data_bags/shinken_services/mailq.json @@ -0,0 +1,11 @@ +{ + "id": "mailq", + "use": ["generic-service"], + "service_description": "Mail queue", + "servicegroups": ["Mail queue"], + "hostgroup_name": "base", + "service_dependencies": ",NRPE", + "check_command": "check_mailq", + "command_line": "$PLUGINSDIR$/check_nrpe", + "arguments": ["-H", "$HOSTADDRESS$", "-c", "check_mailq"] +} diff --git a/examples/data_bags/shinken_services/mem.json b/examples/data_bags/shinken_services/mem.json new file mode 100644 index 0000000..7f650ba --- /dev/null +++ b/examples/data_bags/shinken_services/mem.json @@ -0,0 +1,13 @@ +{ + "id": "mem", + "use": ["generic-service"], + "service_description": "Free memory", + "servicegroups": ["Memory"], + "hostgroup_name": "linux", + "notification_period": "none", + "service_dependencies": ",NRPE", + "check_command": "check_mem", + "command_line": "$PLUGINSDIR$/check_nrpe", + "arguments": ["-H", "$HOSTADDRESS$", "-c", "check_mem"] +} + diff --git a/examples/data_bags/shinken_services/nrpe.json b/examples/data_bags/shinken_services/nrpe.json new file mode 100644 index 0000000..dc42ae7 --- /dev/null +++ b/examples/data_bags/shinken_services/nrpe.json @@ -0,0 +1,11 @@ +{ + "id": "nrpe", + "use": ["generic-service"], + "service_description": "NRPE", + "servicegroups": ["NRPE"], + "hostgroup_name": "linux", + "check_command": "check_nrpe", + "command_line": "$PLUGINSDIR$/check_nrpe", + "arguments": ["-H", "$HOSTADDRESS$", "-c", "check_dummy"] +} + diff --git a/examples/data_bags/shinken_services/ntp.json b/examples/data_bags/shinken_services/ntp.json new file mode 100644 index 0000000..6ac0d44 --- /dev/null +++ b/examples/data_bags/shinken_services/ntp.json @@ -0,0 +1,11 @@ +{ + "id": "ntp", + "use": ["generic-service"], + "service_description": "NTP", + "servicegroups": ["NTP"], + "hostgroup_name": "linux,!wiki", + "check_command": "check_ntp", + "command_line": "$PLUGINSDIR$/check_ntp_time", + "arguments": ["-H", "$HOSTADDRESS$", "-w", "30", "-c", "60"] +} + diff --git a/examples/data_bags/shinken_services/procs.json b/examples/data_bags/shinken_services/procs.json new file mode 100644 index 0000000..3fefc0a --- /dev/null +++ b/examples/data_bags/shinken_services/procs.json @@ -0,0 +1,12 @@ +{ + "id": "procs", + "use": ["generic-service"], + "service_description": "Running processes", + "servicegroups": ["Running processes"], + "hostgroup_name": "linux", + "service_dependencies": ",NRPE", + "check_command": "check_procs", + "command_line": "$PLUGINSDIR$/check_nrpe", + "arguments": ["-H", "$HOSTADDRESS$", "-c", "check_procs"] +} + diff --git a/examples/data_bags/shinken_services/shinken_arbiter.json b/examples/data_bags/shinken_services/shinken_arbiter.json new file mode 100644 index 0000000..c30139c --- /dev/null +++ b/examples/data_bags/shinken_services/shinken_arbiter.json @@ -0,0 +1,11 @@ +{ + "id": "shinken_arbiter", + "use": ["generic-service"], + "service_description": "Shinken arbiter", + "servicegroups": ["Shinken"], + "hostgroup_name": "shinken", + "check_command": "check_shinken_arbiter", + "command_line": "$USER1$/check_shinken.py", + "arguments": ["-a", "$HOSTADDRESS$", "-t", "arbiter"] +} + diff --git a/examples/data_bags/shinken_services/shinken_broker.json b/examples/data_bags/shinken_services/shinken_broker.json new file mode 100644 index 0000000..73a1335 --- /dev/null +++ b/examples/data_bags/shinken_services/shinken_broker.json @@ -0,0 +1,12 @@ +{ + "id": "shinken_broker", + "use": ["generic-service"], + "service_description": "Shinken broker", + "servicegroups": ["Shinken"], + "hostgroup_name": "shinken", + "service_dependencies": ",Shinken arbiter", + "check_command": "check_shinken_broker", + "command_line": "$USER1$/check_shinken.py", + "arguments": ["-a", "$HOSTADDRESS$", "-t", "broker"] +} + diff --git a/examples/data_bags/shinken_services/shinken_poller.json b/examples/data_bags/shinken_services/shinken_poller.json new file mode 100644 index 0000000..2e69d1d --- /dev/null +++ b/examples/data_bags/shinken_services/shinken_poller.json @@ -0,0 +1,12 @@ +{ + "id": "shinken_poller", + "use": ["generic-service"], + "service_description": "Shinken poller", + "servicegroups": ["Shinken"], + "hostgroup_name": "shinken", + "service_dependencies": ",Shinken arbiter", + "check_command": "check_shinken_poller", + "command_line": "$USER1$/check_shinken.py", + "arguments": ["-a", "$HOSTADDRESS$", "-t", "poller"] +} + diff --git a/examples/data_bags/shinken_services/shinken_reactionner.json b/examples/data_bags/shinken_services/shinken_reactionner.json new file mode 100644 index 0000000..7a2eeb9 --- /dev/null +++ b/examples/data_bags/shinken_services/shinken_reactionner.json @@ -0,0 +1,12 @@ +{ + "id": "shinken_reactionner", + "use": ["generic-service"], + "service_description": "Shinken reactionner", + "servicegroups": ["Shinken"], + "hostgroup_name": "shinken", + "service_dependencies": ",Shinken arbiter", + "check_command": "check_shinken_reactionner", + "command_line": "$USER1$/check_shinken.py", + "arguments": ["-a", "$HOSTADDRESS$", "-t", "reactionner"] +} + diff --git a/examples/data_bags/shinken_services/shinken_scheduler.json b/examples/data_bags/shinken_services/shinken_scheduler.json new file mode 100644 index 0000000..e0d9245 --- /dev/null +++ b/examples/data_bags/shinken_services/shinken_scheduler.json @@ -0,0 +1,12 @@ +{ + "id": "shinken_scheduler", + "use": ["generic-service"], + "service_description": "Shinken scheduler", + "servicegroups": ["Shinken"], + "hostgroup_name": "shinken", + "service_dependencies": ",Shinken arbiter", + "check_command": "check_shinken_scheduler", + "command_line": "$USER1$/check_shinken.py", + "arguments": ["-a", "$HOSTADDRESS$", "-t", "scheduler"] +} + diff --git a/examples/data_bags/shinken_services/ssh.json b/examples/data_bags/shinken_services/ssh.json new file mode 100644 index 0000000..1cfc185 --- /dev/null +++ b/examples/data_bags/shinken_services/ssh.json @@ -0,0 +1,11 @@ +{ + "id": "ssh", + "use": ["generic-service"], + "service_description": "SSH", + "servicegroups": ["SSH"], + "hostgroup_name": "linux", + "check_command": "check_ssh", + "command_line": "$PLUGINSDIR$/check_ssh", + "arguments": ["-H", "$HOSTADDRESS$"] +} + diff --git a/examples/data_bags/shinken_services/swap.json b/examples/data_bags/shinken_services/swap.json new file mode 100644 index 0000000..eef12eb --- /dev/null +++ b/examples/data_bags/shinken_services/swap.json @@ -0,0 +1,12 @@ +{ + "id": "swap", + "use": ["generic-service"], + "service_description": "Free swap", + "servicegroups": ["Swap"], + "hostgroup_name": "linux", + "service_dependencies": ",NRPE", + "check_command": "check_swap", + "command_line": "$PLUGINSDIR$/check_nrpe", + "arguments": ["-H", "$HOSTADDRESS$", "-c", "check_swap"] +} + diff --git a/examples/data_bags/shinken_services/updates.json b/examples/data_bags/shinken_services/updates.json new file mode 100644 index 0000000..eab3c2d --- /dev/null +++ b/examples/data_bags/shinken_services/updates.json @@ -0,0 +1,13 @@ +{ + "id": "updates", + "use": ["daily-service"], + "service_description": "Yum security updates", + "servicegroups": ["Yum security updates"], + "hostgroup_name": "centos,!no_chef", + "service_dependencies": ",NRPE", + "escalations": "null", + "check_command": "check_updates", + "command_line": "$PLUGINSDIR$/check_nrpe", + "arguments": ["-H", "$HOSTADDRESS$", "-c", "check_updates", "-t", "60"] +} + diff --git a/examples/data_bags/shinken_services/win_disk.json b/examples/data_bags/shinken_services/win_disk.json new file mode 100644 index 0000000..0adac42 --- /dev/null +++ b/examples/data_bags/shinken_services/win_disk.json @@ -0,0 +1,12 @@ +{ + "id": "win_disk", + "use": ["generic-service"], + "service_description": "Free disk space", + "servicegroups": ["Disk"], + "hostgroup_name": "windows", + "service_dependencies": ",NRPE", + "check_command": "check_win_disk", + "command_line": "$PLUGINSDIR$/check_nrpe", + "arguments": ["-H", "$HOSTADDRESS$", "-c", "alias_disk"] +} + diff --git a/examples/data_bags/shinken_services/win_fw.json b/examples/data_bags/shinken_services/win_fw.json new file mode 100644 index 0000000..5d00321 --- /dev/null +++ b/examples/data_bags/shinken_services/win_fw.json @@ -0,0 +1,12 @@ +{ + "id": "win_fw", + "use": ["generic-service"], + "service_description": "Windows Firewall", + "servicegroups": ["Firewall"], + "hostgroup_name": "windows", + "service_dependencies": ",NRPE", + "check_command": "check_win_fw", + "command_line": "$PLUGINSDIR$/check_nrpe", + "arguments": ["-H", "$HOSTADDRESS$", "-c", "alias_win_firewall"] +} + diff --git a/examples/data_bags/shinken_services/win_load.json b/examples/data_bags/shinken_services/win_load.json new file mode 100644 index 0000000..5f0320e --- /dev/null +++ b/examples/data_bags/shinken_services/win_load.json @@ -0,0 +1,12 @@ +{ + "id": "win_load", + "use": ["generic-service"], + "service_description": "CPU load", + "servicegroups": ["CPU load"], + "hostgroup_name": "windows", + "service_dependencies": ",NRPE", + "check_command": "check_win_load", + "command_line": "$PLUGINSDIR$/check_nrpe", + "arguments": ["-H", "$HOSTADDRESS$", "-c", "alias_cpu"] +} + diff --git a/examples/data_bags/shinken_services/win_mem.json b/examples/data_bags/shinken_services/win_mem.json new file mode 100644 index 0000000..b15f0c3 --- /dev/null +++ b/examples/data_bags/shinken_services/win_mem.json @@ -0,0 +1,12 @@ +{ + "id": "win_mem", + "use": ["generic-service"], + "service_description": "Free memory", + "servicegroups": ["Memory"], + "hostgroup_name": "windows", + "service_dependencies": ",NRPE", + "check_command": "check_win_mem", + "command_line": "$PLUGINSDIR$/check_nrpe", + "arguments": ["-H", "$HOSTADDRESS$", "-c", "alias_mem"] +} + diff --git a/examples/data_bags/shinken_services/win_nrpe.json b/examples/data_bags/shinken_services/win_nrpe.json new file mode 100644 index 0000000..d5a16ad --- /dev/null +++ b/examples/data_bags/shinken_services/win_nrpe.json @@ -0,0 +1,11 @@ +{ + "id": "win_nrpe", + "use": ["generic-service"], + "service_description": "NRPE", + "servicegroups": ["NRPE"], + "hostgroup_name": "windows", + "check_command": "check_win_nrpe", + "command_line": "$PLUGINSDIR$/check_nrpe", + "arguments": ["-H", "$HOSTADDRESS$"] +} + diff --git a/examples/data_bags/shinken_services/win_rdesktop.json b/examples/data_bags/shinken_services/win_rdesktop.json new file mode 100644 index 0000000..e50a11e --- /dev/null +++ b/examples/data_bags/shinken_services/win_rdesktop.json @@ -0,0 +1,11 @@ +{ + "id": "win_rdesktop", + "use": ["generic-service"], + "service_description": "Remote desktop", + "servicegroups": ["Remote desktop"], + "hostgroup_name": "windows", + "check_command": "check_rdesktop", + "command_line": "$PLUGINSDIR$/check_tcp", + "arguments": ["-H", "$HOSTADDRESS$", "-p", "3389"] +} + diff --git a/examples/data_bags/shinken_services/win_updates.json b/examples/data_bags/shinken_services/win_updates.json new file mode 100644 index 0000000..ba5b115 --- /dev/null +++ b/examples/data_bags/shinken_services/win_updates.json @@ -0,0 +1,13 @@ +{ + "id": "win_updates", + "use": ["daily-service"], + "service_description": "Windows updates", + "servicegroups": ["Windows updates"], + "hostgroup_name": "windows", + "service_dependencies": ",NRPE", + "escalations": "null", + "check_command": "check_win_updates", + "command_line": "$PLUGINSDIR$/check_nrpe", + "arguments": ["-H", "$HOSTADDRESS$", "-c", "alias_updates", "-t", "60"] +} + diff --git a/examples/data_bags/shinken_services/zombie_procs.json b/examples/data_bags/shinken_services/zombie_procs.json new file mode 100644 index 0000000..89abd04 --- /dev/null +++ b/examples/data_bags/shinken_services/zombie_procs.json @@ -0,0 +1,12 @@ +{ + "id": "zombie_procs", + "use": ["generic-service"], + "service_description": "Zombie processes", + "servicegroups": ["Zombie processes"], + "hostgroup_name": "linux", + "service_dependencies": ",NRPE", + "check_command": "check_zombie_procs", + "command_line": "$PLUGINSDIR$/check_nrpe", + "arguments": ["-H", "$HOSTADDRESS$", "-c", "check_zombie_procs"] +} + diff --git a/examples/data_bags/shinken_timeperiods/24x7.json b/examples/data_bags/shinken_timeperiods/24x7.json new file mode 100644 index 0000000..fe28ac9 --- /dev/null +++ b/examples/data_bags/shinken_timeperiods/24x7.json @@ -0,0 +1,6 @@ +{ + "id": "24x7", + "timeperiod_name": "24x7", + "timeperiod_alias": "24_Hours_A_Day,_7_Days_A_Week", + "content": ["sunday 00:00-24:00", "monday 00:00-24:00", "tuesday 00:00-24:00", "wednesday 00:00-24:00", "thursday 00:00-24:00", "friday 00:00-24:00", "saturday 00:00-24:00"] +} diff --git a/examples/data_bags/shinken_timeperiods/none.json b/examples/data_bags/shinken_timeperiods/none.json new file mode 100644 index 0000000..2f9cf50 --- /dev/null +++ b/examples/data_bags/shinken_timeperiods/none.json @@ -0,0 +1,5 @@ +{ + "id": "none", + "timeperiod_name": "none", + "timeperiod_alias": "No Time Is A Good Time" +} \ No newline at end of file diff --git a/examples/data_bags/shinken_timeperiods/work_hours.json b/examples/data_bags/shinken_timeperiods/work_hours.json new file mode 100644 index 0000000..8c72887 --- /dev/null +++ b/examples/data_bags/shinken_timeperiods/work_hours.json @@ -0,0 +1,6 @@ +{ + "id": "work_hours", + "timeperiod_name": "work_hours", + "timeperiod_alias": "Work hours", + "content": ["monday 10:00-20:00", "tuesday 10:00-20:00", "wednesday 10:00-20:00", "thursday 10:00-20:00", "friday 10:00-20:00"] +} diff --git a/examples/roles/shinken.rb b/examples/roles/shinken.rb new file mode 100644 index 0000000..5fc9555 --- /dev/null +++ b/examples/roles/shinken.rb @@ -0,0 +1,40 @@ +name "shinken" +description "Monitoring server" +run_list "role[monitoring]", "recipe[shinken::mongodb]", "recipe[mongodb]", +"recipe[shinken::pnp]","role[shinken_poller]", "recipe[shinken::reactionner]", +"recipe[shinken::scheduler]", "recipe[shinken::broker]", "recipe[shinken::thruk]", +"recipe[shinken::receiver]", "recipe[shinken::arbiter]", "recipe[shinken::plugins]", +"recipe[shinken::xmpp]" + +override_attributes( "shinken" => { + "arbiter" => { + "modules" => ["CommandFile"] + }, + "broker" => { + "modules" => [ "Livestatus", "NPCDMOD", "Simple-log", "WebUI"] + }, + "poller" => { + "variables" => { + "poller_tags" => "None,example.com" + } + }, + "scheduler" => { + "ipaddress" => "1.2.3.4", + "modules" => ["PickleRetention"] + }, + "xmpp" => { + "username" => "myuser@jabber.org", + "domain" => "jabber.org", + "password" => "123456", + "server" => "jabber.org", + "port" => "5222" + }, + "cgi" => { + "admin_group" => "sysadmin", + "read_groups" => "dev,qa" + }, + "auto_poller_tags" => true, + "cert_name" => "_.example.com", + "cert_ca_name" => "gd_bundle", + } +) diff --git a/examples/roles/shinken_poller.rb b/examples/roles/shinken_poller.rb new file mode 100644 index 0000000..d5f8e8c --- /dev/null +++ b/examples/roles/shinken_poller.rb @@ -0,0 +1,10 @@ +name "shinken_poller" +description "Monitoring polling server" +run_list "role[monitoring]", "recipe[shinken::poller]", "recipe[shinken::plugins]" + +override_attributes( "shinken" => { + "poller" => { + "modules" => ["NrpeBooster"] + } + } +) diff --git a/examples/roles/shinken_remotepoller.rb b/examples/roles/shinken_remotepoller.rb new file mode 100644 index 0000000..026b7b9 --- /dev/null +++ b/examples/roles/shinken_remotepoller.rb @@ -0,0 +1,13 @@ +name "shinken_remotepoller" +description "Remote monitoring polling server" +run_list "role[shinken_poller]" + +override_attributes( "shinken" => { + "poller" => { + "ipaddress" => "2.3.4.5", + "variables" => { + "poller_tags" => "othersite.com" + } + } + } +) diff --git a/metadata.rb b/metadata.rb index 5e0a111..ea4c3dc 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,7 @@ license "MIT" description "Installs/Configures shinken" long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "1.0.0" +version "2.0.0" depends "apt" depends "nginx" From 4c3bba37fe0b84e24a1ec1a7e719c689fce4c226 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Mon, 17 Jun 2013 23:33:54 +0300 Subject: [PATCH 07/56] add shinken mongodb recipe --- metadata.rb | 2 ++ recipes/mongodb.rb | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 recipes/mongodb.rb diff --git a/metadata.rb b/metadata.rb index ea4c3dc..2af48ca 100644 --- a/metadata.rb +++ b/metadata.rb @@ -7,4 +7,6 @@ depends "apt" depends "nginx" +depends "mongodb" +depends "python" diff --git a/recipes/mongodb.rb b/recipes/mongodb.rb new file mode 100644 index 0000000..f50f739 --- /dev/null +++ b/recipes/mongodb.rb @@ -0,0 +1,11 @@ +include_recipe "mongodb::10gen_repo" +include_recipe "mongodb" +include_recipe "python::pip" + +package "gcc" +package "python-devel" + +python_pip "pymongo" do + action :install +end + From 43a904c5c1f038f8284711c32a6464ab30e537b8 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Mon, 17 Jun 2013 23:36:20 +0300 Subject: [PATCH 08/56] add a resource.cfg file --- files/default/resource.cfg | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 files/default/resource.cfg diff --git a/files/default/resource.cfg b/files/default/resource.cfg new file mode 100644 index 0000000..bbddef1 --- /dev/null +++ b/files/default/resource.cfg @@ -0,0 +1,35 @@ +# +# This file is managed by Chef. Local modifications will be overwritten. +# +$USER1$=/usr/lib/shinken/plugins +$USER2$=public + +#-- Location of the plugins +$PLUGINSDIR$=/usr/lib64/nagios/plugins + +#- Active Directory and LDAP +$DOMAINUSER$=shinken_user +$DOMAINPASSWORD$=superpassword +$LDAPBASE$=dc=eu,dc=society,dc=com + +#- MSSQL credentials +$MSSQLUSER$=someuser +$MSSQLPASSWORD$=somepassowrd + +#-- Mysql credentials +$MYSQLUSER$=root +$MYSQLPASSWORD$=root + +#-- vSphere (ESX) credentials +$VCENTER$=vcenter.mydomain.com +$VCENTERLOGIN$=someuser +$VCENTERPASSWORD$=somepassowrd + + +#-- Discovery +# default snmp community +$SNMPCOMMUNITYREAD$=PUBLIC +# what to discover by default +$NMAPTARGETS$=localhost www.google.fr + + From eeb8d5ab6a4f1aca6abb11bbbc1972c07128fda7 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Mon, 17 Jun 2013 23:38:17 +0300 Subject: [PATCH 09/56] create htpasswd file from users and shinken_contacts --- recipes/broker.rb | 9 +++++++++ templates/default/htpasswd.users.erb | 4 ++++ 2 files changed, 13 insertions(+) create mode 100644 templates/default/htpasswd.users.erb diff --git a/recipes/broker.rb b/recipes/broker.rb index 7da53cb..995ae8b 100644 --- a/recipes/broker.rb +++ b/recipes/broker.rb @@ -59,3 +59,12 @@ end +# add the sysadmins to the htpasswd +users = search(:users, "nagios:* AND password:* NOT action:remove") +contacts = search(:shinken_contacts, "password:*") + +template "/etc/shinken/htpasswd.users" do + source "htpasswd.users.erb" + mode 0644 + variables(:users => users + contacts) +end diff --git a/templates/default/htpasswd.users.erb b/templates/default/htpasswd.users.erb new file mode 100644 index 0000000..0aeb4ad --- /dev/null +++ b/templates/default/htpasswd.users.erb @@ -0,0 +1,4 @@ +# Autogenerated by Chef. +<% @users.each do |user| -%> +<%= user["id"] %>:<%= user["password"].nil? ? "x" : user["password"] %> +<% end -%> From e6ec5cc953c6065fec4c7e679e072ff2437cafb6 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 15:14:28 +0300 Subject: [PATCH 10/56] populate the host template before the hosts. sort the hosts to prevent unncessary restarts. add hosts that are not in chef from the shinken_hosts cookbook. --- recipes/arbiter-hosts.rb | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/recipes/arbiter-hosts.rb b/recipes/arbiter-hosts.rb index 9f83b08..b3f13e0 100644 --- a/recipes/arbiter-hosts.rb +++ b/recipes/arbiter-hosts.rb @@ -52,8 +52,29 @@ node.run_state["shinken"]["arbiter"]["hosts"] = [] ### Populate +# Templates first +host_templates = search(:shinken_host_templates, "*:*") +host_templates.sort! {|a,b| a.name <=> b.name } + +host_templates.each do |n| + # we'll use shinken_host LWRP to define host + shinken_host n["id"] do + # We wont register templates + register false + + n.delete_if{|k, v| k == "id"}.each_pair do |k, v| + self.send k, v + end + + end +end + +# sort the hosts to prevent extra reloads +nodes = search(:node, "roles:monitoring") +nodes.sort! {|a,b| a.name <=> b.name } + # We'll now populate hosts with real content -search(:node, "monitoring:*") do |n| +nodes.each do |n| # we'll use shinken_host LWRP to define host shinken_host n["fqdn"] do host_name n["fqdn"] @@ -68,18 +89,15 @@ end end -# We'll now populate hosts with real content -search(:shinken_host_templates, "*:*") do |n| - # we'll use shinken_host LWRP to define host - shinken_host n["id"] do - # We wont register templates - register false +# add the manual hosts +hosts = search(:shinken_hosts, "*:*") +hosts.sort! {|a,b| a.name <=> b.name } +hosts.each do |n| + # we'll use shinken_host LWRP to define host + shinken_host n["host_name"] do n.delete_if{|k, v| k == "id"}.each_pair do |k, v| self.send k, v end - end end - - From 0a8e21d0d809a54c6731ac1311debc686b7a147b Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 15:20:43 +0300 Subject: [PATCH 11/56] use the hostname for the shinken_host name, and set the fqdn as an alias. use the ipaddress as the shinken_host address. add hostgroups for the os and for each role the node has. --- recipes/arbiter-hosts.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/recipes/arbiter-hosts.rb b/recipes/arbiter-hosts.rb index b3f13e0..22de90e 100644 --- a/recipes/arbiter-hosts.rb +++ b/recipes/arbiter-hosts.rb @@ -76,14 +76,17 @@ # We'll now populate hosts with real content nodes.each do |n| # we'll use shinken_host LWRP to define host - shinken_host n["fqdn"] do - host_name n["fqdn"] - address n["fqdn"] - (n["monitoring"]["host_definition"]||{}).each_pair do |k, v| + shinken_host n["hostname"] do + host_name n["hostname"] + address n["ipaddress"] + host_alias n["fqdn"] + hostgroups ["+#{n['os']}",n['roles'].join(",")] + + (n["nagios"]["host_definition"]||{}).each_pair do |k, v| self.send k, v end - if (n["monitoring"]["host_definition"]|| {})["use"].nil? + if (n["nagios"]["host_definition"]|| {})["use"].nil? use ["generic-host"] end end From e21ef0518f1f78e7af13203845f7ad74586dbae2 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 15:28:13 +0300 Subject: [PATCH 12/56] specify the command line for the check from a service. --- providers/service.rb | 3 ++- resources/service.rb | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/providers/service.rb b/providers/service.rb index 08748ae..0f0a472 100644 --- a/providers/service.rb +++ b/providers/service.rb @@ -2,7 +2,8 @@ if not template? command = shinken_command "shinken/arbiter/services/#{new_resource.service_key}/command" do - command new_resource.check_command + command_name new_resource.check_command + command new_resource.command_line arguments new_resource.arguments end Chef::Log.info(command.command_identifier) diff --git a/resources/service.rb b/resources/service.rb index 2dd68bf..6d1fac3 100644 --- a/resources/service.rb +++ b/resources/service.rb @@ -32,6 +32,7 @@ def self.validation_callback(items, combination = true) attribute :servicegroups, :kind_of => Array attribute :is_volatile, :kind_of => [TrueClass, FalseClass] attribute :check_command, :kind_of => String +attribute :command_line, :kind_of => String attribute :arguments, :kind_of => Array attribute :initial_state, :callbacks => validation_callback([:ok, :warning, :unknown, :critical], false) attribute :max_check_attempts, :kind_of => Integer From 10af22d77b9aa5c4014ce935b52b6e5679e3fc63 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 15:35:55 +0300 Subject: [PATCH 13/56] add contactgroup lwrp. add users to a contactgroup for each group they belong to, plus to the "all" contactgroup and create these contactgroups. --- providers/contactgroup.rb | 54 +++++++++++++++++++ recipes/arbiter-contacts.rb | 20 +++++++ resources/contactgroup.rb | 19 +++++++ .../contactgroups/contactgroup.cfg.erb | 26 +++++++++ 4 files changed, 119 insertions(+) create mode 100644 providers/contactgroup.rb create mode 100644 resources/contactgroup.rb create mode 100644 templates/default/definitions/contactgroups/contactgroup.cfg.erb diff --git a/providers/contactgroup.rb b/providers/contactgroup.rb new file mode 100644 index 0000000..5000e6a --- /dev/null +++ b/providers/contactgroup.rb @@ -0,0 +1,54 @@ +action :create do + + template "shinken/arbiter/#{template? ? "templates/": ""}contactgroups/#{new_resource.contactgroup_key}" do + path full_path + source "definitions/contactgroups/contactgroup.cfg.erb" + mode 00644 + + variables({ + :contactgroup_key => new_resource.contactgroup_key, + :contactgroup_name => new_resource.contactgroup_name, + :contactgroup_alias => new_resource.contactgroup_alias, + :members => new_resource.members, + :realm => new_resource.realm, + + :register => new_resource.register, + :use => new_resource.use + }) + + action :create + notifies :restart, "service[shinken-arbiter]", :delayed + end + + node.run_state["shinken"]["arbiter"]["contactgroups"].push(path) +end + +action :delete do + file full_path do + action :delete + end +end + +def template? + not new_resource.register +end + +def path + paths = ["contactgroups", "#{new_resource.contactgroup_key}.cfg"] + paths.unshift("templates") if not new_resource.register + ::File.join(paths) +end + +def full_path + ::File.join("/etc/shinken/objects-chef", path) +end + +def contactgroup_path + paths = ["contactgroups", new_resource.contactgroup_key] + paths.unshift("templates") if not new_resource.register + ::File.join(paths) +end + +def full_contactgroup_path + ::File.join("/etc/shinken/objects-chef", contactgroup_path) +end diff --git a/recipes/arbiter-contacts.rb b/recipes/arbiter-contacts.rb index ddd350e..4d15ce9 100644 --- a/recipes/arbiter-contacts.rb +++ b/recipes/arbiter-contacts.rb @@ -44,8 +44,14 @@ path "/etc/shinken/objects-chef/templates/contacts" end +directory "shinken/arbiter/contactgroups" do + path "/etc/shinken/objects-chef/contactgroups" +end + ### Save content through run node.run_state["shinken"]["arbiter"]["contacts"] = [] +node.run_state["shinken"]["arbiter"]["contactgroups"] = [] +contactgroups = ["all"] # We'll now populate contacts with real content search(:shinken_contact_templates, "*:*") do |n| @@ -68,6 +74,13 @@ contact_alias c["name"] email c["mail"] + contactgroups "#{n["groups"].join(',')}" + n["groups"].each do |group| + if !contactgroups.include?(group) + contactgroups << group + end + end + (c["shinken"]|| {}).delete_if{|k,v| k == "id"}.each_pair do |k,v| self.send k, v end @@ -86,3 +99,10 @@ + +contactgroups.each do |group| + shinken_contactgroup group do + contactgroup_name group + contactgroup_alias group + end +end diff --git a/resources/contactgroup.rb b/resources/contactgroup.rb new file mode 100644 index 0000000..2c0b235 --- /dev/null +++ b/resources/contactgroup.rb @@ -0,0 +1,19 @@ +actions :create, :delete + + +attribute :contactgroup_key, :kind_of => String, :name_attribute => true +attribute :contactgroup_name, :kind_of => String +attribute :contactgroup_alias, :kind_of => String +attribute :members, :kind_of => Array +attribute :realm, :kind_of => String + +attribute :register, :kind_of => [TrueClass, FalseClass], :default => true +attribute :use, :kind_of => Array + + +def initialize(*opts) + super *opts + @action = :create + + @run_context.include_recipe "shinken::arbiter-contacts" +end diff --git a/templates/default/definitions/contactgroups/contactgroup.cfg.erb b/templates/default/definitions/contactgroups/contactgroup.cfg.erb new file mode 100644 index 0000000..df25f0b --- /dev/null +++ b/templates/default/definitions/contactgroups/contactgroup.cfg.erb @@ -0,0 +1,26 @@ +# This file is dropped off by chef, any local changes will be overwritten + +define contactgroup { +<% if not @register %> + name <%= @contactgroup_key %> +<% end %> + +<% if not @contactgroup_name.nil? %> + contactgroup_name <%= @contactgroup_name %> +<% end %> +<% if not @contactgroup_alias.nil? %> + alias <%= @contactgroup_alias %> +<% end %> +<% if not @members.nil? %> + members <%= @members.join(",") %> +<% end %> +<% if not @realm.nil? %> + realm <%= @realm %> +<% end %> + + register <%= @register ? "1": "0" %> +<% if @use %> + use <%= @use.join(",") %> +<% end %> +} + From cd821d99b797e811cebe788d6c3bead4ed98b2ce Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 15:42:56 +0300 Subject: [PATCH 14/56] create a hostgroup for each role in chef. --- recipes/arbiter-hostgroups.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/recipes/arbiter-hostgroups.rb b/recipes/arbiter-hostgroups.rb index 3ef9016..00e39df 100644 --- a/recipes/arbiter-hostgroups.rb +++ b/recipes/arbiter-hostgroups.rb @@ -43,6 +43,19 @@ ### Save content through run node.run_state["shinken"]["arbiter"]["hostgroups"] = [] +# find roles and create hostgroup for each role +hostgroups = Array.new + +search(:role, "*:*") do |r| + hostgroups << r.name +end + +hostgroups.sort.each do |hg| + shinken_hostgroup hg do + hostgroup_name hg + hostgroup_alias hg + end +end # We'll now populate hostgroups with real content search(:shinken_hostgroups, "*:*") do |n| @@ -53,6 +66,3 @@ end end end - - - From 349f3b5558a5a1581904e1f033dc0d4c6720b4e0 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 15:50:48 +0300 Subject: [PATCH 15/56] set all files to be mode 00644 --- providers/command.rb | 1 + providers/contact.rb | 1 + providers/daemon.rb | 2 +- providers/host.rb | 1 + providers/hostgroup.rb | 1 + providers/module.rb | 2 +- providers/notificationway.rb | 1 + providers/service.rb | 1 + providers/servicegroup.rb | 1 + providers/timeperiod.rb | 1 + recipes/base.rb | 6 ++++-- 11 files changed, 14 insertions(+), 4 deletions(-) diff --git a/providers/command.rb b/providers/command.rb index 93df404..29cfcb0 100644 --- a/providers/command.rb +++ b/providers/command.rb @@ -2,6 +2,7 @@ template "shinken/arbiter/commands/#{new_resource.command_identifier}" do path full_path source "definitions/commands/command.cfg.erb" + mode 00644 variables({ :command_name => new_resource.command_identifier, diff --git a/providers/contact.rb b/providers/contact.rb index ef0bce3..5029c53 100644 --- a/providers/contact.rb +++ b/providers/contact.rb @@ -3,6 +3,7 @@ template "shinken/arbiter/#{template? ? "templates/": ""}contacts/#{new_resource.contact_key}" do path full_path source "definitions/contacts/contact.cfg.erb" + mode 00644 variables({ :contact_key => new_resource.contact_key, diff --git a/providers/daemon.rb b/providers/daemon.rb index e3922a2..c020b82 100644 --- a/providers/daemon.rb +++ b/providers/daemon.rb @@ -1,8 +1,8 @@ action :create do template "shinken/specific/daemon/#{new_resource.name}" do path full_path - source "arbiter/daemon.cfg.erb" + mode 00644 variables({ "daemon_type" => new_resource.daemon_type, diff --git a/providers/host.rb b/providers/host.rb index 6535359..5a9ba9c 100644 --- a/providers/host.rb +++ b/providers/host.rb @@ -3,6 +3,7 @@ template "shinken/arbiter/#{template? ? "templates/": ""}hosts/#{new_resource.host_key}" do path full_path source "definitions/hosts/host.cfg.erb" + mode 00644 variables({ :host_key => new_resource.host_key, diff --git a/providers/hostgroup.rb b/providers/hostgroup.rb index ed27778..ffd7d77 100644 --- a/providers/hostgroup.rb +++ b/providers/hostgroup.rb @@ -3,6 +3,7 @@ template "shinken/arbiter/#{template? ? "templates/": ""}hostgroups/#{new_resource.hostgroup_key}" do path full_path source "definitions/hostgroups/hostgroup.cfg.erb" + mode 00644 variables({ :hostgroup_key => new_resource.hostgroup_key, diff --git a/providers/module.rb b/providers/module.rb index 4e4ff41..66bcad9 100644 --- a/providers/module.rb +++ b/providers/module.rb @@ -1,8 +1,8 @@ action :create do template "shinken/specific/module/#{new_resource.name}" do path full_path - source "arbiter/module.cfg.erb" + mode 00644 variables({ "module_type" => new_resource.module_type, diff --git a/providers/notificationway.rb b/providers/notificationway.rb index b4ef128..0fe9f6c 100644 --- a/providers/notificationway.rb +++ b/providers/notificationway.rb @@ -3,6 +3,7 @@ template "shinken/arbiter/#{template? ? "templates/": ""}notificationway/#{new_resource.notificationway_name}" do path full_path source "definitions/notificationways/notificationway.cfg.erb" + mode 00644 variables({ :notificationway_name => new_resource.notificationway_name, diff --git a/providers/service.rb b/providers/service.rb index 0f0a472..8e341de 100644 --- a/providers/service.rb +++ b/providers/service.rb @@ -13,6 +13,7 @@ template "shinken/arbiter/#{template? ? "templates/": ""}services/#{new_resource.service_key}" do path full_path source "definitions/services/service.cfg.erb" + mode 00644 vars = { :service_key => new_resource.service_key, diff --git a/providers/servicegroup.rb b/providers/servicegroup.rb index 7e2beb3..dbd3582 100644 --- a/providers/servicegroup.rb +++ b/providers/servicegroup.rb @@ -3,6 +3,7 @@ template "shinken/arbiter/#{template? ? "templates/": ""}servicegroups/#{new_resource.servicegroup_key}" do path full_path source "definitions/servicegroups/servicegroup.cfg.erb" + mode 00644 variables({ :servicegroup_key => new_resource.servicegroup_key, diff --git a/providers/timeperiod.rb b/providers/timeperiod.rb index 6125fef..177ddbb 100644 --- a/providers/timeperiod.rb +++ b/providers/timeperiod.rb @@ -3,6 +3,7 @@ template "shinken/arbiter/#{template? ? "templates/": ""}timeperiods/#{new_resource.timeperiod_key}" do path full_path source "definitions/timeperiods/timeperiod.cfg.erb" + mode 00644 variables({ :timeperiod_key => new_resource.timeperiod_key, diff --git a/recipes/base.rb b/recipes/base.rb index fad9498..38d3a1b 100644 --- a/recipes/base.rb +++ b/recipes/base.rb @@ -54,7 +54,7 @@ template "shinken/default/debian" do path "/etc/default/shinken" source "default/shinken.erb" - mode "0644" + mode "00644" end template "/etc/init.d/shinken" do @@ -89,4 +89,6 @@ recursive true end -cookbook_file "/etc/shinken/resource.cfg" +cookbook_file "/etc/shinken/resource.cfg" do + mode "00644" +end From 1a69fb1eb57132f62b1ae44804e3c113f4b26424 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 16:03:02 +0300 Subject: [PATCH 16/56] add missing host parameters. --- providers/host.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/providers/host.rb b/providers/host.rb index 5a9ba9c..235c401 100644 --- a/providers/host.rb +++ b/providers/host.rb @@ -19,6 +19,7 @@ :check_interval => new_resource.check_interval, :active_checks_enabled => new_resource.active_checks_enabled, :check_period => new_resource.check_period, + :contacts => new_resource.contacts, :contact_groups => new_resource.contact_groups, :notification_interval => new_resource.notification_interval, :notification_period => new_resource.notification_period, @@ -27,6 +28,11 @@ :event_handler_enabled => new_resource.event_handler_enabled, :flap_detection_enabled => new_resource.flap_detection_enabled, :process_perf_data => new_resource.process_perf_data, + :notes => new_resource.notes, + :notes_url => new_resource.notes_url, + :action_url => new_resource.action_url, + :icon_image => new_resource.icon_image, + :icon_image_alt => new_resource.icon_image_alt, :use => new_resource.use }) From a0180a1ec5cd7dfa9daf20dd68d592c08e19356b Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 16:24:56 +0300 Subject: [PATCH 17/56] add lwrp for escalations in shinken, both for hosts and services. --- providers/escalation.rb | 70 +++++++++++++++++++ providers/host.rb | 1 + providers/service.rb | 2 +- recipes/arbiter-escalations.rb | 55 +++++++++++++++ recipes/arbiter.rb | 1 + resources/escalation.rb | 45 ++++++++++++ resources/host.rb | 1 + resources/service.rb | 1 + templates/default/arbiter/arbiter.cfg.erb | 5 ++ .../escalations/escalation.cfg.erb | 34 +++++++++ .../default/definitions/hosts/host.cfg.erb | 3 + .../definitions/services/service.cfg.erb | 3 + 12 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 providers/escalation.rb create mode 100644 recipes/arbiter-escalations.rb create mode 100644 resources/escalation.rb create mode 100644 templates/default/definitions/escalations/escalation.cfg.erb diff --git a/providers/escalation.rb b/providers/escalation.rb new file mode 100644 index 0000000..eb57608 --- /dev/null +++ b/providers/escalation.rb @@ -0,0 +1,70 @@ +action :create do + + # if not template? + # command = shinken_command "shinken/arbiter/escalations/#{new_resource.escalation_key}/command" do + # command_name new_resource.check_command + # command new_resource.command_line + # arguments new_resource.arguments + # end + # Chef::Log.info(command.command_identifier) + # end + + + template "shinken/arbiter/escalations/#{new_resource.escalation_key}" do + path full_path + source "definitions/escalations/escalation.cfg.erb" + mode 00644 + + vars = { + :escalation_key => new_resource.escalation_key, + + :first_notification => new_resource.first_notification, + :last_notification => new_resource.last_notification, + :first_notification_time => new_resource.first_notification_time, + :last_notification_time => new_resource.last_notification_time, + + :notification_interval => new_resource.notification_interval, + :escalation_period => new_resource.escalation_period, + :escalation_options => new_resource.escalation_options, + :contacts => new_resource.contacts, + :contact_groups => new_resource.contact_groups#, + +# :register => new_resource.register, +# :use => new_resource.use + } +# vars.update({ +# :check_command => command +# }) if not command.nil? + + + variables(vars) + + action :create + notifies :restart, "service[shinken-arbiter]", :delayed + end + + node.run_state["shinken"]["arbiter"]["escalations"].push(path) +end + +action :delete do + file full_path do + action :delete + end +end + +#def template? +# not new_resource.register +#end + +def path + ::File.join("escalations", "#{new_resource.escalation_key}.cfg") +# paths = ["escalations"] +# paths.push(new_resource.host_name) if new_resource.host_name +# paths.push("#{new_resource.escalation_key}.cfg") +# paths.unshift("templates") if not new_resource.register +# ::File.join(paths) +end + +def full_path + ::File.join("/etc/shinken/objects-chef", path) +end diff --git a/providers/host.rb b/providers/host.rb index 235c401..e3ae476 100644 --- a/providers/host.rb +++ b/providers/host.rb @@ -33,6 +33,7 @@ :action_url => new_resource.action_url, :icon_image => new_resource.icon_image, :icon_image_alt => new_resource.icon_image_alt, + :escalations => new_resource.escalations, :use => new_resource.use }) diff --git a/providers/service.rb b/providers/service.rb index 8e341de..1f35664 100644 --- a/providers/service.rb +++ b/providers/service.rb @@ -56,7 +56,7 @@ :action_url => new_resource.action_url, :icon_image => new_resource.icon_image, :icon_image_alt => new_resource.icon_image_alt, - + :escalations => new_resource.escalations, :register => new_resource.register, :use => ((not template?) ? ["base-service"]:[]) + new_resource.use diff --git a/recipes/arbiter-escalations.rb b/recipes/arbiter-escalations.rb new file mode 100644 index 0000000..7801248 --- /dev/null +++ b/recipes/arbiter-escalations.rb @@ -0,0 +1,55 @@ +# +# Cookbook Name:: shinken +# Recipe:: arbiter-escalations +# +# Copyright 2013, Arthur Gautier +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +## Notificationway definition drop +# This recipe will drop escalations definitions and register them in a main file + +### Include shinken-arbiter recipe +# See [shinken::arbiter](arbiter.html) + +include_recipe "shinken::arbiter" + +### Layout +#### Directories +# +# we'll use ``/etc/shinken/objects-chef/escalations`` and put subfiles in this +directory "shinken/arbiter/escalations" do + path "/etc/shinken/objects-chef/escalations" +end + +### Save content through run +node.run_state["shinken"]["arbiter"]["escalations"] = [] + + +# We'll now populate escalations with real content +search(:shinken_escalations, "*:*") do |n| + # we'll use shinken_escalation LWRP to define escalation + shinken_escalation n["id"] do + n.delete_if{|k, v| k == "id"}.each_pair do |k, v| + self.send k, v + end + end +end diff --git a/recipes/arbiter.rb b/recipes/arbiter.rb index b6716ef..3bd3158 100644 --- a/recipes/arbiter.rb +++ b/recipes/arbiter.rb @@ -138,6 +138,7 @@ include_recipe "shinken::arbiter-hosts" include_recipe "shinken::arbiter-servicegroups" include_recipe "shinken::arbiter-services" +include_recipe "shinken::arbiter-escalations" #### Main configuration file diff --git a/resources/escalation.rb b/resources/escalation.rb new file mode 100644 index 0000000..93eceb1 --- /dev/null +++ b/resources/escalation.rb @@ -0,0 +1,45 @@ +actions :create, :delete + +def self.validation_callback(items, combination = true) + if combination + { + "is not a valid combination" => Proc.new {|ts| + returns = ts.map do |t| + items.include?(t.to_sym) + end + not returns.include?(false) + } + } + else + { + "is not a valid type" => Proc.new {|ts| + items.include?(ts.to_sym) + } + } + end +end + + +attribute :escalation_key, :kind_of => String, :name_attribute => true + +attribute :first_notification, :kind_of => Integer +attribute :last_notification, :kind_of => Integer +attribute :first_notification_time, :kind_of => Integer +attribute :last_notification_time, :kind_of => Integer + +attribute :notification_interval, :kind_of => Integer +attribute :escalation_period, :kind_of => String +attribute :escalation_options, :callbacks => validation_callback([:warning, :unknown, :critical, :recovery, :flapping, :scheduled]) +attribute :contacts, :kind_of => Array +attribute :contact_groups, :kind_of => Array + +#attribute :register, :kind_of => [TrueClass, FalseClass], :default => true +#attribute :use, :kind_of => Array, :default => [] + + +def initialize(*opts) + super *opts + @action = :create + +# @run_context.include_recipe "shinken::arbiter" +end diff --git a/resources/host.rb b/resources/host.rb index 893785d..eb3f4a8 100644 --- a/resources/host.rb +++ b/resources/host.rb @@ -66,6 +66,7 @@ def self.validation_callback(items, combination = true) attribute :statusmap_image, :kind_of => String #attribute :2d_coords, x_coord,y_coord #attribute :3d_coords, x_coord,y_coord,z_coord +attribute :escalations, :kind_of => String attribute :register, :kind_of => [TrueClass, FalseClass], :default => true attribute :use, :kind_of => Array diff --git a/resources/service.rb b/resources/service.rb index 6d1fac3..8fe0ac6 100644 --- a/resources/service.rb +++ b/resources/service.rb @@ -66,6 +66,7 @@ def self.validation_callback(items, combination = true) attribute :action_url, :kind_of => String attribute :icon_image, :kind_of => String attribute :icon_image_alt, :kind_of => String +attribute :escalations, :kind_of => String attribute :register, :kind_of => [TrueClass, FalseClass], :default => true attribute :use, :kind_of => Array, :default => [] diff --git a/templates/default/arbiter/arbiter.cfg.erb b/templates/default/arbiter/arbiter.cfg.erb index dce5bd4..161f56b 100644 --- a/templates/default/arbiter/arbiter.cfg.erb +++ b/templates/default/arbiter/arbiter.cfg.erb @@ -210,3 +210,8 @@ cfg_file=objects-chef/<%= nwf %> <% @timeperiod_files.each do |tpf| %> cfg_file=objects-chef/<%= tpf %> <% end %> + +## Escalations +<% @escalation_files.each do |esf| %> +cfg_file=objects-chef/<%= esf %> +<% end %> diff --git a/templates/default/definitions/escalations/escalation.cfg.erb b/templates/default/definitions/escalations/escalation.cfg.erb new file mode 100644 index 0000000..986ca0d --- /dev/null +++ b/templates/default/definitions/escalations/escalation.cfg.erb @@ -0,0 +1,34 @@ +# This file is dropped off by chef, any local changes will be overwritten + +define escalation { + escalation_name <%= @escalation_key %> + +<% if not @first_notification.nil? %> + first_notification <%= @first_notification %> +<% end %> +<% if not @last_notification.nil? %> + last_notification <%= @last_notification %> +<% end %> +<% if not @first_notification_time.nil? %> + first_notification_time <%= @first_notification_time %> +<% end %> +<% if not @last_notification_time.nil? %> + last_notification_time <%= @last_notification_time %> +<% end %> +<% if not @notification_interval.nil? %> + notification_interval <%= @notification_interval %> +<% end %> +<% if not @escalation_period.nil? %> + escalation_period <%= @escalation_period %> +<% end %> +<% if not @escalation_options.nil? %> + escalation_options <%= @escalation_options.map{|e| e.to_s[0,1]}.join(",") %> +<% end %> +<% if not @contacts.nil? and not @contacts.empty? %> + contacts <%= @contacts.join(",") %> +<% end %> +<% if not @contact_groups.nil? %> + contact_groups <%= @contact_groups.join(",") %> +<% end %> +} + diff --git a/templates/default/definitions/hosts/host.cfg.erb b/templates/default/definitions/hosts/host.cfg.erb index dd434e1..9356f90 100644 --- a/templates/default/definitions/hosts/host.cfg.erb +++ b/templates/default/definitions/hosts/host.cfg.erb @@ -74,6 +74,9 @@ define host { <% if not @icon_image_alt.nil? %> icon_image_alt <%= @icon_image_alt %> <% end %> +<% if not @escalations.nil? %> + escalations <%= @escalations %> +<% end %> register <%= @register ? "1": "0" %> diff --git a/templates/default/definitions/services/service.cfg.erb b/templates/default/definitions/services/service.cfg.erb index b740839..b4bfb82 100644 --- a/templates/default/definitions/services/service.cfg.erb +++ b/templates/default/definitions/services/service.cfg.erb @@ -118,6 +118,9 @@ define service { <% end %> <% if not @icon_image_alt.nil? %> icon_image_alt <%= @icon_image_alt %> +<% end %> +<% if not @escalations.nil? %> + escalations <%= @escalations %> <% end %> register <%= @register ? "1": "0" %> <% if @use %> From 2ba2a98a32f7bc5f7bcc3f3f9fd8072435aedb6d Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 16:30:07 +0300 Subject: [PATCH 18/56] add the poller_tag parameter to hosts. if node["shinken"]["auto_poller_tags"] is set to true, add a poller_tag to the host with the value of the host's domain. --- attributes/default.rb | 2 ++ providers/host.rb | 1 + recipes/arbiter-hosts.rb | 5 +++++ resources/host.rb | 1 + templates/default/definitions/hosts/host.cfg.erb | 3 +++ 5 files changed, 12 insertions(+) diff --git a/attributes/default.rb b/attributes/default.rb index 88b981f..769fe8f 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -66,3 +66,5 @@ }) + +default["shinken"]["auto_poller_tags"] = false diff --git a/providers/host.rb b/providers/host.rb index e3ae476..7431b3b 100644 --- a/providers/host.rb +++ b/providers/host.rb @@ -33,6 +33,7 @@ :action_url => new_resource.action_url, :icon_image => new_resource.icon_image, :icon_image_alt => new_resource.icon_image_alt, + :poller_tag => new_resource.poller_tag, :escalations => new_resource.escalations, :use => new_resource.use diff --git a/recipes/arbiter-hosts.rb b/recipes/arbiter-hosts.rb index 22de90e..3ebae6c 100644 --- a/recipes/arbiter-hosts.rb +++ b/recipes/arbiter-hosts.rb @@ -82,6 +82,11 @@ host_alias n["fqdn"] hostgroups ["+#{n['os']}",n['roles'].join(",")] + # setup automatic poller tags + if node["shinken"]["auto_poller_tags"] + poller_tag n["domain"] + end + (n["nagios"]["host_definition"]||{}).each_pair do |k, v| self.send k, v end diff --git a/resources/host.rb b/resources/host.rb index eb3f4a8..9a796d9 100644 --- a/resources/host.rb +++ b/resources/host.rb @@ -64,6 +64,7 @@ def self.validation_callback(items, combination = true) attribute :icon_image_alt, :kind_of => String attribute :vrml_image, :kind_of => String attribute :statusmap_image, :kind_of => String +attribute :poller_tag, :kind_of => String #attribute :2d_coords, x_coord,y_coord #attribute :3d_coords, x_coord,y_coord,z_coord attribute :escalations, :kind_of => String diff --git a/templates/default/definitions/hosts/host.cfg.erb b/templates/default/definitions/hosts/host.cfg.erb index 9356f90..5d243e2 100644 --- a/templates/default/definitions/hosts/host.cfg.erb +++ b/templates/default/definitions/hosts/host.cfg.erb @@ -74,6 +74,9 @@ define host { <% if not @icon_image_alt.nil? %> icon_image_alt <%= @icon_image_alt %> <% end %> +<% if not @poller_tag.nil? %> + poller_tag <%= @poller_tag %> +<% end %> <% if not @escalations.nil? %> escalations <%= @escalations %> <% end %> From f98022dddc6c547d868702bd2c4f62dbccf5d535 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 16:35:21 +0300 Subject: [PATCH 19/56] search shinken_contacts databag for non-user contacts. --- recipes/arbiter-contacts.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/recipes/arbiter-contacts.rb b/recipes/arbiter-contacts.rb index 4d15ce9..067703a 100644 --- a/recipes/arbiter-contacts.rb +++ b/recipes/arbiter-contacts.rb @@ -66,6 +66,32 @@ end end +search(:shinken_contacts, "*:*") do |n| + # we'll use shinken_host LWRP to define host + shinken_contact n["id"] do + + contact_name n["id"] + contact_alias n["comment"] + email n["email"] + contactgroups "#{n["groups"].join(',')}" + n["groups"].each do |group| + if !contactgroups.include?(group) + contactgroups << group + end + end + + (n["shinken"]|| {}).delete_if{|k,v| k == "id"}.each_pair do |k,v| + self.send k, v + end + + if n.has_key?("use") + use n["use"] + else + use ["generic-contact"] + end + end +end + search(:users, "*:*") do |c| shinken_contact c["id"] do register true From 6e01818cbf115c57786deba4cc5a4d3c4f8eb7ed Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 16:37:19 +0300 Subject: [PATCH 20/56] dd service_dependencies attribute to services. --- providers/service.rb | 1 + resources/service.rb | 1 + templates/default/definitions/services/service.cfg.erb | 3 +++ 3 files changed, 5 insertions(+) diff --git a/providers/service.rb b/providers/service.rb index 1f35664..c0722e2 100644 --- a/providers/service.rb +++ b/providers/service.rb @@ -57,6 +57,7 @@ :icon_image => new_resource.icon_image, :icon_image_alt => new_resource.icon_image_alt, :escalations => new_resource.escalations, + :service_dependencies => new_resource.service_dependencies, :register => new_resource.register, :use => ((not template?) ? ["base-service"]:[]) + new_resource.use diff --git a/resources/service.rb b/resources/service.rb index 8fe0ac6..a9e8906 100644 --- a/resources/service.rb +++ b/resources/service.rb @@ -67,6 +67,7 @@ def self.validation_callback(items, combination = true) attribute :icon_image, :kind_of => String attribute :icon_image_alt, :kind_of => String attribute :escalations, :kind_of => String +attribute :service_dependencies, :kind_of => String attribute :register, :kind_of => [TrueClass, FalseClass], :default => true attribute :use, :kind_of => Array, :default => [] diff --git a/templates/default/definitions/services/service.cfg.erb b/templates/default/definitions/services/service.cfg.erb index b4bfb82..b68e137 100644 --- a/templates/default/definitions/services/service.cfg.erb +++ b/templates/default/definitions/services/service.cfg.erb @@ -121,6 +121,9 @@ define service { <% end %> <% if not @escalations.nil? %> escalations <%= @escalations %> +<% end %> +<% if not @service_dependencies.nil? %> + service_dependencies <%= @service_dependencies %> <% end %> register <%= @register ? "1": "0" %> <% if @use %> From c4c9d033e62dad62b77826f2da23d4b61d07b1f0 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 16:45:19 +0300 Subject: [PATCH 21/56] sort service_templates and services to prevent unneeded restarts. search the shinken_services data bag for services, instead of using node attribute. create service groups automatically from services. --- recipes/arbiter-services.rb | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/recipes/arbiter-services.rb b/recipes/arbiter-services.rb index fb2dc50..894415d 100644 --- a/recipes/arbiter-services.rb +++ b/recipes/arbiter-services.rb @@ -49,7 +49,10 @@ ### Populate # We'll now populate services with templates -search(:shinken_service_templates, "*:*") do |s| +service_templates = search(:shinken_service_templates, "*:*") +service_templates.sort! {|a,b| a.name <=> b.name } + +service_templates.each do |s| shinken_service s["id"] do # We wont register templates register false @@ -60,19 +63,29 @@ end end -# We'll now populate services with real content -search(:node, "monitoring:*") do |n| - (n["monitoring"]["checks"]|| {}).each_pair do |service_key, service| - # we'll use shinken_host LWRP to define host - shinken_service "#{n["fqdn"]}/#{service_key}" do - host_name n["fqdn"] - service_key service_key +servicegroups = [] +services = search(:shinken_services, "*:*") +services.sort! {|a,b| a.name <=> b.name } + +services.each do |s| + shinken_service s["id"] do + register true - service.each_pair do |k, v| - self.send k, v + s["servicegroups"].each do |group| + if !servicegroups.include?(group) + servicegroups << group end end + + s.delete_if{|k, v| k == "id"}.each_pair do |k, v| + self.send k, v + end end end - +servicegroups.each do |group| + shinken_servicegroup group do + servicegroup_name group + servicegroup_alias group + end +end From 3726fc56e68953fb2903361018a51a447d2dcb1d Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 16:53:09 +0300 Subject: [PATCH 22/56] add attribute for log file directory --- attributes/default.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/attributes/default.rb b/attributes/default.rb index 769fe8f..7117f88 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -37,6 +37,8 @@ default["shinken"]["bin_dir"] = "/usr/bin" end +default["shinken"]["log_dir"] = "/var/log/shinken" + default["shinken"]["scheduler" ]["port"] = 7768 default["shinken"]["reactionner"]["port"] = 7769 default["shinken"]["arbiter" ]["port"] = 7770 From 03d0892a5e0862c602444f790ef12023aba813fe Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 16:53:27 +0300 Subject: [PATCH 23/56] add escalation files --- recipes/arbiter.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/arbiter.rb b/recipes/arbiter.rb index 3bd3158..7b76ea2 100644 --- a/recipes/arbiter.rb +++ b/recipes/arbiter.rb @@ -154,6 +154,7 @@ :command_files => node.run_state["shinken"]["arbiter"]["commands"], :contact_files => node.run_state["shinken"]["arbiter"]["contacts"], :timeperiod_files => node.run_state["shinken"]["arbiter"]["timeperiods"], + :escalation_files => node.run_state["shinken"]["arbiter"]["escalations"], :notiticationway_files => node.run_state["shinken"]["arbiter"]["notificationways"] }) From f0b658fec3ba04003e6ad22c61a986febd62ffe7 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 16:54:10 +0300 Subject: [PATCH 24/56] continue chef run if arbiter doesn't start. --- recipes/arbiter.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/arbiter.rb b/recipes/arbiter.rb index 7b76ea2..9a90270 100644 --- a/recipes/arbiter.rb +++ b/recipes/arbiter.rb @@ -173,6 +173,7 @@ service "shinken-arbiter" do # Ensure it is started by default and running action [:enable, :start] + ignore_failure true # If ``/etc/default/shinken`` is changed, we'll restart subscribes :restart, "template[shinken/default/debian]", :delayed From 2c4cef87a5e03649ab9a5f633c1127fa0125201d Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 17:02:15 +0300 Subject: [PATCH 25/56] modules are already a hash --- templates/default/arbiter/module.cfg.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/default/arbiter/module.cfg.erb b/templates/default/arbiter/module.cfg.erb index a9dd899..61221e5 100644 --- a/templates/default/arbiter/module.cfg.erb +++ b/templates/default/arbiter/module.cfg.erb @@ -4,7 +4,7 @@ define module { module_name <%= @name %> module_type <%= @module_type %> -<% Hash.new(@variables.to_a.sort).each do |key, value| %> +<% @variables.to_a.sort.each do |key, value| %> <%= key %> <%= value %> <% end %> From 6c190db5ae07dfe6718a2d4076f46b7899fec2a7 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 17:02:27 +0300 Subject: [PATCH 26/56] add missing parameters to templates --- templates/default/definitions/contacts/contact.cfg.erb | 6 ++++++ templates/default/definitions/hosts/host.cfg.erb | 3 +++ templates/default/definitions/services/service.cfg.erb | 3 +++ 3 files changed, 12 insertions(+) diff --git a/templates/default/definitions/contacts/contact.cfg.erb b/templates/default/definitions/contacts/contact.cfg.erb index 93655a1..d835164 100644 --- a/templates/default/definitions/contacts/contact.cfg.erb +++ b/templates/default/definitions/contacts/contact.cfg.erb @@ -12,6 +12,9 @@ define contact { <% if not @contact_alias.nil? %> alias <%= @contact_alias %> <% end %> +<% if @contactgroups %> + contactgroups <%= @contactgroups %> +<% end %> <% if not @host_notifications_enabled.nil? %> host_notifications_enabled <%= @host_notifications_enabled ? "1": "0" %> <% end %> @@ -21,6 +24,9 @@ define contact { <% if @email %> email <%= @email %> <% end %> +<% if @pager %> + pager <%= @pager %> +<% end %> <% if not @can_submit_commands.nil? %> can_submit_commands <%= @can_submit_commands ? "1": "0" %> <% end %> diff --git a/templates/default/definitions/hosts/host.cfg.erb b/templates/default/definitions/hosts/host.cfg.erb index 5d243e2..453ba87 100644 --- a/templates/default/definitions/hosts/host.cfg.erb +++ b/templates/default/definitions/hosts/host.cfg.erb @@ -35,6 +35,9 @@ define host { <% if not @check_period.nil? %> check_period <%= @check_period %> <% end %> +<% if not @contacts.nil? %> + contacts <%= @contacts.join(",") %> +<% end %> <% if not @contact_groups.nil? %> contact_groups <%= @contact_groups.join(",") %> <% end %> diff --git a/templates/default/definitions/services/service.cfg.erb b/templates/default/definitions/services/service.cfg.erb index b68e137..a555dc5 100644 --- a/templates/default/definitions/services/service.cfg.erb +++ b/templates/default/definitions/services/service.cfg.erb @@ -11,6 +11,9 @@ define service { <% if not @host_name.nil? %> host_name <%= @host_name %> <% end %> +<% if not @hostgroup_name.nil? %> + hostgroup_name <%= @hostgroup_name %> +<% end %> <% if not @service_description.nil? %> service_description <%= @service_description %> <% end %> From b42d4719e8cd18caad86b8a060795a5b8f5453f7 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 17:15:07 +0300 Subject: [PATCH 27/56] allow role to override ipaddress for daemons. This is needed for remote pollers, when the poller's ipaddress is an internal one, but shinken needs to contact it on the external ip. --- recipes/arbiter.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/recipes/arbiter.rb b/recipes/arbiter.rb index 9a90270..8a1c4bd 100644 --- a/recipes/arbiter.rb +++ b/recipes/arbiter.rb @@ -80,7 +80,12 @@ shinken_daemon "#{daemon}-#{n[:fqdn]}" do daemon_type daemon - address n["fqdn"] + if n["shinken"][daemon.to_s]["ipaddress"].nil? + address n["ipaddress"] + else + address n["shinken"][daemon.to_s]["ipaddress"] + end + port n["shinken"][daemon.to_s]["port"] variables n["shinken"][daemon.to_s]["variables"] From 87455952955e217df661f17be30dedf76df7b4a0 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 17:16:20 +0300 Subject: [PATCH 28/56] module config moved to data bag. --- recipes/broker-webui.rb | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/recipes/broker-webui.rb b/recipes/broker-webui.rb index 18a3305..55e454f 100644 --- a/recipes/broker-webui.rb +++ b/recipes/broker-webui.rb @@ -37,36 +37,6 @@ package "shinken-webui" end -### Webui module declaration -# Store in db -node.default["shinken"]["broker"]["modules"]["webui"] = { - "id" => "webui", - "modules" => [ - "apache-passwd" - ], - "type" => "webui", - "variables" => { - "allow_html_output" => 0, - "auth_secret" => "c4c70386a4959a91e3725583f6ce75b40c67e70b1bf144fd49bc6b63f50c33f7", - "host" => "127.0.0.1", - "manage_acl" => 1, - "max_output_length" => 100, - "play_sound" => 0, - "port" => 7767 - } -} - -# Declare module in broker -# We'll need to merge with existing modules -# Proc is here just for namespacing code -node.override["shinken"]["broker"]["variables"]["modules"] = Proc.new{ - elts = node.normal["shinken"]["broker"]["variables"]["modules"].split(",").map{|s| s.strip()} - elts.push("webui") - elts.uniq! - elts.join(",") -}.call - - ## Reverse proxy # We'll now setup a reverse proxy include_recipe "nginx" From 88853030041924d727d01c3930d963c098da802f Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 17:16:37 +0300 Subject: [PATCH 29/56] include base recipe for poller-only nodes. --- recipes/poller.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/recipes/poller.rb b/recipes/poller.rb index 2305a6a..1d41d94 100644 --- a/recipes/poller.rb +++ b/recipes/poller.rb @@ -24,6 +24,11 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # +### Include base recipe +# See [shinken::base](base.html) + +include_recipe "shinken::base" + package "shinken-poller" if node[:platform] == "centos" From 2345e69e6318a7f693e65a3dc23fb30cba233e2d Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 17:33:55 +0300 Subject: [PATCH 30/56] setup default variables for broker and poller --- attributes/default.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 7117f88..454a524 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -58,8 +58,17 @@ default["shinken"]["scheduler" ]["variables"] = default_variables default["shinken"]["arbiter" ]["variables"] = default_variables -default["shinken"]["poller" ]["variables"] = default_variables -default["shinken"]["broker" ]["variables"] = default_variables +default["shinken"]["poller" ]["variables"] = default_variables.merge({ + "manage_sub_realms" => 0, + "min_workers" => 0, + "max_workers" => 0, + "processes_by_worker" => 256, + "polling_interval" => 1 +}) +default["shinken"]["broker" ]["variables"] = default_variables.merge({ + "manage_sub_realms" => 1, + "manage_arbiters" => 1 +}) default["shinken"]["receiver" ]["variables"] = default_variables default["shinken"]["reactionner"]["variables"] = default_variables.merge({ "manage_sub_realms" => 0, From 5dcd9080d990b2f4bead2dc5707cfc869fb40cf4 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 17:35:49 +0300 Subject: [PATCH 31/56] add shinken init script for centos --- files/centos/shinken | 541 +++++++++++++++++++++++++++++++++++++++++++ recipes/base.rb | 10 +- 2 files changed, 547 insertions(+), 4 deletions(-) create mode 100755 files/centos/shinken diff --git a/files/centos/shinken b/files/centos/shinken new file mode 100755 index 0000000..20dd2f0 --- /dev/null +++ b/files/centos/shinken @@ -0,0 +1,541 @@ +#!/bin/sh + +# Copyright (C) 2009-2011: +# Gabes Jean, naparuba@gmail.com +# Gerhard Lausser, Gerhard.Lausser@consol.de +# Gregory Starck, g.starck@gmail.com +# Hartmut Goebel, h.goebel@goebel-consult.de +# +# This file is part of Shinken. +# +# Shinken is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Shinken is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Shinken. If not, see . + +### BEGIN INIT INFO +# Provides: shinken +# Required-Start: $local_fs +# Required-Stop: $local_fs +# Default-Start: 2 3 4 5 +# Default-Stop: S 0 1 6 +# Short-Description: Shinken monitoring daemon +# Description: Shinken is a monitoring tool composed of many separated modules: +# - arbiter : the main one : control everything else. +# - scheduler : receives checks/actions from arbiter. Schedules & forwards them to pollers. +# - poller : receives the checks from a scheduler. Launch them and returns results +# - broker : manage results by looking at scheduler. Like export to flat file or db. +# - reactionner : manage the failed checks by looking at scheduler. +# - receiver : manage all passive data +### END INIT INFO + +# Deadlink :( +# http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html + + +NAME="shinken" + +AVAIL_MODULES="scheduler poller reactionner broker receiver arbiter" + +## SHINKEN_MODULE_FILE is set by shinken-* if it's one of these that's calling us. +if [ -z "$SHINKEN_MODULE_FILE" ]; then + SCRIPTNAME=$0 + _usage_mods_="[ <$AVAIL_MODULES> ]" +else + SCRIPTNAME=$SHINKEN_MODULE_FILE +fi + +curpath=$(cd $(dirname "$0") && pwd) +#echo curpath is $curpath filename is $(basename "$0") + +## Default paths: +test "$BIN" || BIN=$(cd $curpath/.. && pwd) +test "$VAR" || VAR=$(cd $curpath/../../var && pwd) +test "$ETC" || ETC=$(cd $curpath/../../etc && pwd) + +export PATH="${PATH:+$PATH:}/usr/sbin:/bin:/sbin" +export LANG=en_US.UTF8 +export PYTHONIOENCODING=utf8 + +# We try to find the LAST possible Python VERSION +pythonver() { + versions="2.4 2.5 2.6 2.7" + LASTFOUND="" + # Is there any python here? + for v in $versions + do + which python$v > /dev/null 2>&1 + if [ $? -eq 0 ] + then + LASTFOUND="python$v" + fi + done + if [ -z "$LASTFOUND" ] + then + # Finaly try to find a default python + which python > /dev/null 2>&1 + if [ $? -ne 0 ] + then + echo "No python interpreter found!" + exit 2 + else + echo "python found" + LASTFOUND=$(which python) + fi + fi + PYTHON=$LASTFOUND +} + +# Ok, go search this Python version +pythonver + +# Uncomment the line below if you got the **lib** shinken installed +# on a non standard place (not in /usr/lib/python*) +#export PYTHONPATH="${PATH:+$PATH:}/opt/shinken" +# Or uncommentif you want to force the Python version +#export PYTHON=python2.7 + +# default +DEBUG=false +CMD="" +SUBMODULES="" + +## This permits to overhidde the default "default shinken cfg file": +[ -z "$SHINKEN_DEFAULT_FILE" ] && SHINKEN_DEFAULT_FILE="/etc/default/$NAME" +## so you can now do: +## bash -c "SHINKEN_DEFAULT_FILE=$your_own_default_file $init_path/shinken $action $args" +## to easily use your own config + +#echo "Using $SHINKEN_DEFAULT_FILE .." + + + +usage() { + cat << END +Usage: $SCRIPTNAME [ -d ] {start|stop|restart|status|check} $_usage_mods_ + + -d start requested module(s) in debug mode, only useful with start|restart + +END +} + +if [ "$1" = "-d" ]; then + DEBUG="1" + shift +fi + +if [ $# -eq 0 ]; then + usage >&2 + exit 2 +fi + +CMD=$1 +shift +SUBMODULES=$* + +if [ -z "$SUBMODULES" ]; then + SUBMODULES=$AVAIL_MODULES +else + # check given modules + for mod1 in $SUBMODULES; do + found=0 + for mod2 in $AVAIL_MODULES; do + [ $mod1 = $mod2 ] && found=1; + done + [ $found = 0 ] && { usage >&2 ; exit 2 ; } + done +fi + + +# Reads configuration variable file if it is present +[ -r "$SHINKEN_DEFAULT_FILE" ] && . "$SHINKEN_DEFAULT_FILE" + + +# Now look if some required variables are pre defined: +if ! test "$SHINKENCFG" +then + SHINKENCFG="$ETC/nagios.cfg" +fi +if ! test "$SHINKENSPECIFICCFG" +then + SHINKENSPECIFICCFG="$ETC/shinken-specific.cfg" +fi + +# If var or run dir is missing, create them and chown them +[ ! -d $VAR ] && mkdir -p $VAR && chown $SHINKENUSER:$SHINKENGROUP $VAR +[ ! -d $RUN ] && mkdir -p $RUN && chown $SHINKENUSER:$SHINKENGROUP $RUN + +# Now place us in our var directory so even our arbiter will be +# happy for opening its pid and cmd files +cd $VAR + +#echo BIN=$BIN +#echo VAR=$VAR +#echo ETC=$ETC + +#set -xv + + +echo_success() { + log_end_msg 0 $* +} + +echo_failure() { + log_end_msg 1 $* +} + +#log_end_msg + + +# Load the VERBOSE setting and other rcS variables +[ -f /etc/default/rcS ] && . /etc/default/rcS + +# Source function library. +[ -f /etc/rc.d/init.d/functions ] && . /etc/rc.d/init.d/functions + +[ -f /lib/lsb/init-functions ] && . /lib/lsb/init-functions + + + +################################################ + +# +# returns the pid for a submodule +# + +getpidfile() { + mod="$1" + modPIDVAR=$(echo $mod | tr 'a-z' 'A-Z')"PID" + pidfile=$(echo $(eval echo \${$modPIDVAR})) + if test "$pidfile" + then + echo "$pidfile" + else + echo "$RUN/${mod}d.pid" + fi +} + +getmodpid() { + mod=$1 + pidfile=$(getpidfile "$mod") + if [ -s $pidfile ]; then + cat $pidfile + fi +} + + +getdebugfile() { + mod="$1" + modDEBUG=$(echo $mod | tr 'a-z' 'A-Z')"DEBUGFILE" + debugfile=$(echo $(eval echo \${$modDEBUG})) + if test "$debugfile" + then + echo "$debugfile" + else + echo "${VAR}/${mod}-debug.log" + fi +} + +# +# Display status +# +do_status() { + mod=$1 + pidfile=$(getpidfile "$mod") + [ -e "$pidfile" ] || { + echo "$mod NOT RUNNING (pidfile ($pidfile) not exist)" + return 3 + } + [ -r "$pidfile" ] || { + echo "$mod NOT RUNNING (pidfile ($pidfile) unreadable)" + return 3 + } + pid=$(cat "$pidfile") + if [ -z "$pid" ]; then + echo "$mod NOT RUNNING (pid file empty)" + return 4 + fi + ps -p "$pid" >/dev/null 2>&1 + rc=$? + if [ $rc != 0 ]; then + log_failure_msg "$mod NOT RUNNING (process $pid doesn't exist?)" + return 1 + fi + echo "$mod RUNNING (pid $pid)" + return 0 +} + +# +# starts our modules +# +do_start() { + mod=$1 + modfilepath="$BIN/shinken-${mod}" + [ -e "$modfilepath" ] || { + log_failure_msg "FAILED: did not found $mod file ($modfilepath) ; are you sure shinken-$mod is installed?" + return 5 + } + [ "$DEBUG" = 1 ] && DEBUGCMD="--debug "$(getdebugfile "$mod") + # Skonf need skonf.cfg, arbiter nagios.cfg, and the other OTHERd.ini + if [ "$mod" = 'skonf' ]; then + output=$("$modfilepath" -d -c "$SKONFCFG" $DEBUGCMD 2>&1) + rc=$? + elif [ "$mod" != "arbiter" ]; then + output=$("$modfilepath" -d -c "$ETC/${mod}d.ini" $DEBUGCMD 2>&1) + rc=$? + else + output=$("$modfilepath" -d -c "$SHINKENCFG" -c "$SHINKENSPECIFICCFG" $DEBUGCMD 2>&1) + rc=$? + fi + # debug: + #resfile="/tmp/bad_start_for_$mod" + #echo "$output" > "$resfile" || true + if [ $rc != 0 ]; then + resfile="/tmp/bad_start_for_$mod" + echo "$output" > "$resfile" || true + output=$(echo "$output" | tail -1) + echo "FAILED: $output (full output is in $resfile)" + return 1 + fi + echo "OK" + return 0 +} + +# +# stops modules +# +do_stop() { + mod=$1 + pid=$(getmodpid "$mod") + statusoutput=$(do_status "$mod") + [ $? -ne 0 ] && { + echo "$statusoutput" + return 0 + } + if [ ! -z "$pid" ]; then + kill "$pid" + sleep 0.5 + ## TODO: instead of 'sleep 1': wait up to when pid file is removed (with timeout)? + for i in 1 2 3 + do + # TODO: use a better way to get the children pids.. + allpids="$(ps -aef | grep "$pid" | grep "shinken-$mod" | awk '{print $2}')" + if [ -z "$allpids" ]; then + echo "OK" + return 0 + fi + sleep 1 + done + echo "there are still remaining processes to $mod running.. ; trying to kill them (SIGTERM).." + allpids="$(ps -aef | grep "$pid" | grep "shinken-$mod" | awk '{print $2}')" + for cpid in $(ps -aef | grep "$pid" | grep "shinken-$mod" | awk '{print $2}'); do + kill $cpid > /dev/null 2>&1 + done + for i in 1 2 3 + do + # TODO: eventually use a better way to get the children pids.. + allpids="$(ps -aef | grep "$pid" | grep "shinken-$mod" | awk '{print $2}')" + if [ -z "$allpids" ]; then + echo "OK" + return 0 + fi + sleep 1 + done + echo "there are still remaining processes to $mod running.. ; trying to kill -9 them.." + allpids="$(ps -aef | grep "$pid" | grep "shinken-$mod" | awk '{print $2}')" + for cpid in $(ps -aef | grep "$pid" | grep "shinken-$mod" | awk '{print $2}'); do + kill -9 $cpid > /dev/null 2>&1 + done + sleep 1 + allpids="$(ps -aef | grep "$pid" | grep "shinken-$mod" | awk '{print $2}')" + if [ ! -z "$allpids" ]; then + echo "FAILED: one or more process for $mod are still running after kill -9!" + echo "Remaining processes are (pids="$allpids"):" + ps -lf $(for p in $allpids ; do echo -n "-p$p " ; done) + echo "You should check this." + return 1 + fi + echo "OK" + else + echo "NOT RUNNING" + fi + return 0 +} + +# +# does the config check +# +do_check() { + [ "$DEBUG" = 1 ] && DEBUGCMD="--debug $VAR/${mod}-debug.log" + "$BIN/shinken-arbiter" -v -c "$ETC/nagios.cfg" -c "$ETC/shinken-specific.cfg" $DEBUGCMD 2>&1 + return $? +} + + +############################ + +do_start_() { + echo "Starting $1: " + status=$(do_status "$1") + rc=$? + if [ $rc -eq 0 ]; then + log_warning_msg "Already running" + return + fi + if test "$1" = "arbiter" + then + # arbiter is special: + # it doesn't actually declare a "workdir" properties in its config + # so we have explicitely to cd to the "VAR" directory. + # so that the default pidfile ( == nagios lock_file) which is now "arbiterd.pid" + # will be created at the correct place. + cd "$VAR" + # TODO: check if other possibility wouldn't be better: + # declare a "workdir" properties for the arbiter module definition.. in shinken-specific.cfg. + # but if the lock_file path is absolute then this 'cd' isn't required. + fi + startoutput=$(do_start "$1") + rc=$? + if [ $rc -eq 0 ]; then + echo_success + else + echo "$startoutput" + echo_failure + fi + return $rc +} + +do_stop_() { + echo "Stopping $1" + statusoutput=$(do_status "$1") + rc=$? + if [ $rc -ne 0 ]; then + failuremsg="Couldn't get status of $1: $statusoutput" + else + stopoutput=$(do_stop "$1" 2>&1) + rc=$? + [ $rc -ne 0 ] && failuremsg="Couldn't stop $1: $stopoutput" + fi + if [ $rc -ne 0 ]; then + log_failure_msg "$failuremsg" + echo_failure + else + echo_success + fi + return $rc +} + +do_restart_() { + mod="$1" + echo "Restarting $mod" + if [ "$mod" = "arbiter" ]; then + do_check_ "$mod" + checkrc=$? + if [ $checkrc -ne 0 ]; then + return 1 + fi + fi + stopoutput=$(do_stop "$mod") + startoutput=$(do_start "$mod") + rc=$? + if [ $rc -eq 0 ]; then + echo_success + else + log_failure_msg "$startoutput" + echo_failure + fi + return $rc +} + +do_reload_() { + mod="$1" + echo "Reloading $mod" + if [ "$mod" = "arbiter" ]; then + do_check_ "$mod" + checkrc=$? + if [ $checkrc -ne 0 ]; then + return 1 + fi + fi + stopoutput=$(do_stop "$mod") + startoutput=$(do_start "$mod") + rc=$? + if [ $rc -eq 0 ]; then + echo_success + else + log_failure_msg "$startoutput" + echo_failure + fi + return $rc +} + +do_status_() { + mod=$1 + echo "Checking status of $mod" + do_status "$1" + rc=$? + if [ $rc -eq 0 ]; then + echo_success + else + echo_failure + fi + +} + +do_check_() { + echo "Doing config check" + output=$(do_check "$1" 2>&1) + rc=$? + if [ $rc -eq 0 ]; then + echo_success + else + check_res_file=$(mktemp /tmp/shinken_checkconfig_resultXXXXXXXX) + echo "$output" > "$check_res_file" + mv $check_res_file /tmp/shinken_checkconfig_result + check_res_file="/tmp/shinken_checkconfig_result" + output=$(echo "$output" | tail -1) + log_warning_msg "full result is in ${check_res_file}" + log_failure_msg "ConfigCheck failed: $output" + echo_failure + fi + return $rc +} +do_checkconfig_() { do_check_ "$1" ; } + + +############################ + +do_cmd_on() { + action=$1 + mods=$2 + for mod in $mods + do + do_${action}_ "$mod" + done +} + + +############################ +## Main: + +case "$CMD" in + start|stop|restart|status) + do_cmd_on "$CMD" "$SUBMODULES" + ;; + check|checkconfig|reload) + do_cmd_on "$CMD" "arbiter" + ;; + *) + usage >&2 + exit 2 + ;; +esac + diff --git a/recipes/base.rb b/recipes/base.rb index 38d3a1b..cb916b3 100644 --- a/recipes/base.rb +++ b/recipes/base.rb @@ -57,10 +57,6 @@ mode "00644" end -template "/etc/init.d/shinken" do - mode 0755 -end - ### Cleanup # Remove unused files ['brokerd-windows.ini', @@ -92,3 +88,9 @@ cookbook_file "/etc/shinken/resource.cfg" do mode "00644" end + +if node[:platform] == "centos" + cookbook_file "/etc/init.d/shinken" do + mode "0755" + end +end From abd1513a0e24985880d98dd1580c5cd620a94e29 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 17:36:11 +0300 Subject: [PATCH 32/56] setup pnp4nagios --- recipes/pnp.rb | 15 ++++++++++ templates/default/broker/webui/nginx.cfg.erb | 14 +++++++++ templates/default/pnp4nagios.conf.erb | 30 ++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 recipes/pnp.rb create mode 100644 templates/default/pnp4nagios.conf.erb diff --git a/recipes/pnp.rb b/recipes/pnp.rb new file mode 100644 index 0000000..ac1bbf6 --- /dev/null +++ b/recipes/pnp.rb @@ -0,0 +1,15 @@ +package "pnp4nagios" +package "php-fpm" + +service "php-fpm" do + action [:enable, :start] +end + +service "npcd" do + action [:enable, :start] +end + +template "#{node['apache']['dir']}/conf.d/pnp4nagios.conf" do + mode 0644 + notifies :reload, "service[apache2]", :delayed +end diff --git a/templates/default/broker/webui/nginx.cfg.erb b/templates/default/broker/webui/nginx.cfg.erb index b69b76c..cf78f1e 100644 --- a/templates/default/broker/webui/nginx.cfg.erb +++ b/templates/default/broker/webui/nginx.cfg.erb @@ -13,6 +13,20 @@ server { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; } + location /pnp4nagios { + alias /usr/share/nagios/html/pnp4nagios/; + } + + location ~ ^(/pnp4nagios.*\.php)(.*)$ { + root /usr/share/nagios/html/pnp4nagios/; + include /etc/nginx/fastcgi_params; + fastcgi_split_path_info ^(.+\.php)(.*)$; + fastcgi_param PATH_INFO $fastcgi_path_info; + + fastcgi_param SCRIPT_FILENAME $document_root/index.php; + fastcgi_pass 127.0.0.1:9000; + } + } diff --git a/templates/default/pnp4nagios.conf.erb b/templates/default/pnp4nagios.conf.erb new file mode 100644 index 0000000..438070a --- /dev/null +++ b/templates/default/pnp4nagios.conf.erb @@ -0,0 +1,30 @@ +# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER + +Alias /pnp4nagios "/usr/share/nagios/html/pnp4nagios" + + + AllowOverride None + Order allow,deny + Allow from all + # + # Use the same value as defined in nagios.conf + # + AuthName "Monitoring Access" + AuthType Basic + AuthUserFile /etc/shinken/htpasswd.users + Require valid-user + + # Turn on URL rewriting + RewriteEngine On + Options symLinksIfOwnerMatch + # Installation directory + RewriteBase /pnp4nagios/ + # Protect application and system files from being viewed + RewriteRule "^(?:application|modules|system)/" - [F] + # Allow any files or directories that exist to be displayed directly + RewriteCond "%{REQUEST_FILENAME}" !-f + RewriteCond "%{REQUEST_FILENAME}" !-d + # Rewrite all other URLs to index.php/URL + RewriteRule "^.*$" "index.php/$0" [PT] + + From 7c906b7c13f2b0dc54f1d7daf62492ea737bb3ba Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 17:40:27 +0300 Subject: [PATCH 33/56] remove extra white space. --- metadata.rb | 1 - templates/default/reactionner/reactionnerd.ini.erb | 1 - 2 files changed, 2 deletions(-) diff --git a/metadata.rb b/metadata.rb index 2af48ca..e242ba9 100644 --- a/metadata.rb +++ b/metadata.rb @@ -9,4 +9,3 @@ depends "nginx" depends "mongodb" depends "python" - diff --git a/templates/default/reactionner/reactionnerd.ini.erb b/templates/default/reactionner/reactionnerd.ini.erb index 61eb2b2..91a2c9e 100644 --- a/templates/default/reactionner/reactionnerd.ini.erb +++ b/templates/default/reactionner/reactionnerd.ini.erb @@ -35,4 +35,3 @@ user=nagios group=nagios workdir=<%= node['shinken']['work_dir'] %> pidfile=<%= node['shinken']['run_dir'] %>/reactionnerd.pid - From 8ed4a37ac849aea78aa896cb7c65c08f40d6829a Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 17:59:46 +0300 Subject: [PATCH 34/56] setup thruk --- attributes/default.rb | 6 +- files/default/icons/centos.gd2 | Bin 0 -> 6423 bytes files/default/icons/centos.gif | Bin 0 -> 1868 bytes files/default/icons/centos.jpg | Bin 0 -> 1420 bytes files/default/icons/centos.png | Bin 0 -> 2206 bytes files/default/icons/win40.gd2 | Bin 0 -> 2389 bytes files/default/icons/win40.gif | Bin 0 -> 1800 bytes files/default/icons/win40.jpg | Bin 0 -> 1777 bytes files/default/icons/win40.png | Bin 0 -> 2288 bytes files/default/thruk_local.conf | 36 ++++ recipes/thruk.rb | 86 ++++++++++ templates/default/cgi.cfg.erb | 203 +++++++++++++++++++++++ templates/default/thruk-apache2.conf.erb | 71 ++++++++ 13 files changed, 401 insertions(+), 1 deletion(-) create mode 100644 files/default/icons/centos.gd2 create mode 100644 files/default/icons/centos.gif create mode 100644 files/default/icons/centos.jpg create mode 100644 files/default/icons/centos.png create mode 100644 files/default/icons/win40.gd2 create mode 100644 files/default/icons/win40.gif create mode 100644 files/default/icons/win40.jpg create mode 100644 files/default/icons/win40.png create mode 100644 files/default/thruk_local.conf create mode 100644 recipes/thruk.rb create mode 100644 templates/default/cgi.cfg.erb create mode 100644 templates/default/thruk-apache2.conf.erb diff --git a/attributes/default.rb b/attributes/default.rb index 454a524..9cca5cc 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -37,6 +37,8 @@ default["shinken"]["bin_dir"] = "/usr/bin" end +default["shinken"]["thruk"]["docroot"] = "/usr/share/thruk/root/thruk/" + default["shinken"]["log_dir"] = "/var/log/shinken" default["shinken"]["scheduler" ]["port"] = 7768 @@ -77,5 +79,7 @@ }) - +default["shinken"]["cert_name"] = node["fqdn"] +default["shinken"]["cgi"]["admin_group"] = "admins" +default["shinken"]["cgi"]["read_groups"] = "all" default["shinken"]["auto_poller_tags"] = false diff --git a/files/default/icons/centos.gd2 b/files/default/icons/centos.gd2 new file mode 100644 index 0000000000000000000000000000000000000000..1da67773af4d94533dd9c0ce1a8aee3c8ba9f817 GIT binary patch literal 6423 zcmd6sX;@QN8pr?6eDR~7)UUPfORaRoWu|JYsI87O+E(poZO09jv9!}p6|MU&E*(+S z(Eze4i0s>dLL%#w00|_71Z4>*5Fp7-Ac+ZK-gA7C5(QUg?B#j6_nr$Uzx#iev&46! z7w{X5r=R`!ErwvokX|}47>B>VKUiPAPA38b1L5UGpYMS(E4gkxLLJPKEifj|hVA}MV(bB9ev`-i`SYRE>CkI8qpNra^fx9zA2SBVeZK@ZrP%@0fGu%;CB@yC0$}e>?Qo#}eCUw;2=vfJcp)Tt`1YKa3hRYET(P zA`yRg_Wu2uR;xv?!vc%^EQ|>=VYoRBhS({b(-8MA-Fv~5vl|vd?ZTwkubo9&Mp{=bA_4?b0ty+w@s*l{3TJr^3%;hM1 z5R5p*$L{umhJ)z77Y!kEIXabcL@YRi@DERuokHRlBD9n@qA)P4Pdj^d8mXJZAvEjp zDtwxbWL%L>z*Xr)ZgGmGsMBYopz$C=%HDCev*+2h+tJ1JBR*Y48P1R1g`iOZZeyJF zVij_CC*Z=^-R}07r9oWZ*X0W-n+io+6x1CF2(R$=V0#h1^Kb7$`qoIUWAw-W98|uT z$`6sL*@P6;8fc9Y+`j)U={MDb@p<}%&OQcBnjA%^|BaBD$8ckLFxT;Q^^2&O#dYiK zRwL)0KQh!C&}7U<2J!aw{j>P4ymttdQ6-RG5+h{RF_Z@9qD7`f;#v`||MAuRt2KyG z(|!~377=Op7c?4jkz4lz($(vUv4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{-lf3wZCh&J%qS^7ubFS^EvbVo8I4bF|spbvG-WeYOdgH Uzn1-R7o+R@1(pkg{Qbgz0l3*H&Hw-a literal 0 HcmV?d00001 diff --git a/files/default/icons/centos.gif b/files/default/icons/centos.gif new file mode 100644 index 0000000000000000000000000000000000000000..b35146cea3725e81123f0c07bbb1ba6238ad7622 GIT binary patch literal 1868 zcmV-S2ebG`Nk%v~VJHA70QUd@0002-v_v;Hg5>eV_w?oc^WpO2>i5!*@24c4ot@v` z>%84>p3W_((?s*TR@3RAlarI|)6g$2eZhgS(c_-{`}#sbiRkgq)Thbwz+;Dphn}3m z_}QS*p~l_0)v&M4lp}hstILIhu#zEoo;ioLX{3LDfB*dU^0-dFf3c@clkcf2>-E*p z($)6!_a`QJ@v}oEBz9h1ns9KXgMqPcZ*TIrQRT?l`uy~#rN^+>Rq?e(yWDM@%_^JC zDf{o&>(I_=Xrb?@Civ{i`{%=})JdF~ztEn<^5*aU{{FUVr2YK;o;Zftve2D2g(@j} zrAUxPMMc!A%c4S!baSY;+hxJQ+3)e?_|=%dzt_Xye(LJ#?)KXJ?$pVcz`VQE@w7$s z-`4Q%$msFP@bL3SMT`Ia`)zHcSy-2`*jVzmN$;m6yxnm1+@V>f z`DJCF_wV+{jk=>ljjUIh^SxTO+GFVG@$d86qtH3`_xafAtoF=-_44his;ar%Y31_9 zrlzK%qM~bRq50sl&*YiS&EVVZviRGl-{Ik%%`C{p+tcN${{H;e(&PR9`z|efQc;rA zq{!;j3&Jn7Nk_}83XUS2UUe(OA?zyJUL^1D~?t~7;%ug#gk{QLaK zxzn|0qwwMFz<;sq_0_-MckihwD=K@U&^GzrttlvZ>+jT=FM;dX=%GQ3@UA!F@WDJh zJZWiYGBPsw+ojvv+p@91(&(Ms?X>WyCi&f|wzkp9q0Le+?_p zN|rQq-Y|+Z7-h?eKhM_4az`eRx{)Kb4fEAX2!flkK%v`a4kp0_fr1JR#OTBUY`0bk zxpj*eoMEws3axQ*3n>=Ova%qBquH1-dtl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$#!^iVn72bg#`&OFGUuL@NtO#$xvq!#N0;245 z?o_ z-T&d!kNV&(+qPU(?s3gHl**e`P_}8OW%5CFmFF_g_5^)?aBpLF*@bnR7aGY(++1%q zJ@~@o{Hm|-C0||_pC`Y0o9nI9Mv~kglmj-UY<$C793GfisM{O8Bf9zU%U+hb*lYE!>!?!8_8T>2mU1^+XptZ{E*C#{QoXX`ZqwYoDa$Fvl!KV1& z$68gh{|w4K0!uuf@$Y?>Zd>*3(XvZ_GMC53FA4L{OI4WUQ_RZ6uG;y4r}S)P|DoKd z>Wn}BiJF;Tu3b{yG40}Pu6Jv?_^O)Ql$C#lJ=k@5OFsYK&AzQqx+=ZY=P>F$W~rR< zKoQd(-UnTylP)}$vvi2 z+3xCL`&QjsZ_58hk2DR<$AI7mM8?A0%sb#WeXME_TZ`L0+`b9&wl7W`^^`dAZqaUE_D7!&)@^w8 zPyXW4OUn|r3*Nrfaa(pqDa-np+pS_{#`9O_~g^|tmg~`_FNi^cCpm|zX<^U4{uNa literal 0 HcmV?d00001 diff --git a/files/default/icons/centos.png b/files/default/icons/centos.png new file mode 100644 index 0000000000000000000000000000000000000000..e626bcf3e9fc2dd34cd48f2844f5f1557410b434 GIT binary patch literal 2206 zcmV;P2x0e$P)4;0GYE{%$>x{NlTdnPAae<+*4rq}DqVbp7v2S{IPYU&?>+_!HZxa!9`-GUP+d%fp*QGoQr zJl-vJ%a$!Rn=RmV54N0f7A$t=EkHRNy|y+NhO$_!*|TTA6Y7Qy8-i&a>K|;3apo^{ z=FO*svj046tO38Hqoe1|n>T#`ola*>WG0g-;KOnG9kg^UQnU(TEeAYO_#sjh=Bhj3 zb82B$ZEbB6-V4PzIoM{i5s2X@FxW>J9j}IGgD{W}24QWALD#DP9)&6zZqP9pi z7Kz3xdyaJ5eIDm+V9M6iMTJdQ1v-A zBJ932)WO7R_Bhn??5(#Mn^PE@Z?V6ln>FOCx6yZD-hgwp#96R45AT{MWql)>rZ zl`3nl&R)uphKH!H0pEK+zU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#BiudzDegRNU)m>`qJTmS$707*qoM6N<$f>*mq4gdfE literal 0 HcmV?d00001 diff --git a/files/default/icons/win40.gd2 b/files/default/icons/win40.gd2 new file mode 100644 index 0000000000000000000000000000000000000000..2225ed7fa8cda766809609381da7b402a9ef4cf5 GIT binary patch literal 2389 zcmds%dt8iJ7{^cd=whVlreek;lv}N~)oyOv>?p;S5=GdQOA#qj?I6l*k(SJ=3>!m8 zL^g%4%2sAmsfjL{j7Fzjc3Gd&%+$MQD%S32cmLXdcAxis&wDQ4_xGIhJmdLqBLSR1DF**usXwXzt)JBb(5)wk`>sv%c$@lK1Hg9Q)jKp;Ml>PguxHu|0 z`ltAKip!-q9GsX)9Xdn>1f1pb6=`WbXU+^{Wl`6!Q$8wN}m!lCbNXrq8+KTknAZSMu+7Pn|F&`iXxoZ)l23eLP zqa@-G$rUm+HMC%Xlc%SfyZb_C=Xr5)oLRH%4j)cvX=xM)PWAV{>F(~NC`D-K7C%4V zSFc`T+|}ItC^PdMB}J4N^|vC~Bh>d0Nh;7lD^fJ0z9!Vuh}w(L;}Rq|h_(lyP=B;# z6$)92)_S7ZwrJaG^rHUk@O5sV z$nIV2tIeh4eX0n3#pOPK{=B=pTPl@yc6L5_@}$1LUMLh+S67#omKGNm=jG+)!C)8}8I2x2T2D_; zM@L6fQ&U}?Y~p{x;6H1(fo%2)xcyHHU{yDWC0&?Um!!S6EMLhM{P}}hB^#B*@5b(^ zB$((9+zolh7Tm0sh}wQE+9+}MgU;*JQu#_r3PFLql< zP{I)_49Rc7Gb*vPQi?n3F#OC|3VK=5HRs1K<@FA3CAxb&FFYA zFZ=9}Ul-4%-f#UXxtwpo7ZR1q@KxE=r*pnZzL=77^e|quY?eP(^Gk;$UhaYP zW2deiQ~I5goqQova3mftba!`KvfOPre!*PuP2<6})5m~!I&}tqI{%8`%y&bHAmxe` zgWQe#324P7)f-9ixX(>3f0A>e+(n$1Ur&w6s9B)1y! z(P(6T@A(B72Z3NS);w@5&1@oFckDe$(-(AY-BC)tn9$Jht>MG-Ghu?oM4~!zQlO0` z11cU`uQbv%7^64B0q@?vYx~a7q4nC>1X>tR0#ggFxe0TkndwY2Kf0Eot=(sA>=(a3 zZqMGg@#6x)XqM($x=a%d<9k@T!BAc8UD^gK%JVUuJk!QaS#NGK-p1Hu!pz4HW|F-9 z(Fk|5rYNMY1V{iO;Kqmc>+-}{)JmvlPg)!5>+3}A64FrWB|`P%+f~-WkXq}qjh)K# zCTfw?eNRRPE% U)pbSh#{aHTQ22Kv|C|2b0Mo(94FCWD literal 0 HcmV?d00001 diff --git a/files/default/icons/win40.gif b/files/default/icons/win40.gif new file mode 100644 index 0000000000000000000000000000000000000000..05803bc4c0e8a85c1a39ca477ce04095ec2abeb3 GIT binary patch literal 1800 zcmb`G>pR!_%X-H_PM5AbKZmsQzCY5IEX@rPt8_Ke%%P3>#L5<6cAXKkRwVo6no`d3AVxKFm|`PQVFl zL%`-RD=$}rLLGp?5c~H#r=&n;X12Mx`ocmeHElX4M}xyT7Z*c9A(WT*TS*C2S_%~u zXeufokqAmiXlraV)Yofo+}OK)8|v?ehKBY=M|USC470PlYPDf$Nw3jBD=YfdRo&aS zkW40f`&PHG@Z09*C*0O*_iSzLv|63JJM;bfZHc71py2NULD4Bzy2DXF07KyjM-`(= zoqo^4ih4y@-YxCRxttr9_?N%s72Ldi$HR*k78NTft-PFH!1W85RWD6WO+9(~6m59` zzyTZ&FfjlV4NM|{u^-sS0{hc}X&j)w29$X~o(AL>fb^*7*TJqCF3Cn3-qbO;3C za6Cdn0)v8ly}j8&VF8`)cJ*rct5=h)t=D&VKd!AULy+OprL?H1$gQnSjb?RrcBZ}k zCbR+|HQ1d4x*4$Z5-dFddvm}r3wEY~b`rcE0zb<@YbD4`0GDDw+69mj4dO$M;s3#_VNfeW{6-XWKHHm;r1Uys~vPujbiZMa{uE3eT_4;mJfy5-63U#3uSu$>Gin!&$1f!6)i zN}ogM3&(xTJ+hu%1TS$ zym_;>wzjgevb?;!xVShzKCV({)z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|vjlVq-Rf)Jn4U`;kC9J*t4bFQWD*ylh literal 0 HcmV?d00001 diff --git a/files/default/icons/win40.png b/files/default/icons/win40.png new file mode 100644 index 0000000000000000000000000000000000000000..cd34eafb90ebfef06c1552273dbf680dda5813a9 GIT binary patch literal 2288 zcmVTGOh)JFd!tuI3o;?6%b~oA9sH=KETIn)~fvQ`_s3(PoMAJd-{BRPRj@(_$46! zMOa@*V*2^I>*(mvYPFS>m4YAupeQOgH&?ni&r&F9XY+puB7GtE+?(Nt7a5JDia z>h=1nswzUrv17+frk*G8S*_NaH*XpY29{;@dVNex%(L!La&j^uga)8gD(ma(0USDX zsGy*rv9U2MY-xFUxk{zV&CTt)e*Nf?Bl-DTCMG7!%gb#xn_8`|sHgxy(=BbQbz z|LvavP{Tb`-`QE?`n_Ct!|SoSB{L@R%fhH&-y;=ear_lhv-3t@UqeHK(P(tK_{Y6L z{}Zz-mQJW(9iRRgFK}X234ftX#xPuWgYbDO*HK5wi1=lpt8$xY>ztgLlI#~P3Zki> zDM7Q6DK`C08Zd5N0>_i+9OWm2bZ8=RPSbH4=)!8b-^-$7O1?6S{Q8e_Ii=BP($mwm zE3^QJ=zN4@89)QnV?}xXe8s8~^7^|}u#Oivno0Pyl>a{o$V zHVKYNEJ<{W|2?#Cdw%+9N=k~CmzUt2DQ&skY`o`9tyYIvEGEDns)lYk01S@8Vus~m zWtE*X-t*fgegmiXwHMg`#`uvaTZ-<6%5kgL$`uc<2rKP1GtJP`% zdc8g-MhCEQ3ET7XDtGPTcJCfx*$4nd8$o`A*aue+1{!eU0OEABjQ6!VFmPdRZmx87 z-@bj((b0v4g%uSQ#l^+(t5-)xMs{{~e(}Z00|!1c8jTu_Myu6YEEWKw=vuL&IBs>+ zON+xL%^n@SFCrojK>!gE5{xC``1f_R-rt+MF`k&=Rwn;?j{c*AR-8XAObw7 zDY)h)9nEu2TA^%eQbb3?-Q77fM0t6!H8tOOd#eD%#l^+Mtjf*Z3}DZmJ)1UV=jRum zIdjf#x7%#Crlt#TzPXL(-S2*)@bq#*(+cICJC5jR%HK~M9Hg6? z9z+oo1xh}~;W0t8lam0Msnh!HADU%e9AM?C!1r zz;n*9F!{oToJysrt;Mx#h>RpXCi>(_;^Bd$Bz*Us;=%>Q#uC@v%+P9AwY2=brshv} zd*|a~X|cm%pOe9JVtnx6UucCAfJ&vfbH}lAC0|rTLP7vw)haqaA1W0b4)VquNK2D3 zj8do5rKhL+`?KBMWlvyz0%!nMtF^1^+U3iaeSLjC`lxj4)~(6O$&-^4fGQ#a5fSL? z>!RsJ**OcYTrt+wbtoBy!{Ml|uAZKrmO6%e2n`Jl3=9km3}hGv07X&bh=1B zganplv$L}gA3prJQhaFWR(pH<>C>n4^73$3tMQ=4#Kdi>MTm%qh=_i`y=q;5&svbyvwEaD%L�< KMNUMnLSTZ>Ltga& literal 0 HcmV?d00001 diff --git a/files/default/thruk_local.conf b/files/default/thruk_local.conf new file mode 100644 index 0000000..23e53e5 --- /dev/null +++ b/files/default/thruk_local.conf @@ -0,0 +1,36 @@ +# +# This file is managed by Chef. Local modifications will be overwritten. +# +############################################ +# put your own settings into this file +# settings from this file will override +# those from the thruk.conf +############################################ +enable_shinken_features = 1 +logo_path_prefix = /thruk/icons/ +physical_logo_path = /usr/share/thruk/root/thruk/icons +start_page = /thruk/cgi-bin/tac.cgi +first_day_of_week = 0 + + + ahas = 1 # For Hosts Too + broadcast_notification = 0 # Broadcast + force_check = 1 # Forced Check + force_notification = 0 # Forced Notification + send_notification = 0 # Send Notification + sticky_ack = 1 # Sticky Acknowledgement + persistent_comments = 1 # Persistent Comments + persistent_ack = 1 # Persistent Acknowledgement Comments + ptc = 0 # For Child Hosts Too + use_expire = 0 # Use expire for acknowledgements (for cores which support this) + + + + + name = External Shinken + type = livestatus + + peer = 127.0.0.01:50000 + + + diff --git a/recipes/thruk.rb b/recipes/thruk.rb new file mode 100644 index 0000000..237f3e4 --- /dev/null +++ b/recipes/thruk.rb @@ -0,0 +1,86 @@ +### Include base recipe +# See [shinken::broker](broker.html) +include_recipe "shinken::broker" + +major = node['platform_version'].to_i +machine = node['kernel']['machine'] +platform_family = node['platform_family'] +thruk_version = "1.68" + +include_recipe "apache2" +include_recipe "apache2::mod_rewrite" +include_recipe "apache2::mod_php5" +include_recipe "apache2::mod_fcgid" +include_recipe "apache2::mod_ssl" + +apache_site "000-default" do + enable false +end + +remote_file "#{Chef::Config[:file_cache_path]}/thruk-#{thruk_version}-1.#{platform_family}#{major}.#{machine}.rpm" do + action :create_if_missing + source "http://www.thruk.org/files/pkg/v#{thruk_version}/#{platform_family}#{major}/#{machine}/thruk-#{thruk_version}-1.#{platform_family}#{major}.#{machine}.rpm" + backup false + not_if "rpm -qa | grep -q '^thruk-#{thruk_version}'" + notifies :install, "rpm_package[thruk]", :immediately +end + +rpm_package "thruk" do + source "#{Chef::Config[:file_cache_path]}/thruk-#{thruk_version}-1.#{platform_family}#{major}.#{machine}.rpm" + options "--nodeps" + action :nothing +end + +file "thruk-cleanup" do + path "#{Chef::Config[:file_cache_path]}/thruk-#{thruk_version}-1.#{platform_family}#{major}.#{machine}.rpm" + action :delete +end + + +remote_directory "/usr/share/thruk/root/thruk/icons" do + mode 0755 +end + +cookbook_file "/etc/thruk/thruk_local.conf" do + mode 0644 +end + +file "#{node['apache']['dir']}/conf.d/thruk.conf" do + action :delete + notifies :reload, "service[apache2]", :delayed +end + +cookbook_file "#{node['apache']['dir']}/ssl/#{node['shinken']['cert_name']}.crt" do + source "certs/#{node['shinken']['cert_name']}.crt" +end + +cookbook_file "#{node['apache']['dir']}/ssl/#{node['shinken']['cert_name']}.key" do + source "certs/#{node['shinken']['cert_name']}.key" +end + +if !node['shinken']['cert_ca_name'].nil? + cookbook_file "#{node['apache']['dir']}/ssl/#{node['shinken']['cert_ca_name']}.crt" do + source "certs/#{node['shinken']['cert_ca_name']}.crt" + end +end + +template "#{node['apache']['dir']}/sites-available/thruk.conf" do + source "thruk-apache2.conf.erb" + mode 00644 + if ::File.symlink?("#{node['apache']['dir']}/sites-enabled/thruk.conf") + notifies :reload, "service[apache2]", :immediately + end +end + +template "/etc/thruk/cgi.cfg" do + mode 0644 + notifies :restart, "service[apache2]", :delayed +end + +apache_site "thruk.conf" + +service "thruk" do + action [:enable, :start] + subscribes :restart, "cookbook_file[/etc/thruk/thruk_local.conf]", :immediately +end + diff --git a/templates/default/cgi.cfg.erb b/templates/default/cgi.cfg.erb new file mode 100644 index 0000000..1c06179 --- /dev/null +++ b/templates/default/cgi.cfg.erb @@ -0,0 +1,203 @@ +################################################################# +# +# CGI.CFG - Sample CGI Configuration File +# +################################################################# + +# CONTEXT-SENSITIVE HELP +# This option determines whether or not a context-sensitive +# help icon will be displayed for most of the CGIs. +# Values: 0 = disables context-sensitive help +# 1 = enables context-sensitive help + +show_context_help=0 + +# AUTHENTICATION USAGE +# This option controls whether or not the CGIs will use any +# authentication when displaying host and service information, as +# well as committing commands for processing. +# +# Read the HTML documentation to learn how the authorization works! +# +# NOTE: It is a really *bad* idea to disable authorization, unless +# you plan on removing the command CGI (cmd.cgi)! Failure to do +# so will leave you wide open to kiddies messing with Thruk and +# possibly hitting you with a denial of service attack by filling up +# your drive by continuously writing to your command file! +# +# Setting this value to 0 will cause the CGIs to *not* use +# authentication (bad idea), while any other value will make them +# use the authentication functions (the default). + +use_authentication=1 + + + + +# x509 CERT AUTHENTICATION +# When enabled, this option allows you to use x509 cert (SSL) +# authentication in the CGIs. This is an advanced option and should +# not be enabled unless you know what you're doing. + +use_ssl_authentication=0 + + + + +# DEFAULT USER +# Setting this variable will define a default user name that can +# access pages without authentication. This allows people within a +# secure domain (i.e., behind a firewall) to see the current status +# without authenticating. You may want to use this to avoid basic +# authentication if you are not using a secure server since basic +# authentication transmits passwords in the clear. +# +# Important: Do not define a default username unless you are +# running a secure web server and are sure that everyone who has +# access to the CGIs has been authenticated in some manner! If you +# define this variable, anyone who has not authenticated to the web +# server will inherit all rights you assign to this user! + +default_user_name=thrukadmin + + + +# SYSTEM/PROCESS INFORMATION ACCESS +# This option is a comma-delimited list of all usernames that +# have access to viewing the process information as +# provided by the Extended Information CGI (extinfo.cgi). By +# default, *no one* has access to this unless you choose to +# not use authorization. You may use an asterisk (*) to +# authorize any user who has authenticated to the web server. +# Alternatively you can specify contactgroups too + +authorized_for_system_information=thrukadmin +authorized_contactgroup_for_system_information=<%= node["shinken"]["cgi"]["admin_group"] %> + + +# CONFIGURATION INFORMATION ACCESS +# This option is a comma-delimited list of all usernames that +# can view ALL configuration information (hosts, commands, etc). +# By default, users can only view configuration information +# for the hosts and services they are contacts for. You may use +# an asterisk (*) to authorize any user who has authenticated +# to the web server. +# Alternatively you can specify contactgroups too + +authorized_for_configuration_information=thrukadmin +authorized_contactgroup_for_configuration_information=<%= node["shinken"]["cgi"]["admin_group"] %> + + +# SYSTEM/PROCESS COMMAND ACCESS +# This option is a comma-delimited list of all usernames that +# can issue shutdown and restart commands via the +# command CGI (cmd.cgi). Users in this list can also change +# the program mode to active or standby. By default, *no one* +# has access to this unless you choose to not use authorization. +# You may use an asterisk (*) to authorize any user who has +# authenticated to the web server. +# Alternatively you can specify contactgroups too + +authorized_for_system_commands=thrukadmin +authorized_contactgroup_for_system_commands=<%= node["shinken"]["cgi"]["admin_group"] %> + + +# GLOBAL HOST/SERVICE VIEW ACCESS +# These two options are comma-delimited lists of all usernames that +# can view information for all hosts and services that are being +# monitored. By default, users can only view information +# for hosts or services that they are contacts for (unless you +# you choose to not use authorization). You may use an asterisk (*) +# to authorize any user who has authenticated to the web server. +# Alternatively you can specify contactgroups too + +authorized_for_all_services=thrukadmin +authorized_contactgroup_for_all_services=<%= node["shinken"]["cgi"]["read_groups"] %> + +authorized_for_all_hosts=thrukadmin +authorized_contactgroup_for_all_hosts=<%= node["shinken"]["cgi"]["read_groups"] %> + + +# GLOBAL HOST/SERVICE COMMAND ACCESS +# These two options are comma-delimited lists of all usernames that +# can issue host or service related commands via the command +# CGI (cmd.cgi) for all hosts and services that are being monitored. +# By default, users can only issue commands for hosts or services +# that they are contacts for (unless you you choose to not use +# authorization). You may use an asterisk (*) to authorize any +# user who has authenticated to the web server. +# Alternatively you can specify contactgroups too + +authorized_for_all_service_commands=thrukadmin +authorized_contactgroup_for_all_service_commands=<%= node["shinken"]["cgi"]["admin_group"] %> + +authorized_for_all_host_commands=thrukadmin +authorized_contactgroup_for_all_host_commands=<%= node["shinken"]["cgi"]["admin_group"] %> + +# READ-ONLY USERS +# A comma-delimited list of usernames that have read-only rights in +# the CGIs. This will block any service or host commands normally shown +# on the extinfo CGI pages. It will also block comments from being shown +# to read-only users. +# Alternatively you can specify contactgroups too + +authorized_for_read_only= +authorized_contactgroup_for_read_only=<%= node["shinken"]["cgi"]["read_groups"] %> + +# REFRESH RATE +# This option allows you to specify the refresh rate in seconds +# of various CGIs (status, statusmap, extinfo, and outages). + +refresh_rate=90 + + + +# ESCAPE HTML TAGS +# This option determines whether HTML tags in host and service +# status output is escaped in the web interface. If enabled, +# your plugin output will not be able to contain clickable links. + +escape_html_tags=1 + + +# URL TARGET FRAMES +# These options determine the target frames in which notes and +# action URLs will open. + +action_url_target=_blank +notes_url_target=_blank + + +# LOCK AUTHOR NAMES OPTION +# This option determines whether users can change the author name +# when submitting comments, scheduling downtime. If disabled, the +# author names will be locked into their contact name, as defined in your Monitoring. +# Values: 0 = allow editing author names +# 1 = lock author names (disallow editing) + +lock_author_names=1 + + +# SOUND OPTIONS +# These options allow you to specify an optional audio file +# that should be played in your browser window when there are +# problems on the network. The audio files are used only in +# the status CGI. Only the sound for the most critical problem +# will be played. Order of importance (higher to lower) is as +# follows: unreachable hosts, down hosts, critical services, +# warning services, and unknown services. If there are no +# visible problems, the sound file optionally specified by +# 'normal_sound' variable will be played. +# +# = +# +# Note: All audio files use relative paths from /thruk/cgi-bin/status.cgi +# and must be accessible by web + +host_unreachable_sound=../media/critical.wav +host_down_sound=../media/critical.wav +service_critical_sound=../media/critical.wav +service_warning_sound=../media/warning.wav +service_unknown_sound=../media/unknown.wav +#normal_sound=../media/ok.wav + diff --git a/templates/default/thruk-apache2.conf.erb b/templates/default/thruk-apache2.conf.erb new file mode 100644 index 0000000..bc5161c --- /dev/null +++ b/templates/default/thruk-apache2.conf.erb @@ -0,0 +1,71 @@ + + ServerName <%= node['fqdn'] %> + Redirect permanent / https://<%= node['fqdn'] %>/ + + + + ServerAdmin root@localhost + ServerName <%= node['fqdn'] %> + DocumentRoot <%= node['shinken']['thruk']['docroot'] %> + CustomLog <%= node['shinken']['log_dir'] %>/apache_access.log combined + ErrorLog <%= node['shinken']['log_dir'] %>/apache_error.log + + SSLEngine On + SSLCertificateFile <%= node['apache']['dir'] %>/ssl/<%= node['shinken']['cert_name'] %>.crt + SSLCertificateKeyFile <%= node['apache']['dir'] %>/ssl/<%= node['shinken']['cert_name'] %>.key +<% unless node['shinken']['cert_ca_name'].nil? %> + SSLCertificateChainFile <%= node['apache']['dir'] %>/ssl/<%= node['shinken']['cert_ca_name'] %>.crt +<% end %> + + + AddHandler fcgid-script .sh + IPCCommTimeout 120 + + + Options FollowSymLinks + AllowOverride All + order allow,deny + allow from all + + + Options FollowSymLinks + allow from all + + + Options FollowSymLinks + allow from all + + + # redirect to a startup page when there is no pidfile yet + RewriteEngine On + RewriteRule ^/$ /thruk [R=301,L] + RewriteCond %{REQUEST_METHOD} GET + RewriteCond %{REQUEST_URI} !^/thruk/startup.html + RewriteCond %{REQUEST_URI} !^/thruk/side.html + RewriteCond %{REQUEST_URI} !^/thruk/.*\.(css|png|js) + RewriteCond %{REQUEST_URI} ^/thruk + RewriteCond /var/cache/thruk/thruk.pid !-f + RewriteRule ^(.*)$ /thruk/startup.html?$1 [R=302,L,NE,QSA] + + Alias /thruk/documentation.html /usr/share/thruk/root/thruk/documentation.html + Alias /thruk/startup.html /usr/share/thruk/root/thruk/startup.html + AliasMatch ^/thruk/(.*\.cgi|.*\.html) /usr/share/thruk/fcgid_env.sh/thruk/$1 + AliasMatch ^/thruk/plugins/(.*?)/(.*)$ /etc/thruk/plugins/plugins-enabled/$1/root/$2 + Alias /thruk/themes/ /etc/thruk/themes/themes-enabled/ + Alias /thruk /usr/share/thruk/root/thruk + + + Options ExecCGI + AuthName "Monitoring Access" + AuthType Basic + AuthUserFile "/etc/shinken/htpasswd.users" + require valid-user + + + Order Deny,Allow + Allow from all + Satisfy any + + + + From c3bb1581284517bddd9b690dcfeaafc953bfb2a3 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 18:00:00 +0300 Subject: [PATCH 35/56] use host template, not service --- examples/data_bags/shinken_host_templates/centos-host.json | 2 +- examples/data_bags/shinken_host_templates/windows-host.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/data_bags/shinken_host_templates/centos-host.json b/examples/data_bags/shinken_host_templates/centos-host.json index de69a8b..02a1e82 100644 --- a/examples/data_bags/shinken_host_templates/centos-host.json +++ b/examples/data_bags/shinken_host_templates/centos-host.json @@ -1,6 +1,6 @@ { "id": "centos-host", - "use": ["generic-service"], + "use": ["generic-host"], "hostgroups": ["+linux", "centos"], "icon_image": "centos.png", "icon_image_alt": "Centos" diff --git a/examples/data_bags/shinken_host_templates/windows-host.json b/examples/data_bags/shinken_host_templates/windows-host.json index 683d445..17fe374 100644 --- a/examples/data_bags/shinken_host_templates/windows-host.json +++ b/examples/data_bags/shinken_host_templates/windows-host.json @@ -1,6 +1,6 @@ { "id": "windows-host", - "use": ["generic-service"], + "use": ["generic-host"], "hostgroups": ["windows"], "icon_image": "win40.png", "icon_image_alt": "Windows" From df0d46612526f01a3dbe8d779cd3836aa00e092a Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 18:04:37 +0300 Subject: [PATCH 36/56] include xmppsend script for sending jabber notifications --- files/default/xmppsend | 78 ++++++++++++++++++++++++++++++ recipes/xmpp.rb | 9 ++++ templates/default/xmppsend.ini.erb | 6 +++ 3 files changed, 93 insertions(+) create mode 100755 files/default/xmppsend create mode 100644 recipes/xmpp.rb create mode 100644 templates/default/xmppsend.ini.erb diff --git a/files/default/xmppsend b/files/default/xmppsend new file mode 100755 index 0000000..0b07e98 --- /dev/null +++ b/files/default/xmppsend @@ -0,0 +1,78 @@ +#!/usr/bin/python -tt +# +# This file is managed by Chef. Local modifications will be overwritten. +# +# skvidal@fedoraproject.org, modified by Andrea Veri +# gplv2+ + +#nagios definition +## 'host-notify-by-jabber' command definition +#define command{ +# command_name host-notify-by-jabber +# command_line /usr/local/bin/xmppsend -a config.ini "Host '$HOSTALIAS$' is $HOSTSTATE$ - Info : $HOSTOUTPUT$" $CONTACTPAGER$ +# } +# +## 'notify-by-jabber' command definition +#define command{ +# command_name notify-by-jabber +# command_line /usr/local/bin/xmppsend -a config.ini "$NOTIFICATIONTYPE$ $HOSTNAME$ $SERVICEDESC$ $SERVICESTATE$ $SERVICEOUTPUT$ $LONGDATETIME$" $CONTACTPAGER$ +# } +# + +import warnings +warnings.simplefilter("ignore") + +import xmpp +from xmpp.protocol import Message + +from optparse import OptionParser +import ConfigParser +import sys +import os + +parser = OptionParser() +parser.add_option("-a", dest="authfile", default=None, help="file to retrieve username/password information from") +opts, args = parser.parse_args() + +conf = ConfigParser.ConfigParser() +if not opts.authfile or not os.path.exists(opts.authfile): + print "no config/auth file specified, can't continue" + sys.exit(1) + +conf.read(opts.authfile) +if not conf.has_section('xmpp_nagios') or not conf.has_option('xmpp_nagios', 'username') or not conf.has_option('xmpp_nagios', 'password'): + print "cannot find at least one of: config section 'xmpp_nagios' or username or password" + sys.exit(1) + +username = conf.get('xmpp_nagios', 'username') +password = conf.get('xmpp_nagios', 'password') +domain = conf.get('xmpp_nagios', 'domain') +server = conf.get('xmpp_nagios', 'server') +port = conf.get('xmpp_nagios', 'port') + +if len(args) < 1: + print "xmppsend message [to whom, multiple args]" + sys.exit(1) + +msg = args[0] + +msg = msg.replace('\\n', '\n') + +# Connect to the server +c = xmpp.Client(domain) +c.connect( ( server, port ) ) + +# Authenticate to the server +jid = xmpp.protocol.JID( username ) +c.auth( jid.getNode( ), password ) + +if len(args) < 2: + r = c.getRoster() + for user in r.keys(): + if user == username: + continue + c.send(Message(user, '%s' % msg)) +else: + for user in args[1:]: + c.send(Message(user, '%s' % msg)) + diff --git a/recipes/xmpp.rb b/recipes/xmpp.rb new file mode 100644 index 0000000..363bc23 --- /dev/null +++ b/recipes/xmpp.rb @@ -0,0 +1,9 @@ +package "python-xmpp" + +cookbook_file "/usr/local/bin/xmppsend" do + mode 0755 +end + +template "/usr/local/etc/xmppsend.ini" do + mode 0644 +end diff --git a/templates/default/xmppsend.ini.erb b/templates/default/xmppsend.ini.erb new file mode 100644 index 0000000..a7149f7 --- /dev/null +++ b/templates/default/xmppsend.ini.erb @@ -0,0 +1,6 @@ +[xmpp_nagios] +username=<%= node["shinken"]["xmpp"]["username"] %> +domain=<%= node["shinken"]["xmpp"]["domain"] %> +password=<%= node["shinken"]["xmpp"]["password"] %> +server=<%= node["shinken"]["xmpp"]["server"] %> +port=<%= node["shinken"]["xmpp"]["port"] %> \ No newline at end of file From e5f8b46f998a314c5a18d1d87d96b32be1b7327c Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 18:05:07 +0300 Subject: [PATCH 37/56] just use the templates specficied by the service. --- providers/service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/providers/service.rb b/providers/service.rb index c0722e2..b6ad516 100644 --- a/providers/service.rb +++ b/providers/service.rb @@ -60,7 +60,7 @@ :service_dependencies => new_resource.service_dependencies, :register => new_resource.register, - :use => ((not template?) ? ["base-service"]:[]) + new_resource.use + :use => new_resource.use } vars.update({ :check_command => command From 8b2225fa86f708d24223e8c8826d990653f49af7 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 18:05:34 +0300 Subject: [PATCH 38/56] by default, use a per-os template for hosts --- recipes/arbiter-hosts.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/arbiter-hosts.rb b/recipes/arbiter-hosts.rb index 3ebae6c..f33270e 100644 --- a/recipes/arbiter-hosts.rb +++ b/recipes/arbiter-hosts.rb @@ -92,7 +92,7 @@ end if (n["nagios"]["host_definition"]|| {})["use"].nil? - use ["generic-host"] + use ["#{n['platform']}-host"] end end end From ef920014c97cdd5aab0126943c1aece9da4a4209 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 18:09:34 +0300 Subject: [PATCH 39/56] setup user using nagios attributes. use membership in sysadmin group to determine admin status. --- recipes/arbiter-contacts.rb | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/recipes/arbiter-contacts.rb b/recipes/arbiter-contacts.rb index 067703a..59848c5 100644 --- a/recipes/arbiter-contacts.rb +++ b/recipes/arbiter-contacts.rb @@ -92,16 +92,17 @@ end end -search(:users, "*:*") do |c| +search(:users, "nagios:* NOT action:remove") do |c| shinken_contact c["id"] do register true contact_name c["id"] - contact_alias c["name"] - email c["mail"] + contact_alias c["comment"] + email c["nagios"]["email"] + pager c["nagios"]["pager"] if c["nagios"].has_key?("pager") - contactgroups "#{n["groups"].join(',')}" - n["groups"].each do |group| + contactgroups "#{c["groups"].join(',')}" + c["groups"].each do |group| if !contactgroups.include?(group) contactgroups << group end @@ -111,7 +112,7 @@ self.send k, v end - if c["admin"] == true + if c["groups"].include?("sysadmin") if c["oncall"] == true use ["oncall", "admin"] else @@ -123,9 +124,6 @@ end end - - - contactgroups.each do |group| shinken_contactgroup group do contactgroup_name group From 2b6b2aa3480e3fb9a10071388305ea506a18a4f7 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 18:12:44 +0300 Subject: [PATCH 40/56] add example user. --- examples/data_bags/users/adminuser.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 examples/data_bags/users/adminuser.json diff --git a/examples/data_bags/users/adminuser.json b/examples/data_bags/users/adminuser.json new file mode 100644 index 0000000..50a69ee --- /dev/null +++ b/examples/data_bags/users/adminuser.json @@ -0,0 +1,12 @@ +{ + "id": "adminuser", + "password": "$1$put encrypted password here", + "groups": [ "sysadmin" ], + "uid": 2001, + "shell": "\/bin\/bash", + "comment": "Example Admin User", + "nagios": { + "pager": "adminuser@jabber.org", + "email": "adminuser@example.com" + } +} \ No newline at end of file From 8ebce2c2dc644ad4276a44c6f3bc481f35a26eca Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 18:14:33 +0300 Subject: [PATCH 41/56] add recipe for server-side plugins --- recipes/plugins.rb | 1 + 1 file changed, 1 insertion(+) create mode 100644 recipes/plugins.rb diff --git a/recipes/plugins.rb b/recipes/plugins.rb new file mode 100644 index 0000000..ac08929 --- /dev/null +++ b/recipes/plugins.rb @@ -0,0 +1 @@ +package "nagios-plugins-nrpe" From 49776c65c9b6715992af58a9a0291162c6f60bde Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Tue, 18 Jun 2013 23:11:34 +0300 Subject: [PATCH 42/56] add more dependencies --- metadata.rb | 4 +++- recipes/pnp.rb | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index e242ba9..ec0b048 100644 --- a/metadata.rb +++ b/metadata.rb @@ -7,5 +7,7 @@ depends "apt" depends "nginx" -depends "mongodb" +depends "mongodb", " >= 0.12" depends "python" +depends "apache2" +depends "yum" diff --git a/recipes/pnp.rb b/recipes/pnp.rb index ac1bbf6..615bd5e 100644 --- a/recipes/pnp.rb +++ b/recipes/pnp.rb @@ -1,3 +1,7 @@ +if node[:platform] == "centos" + include_recipe "yum::repoforge" +end + package "pnp4nagios" package "php-fpm" From e8ce626bb5088af7dd05b78d9f570078e5a13c40 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Wed, 19 Jun 2013 19:21:29 +0300 Subject: [PATCH 43/56] move thruk to separate cookbook. --- attributes/default.rb | 2 - examples/roles/shinken.rb | 2 +- files/default/icons/centos.gd2 | Bin 6423 -> 0 bytes files/default/icons/centos.gif | Bin 1868 -> 0 bytes files/default/icons/centos.jpg | Bin 1420 -> 0 bytes files/default/icons/centos.png | Bin 2206 -> 0 bytes files/default/icons/win40.gd2 | Bin 2389 -> 0 bytes files/default/icons/win40.gif | Bin 1800 -> 0 bytes files/default/icons/win40.jpg | Bin 1777 -> 0 bytes files/default/icons/win40.png | Bin 2288 -> 0 bytes files/default/thruk_local.conf | 36 ---- recipes/thruk.rb | 86 ---------- templates/default/cgi.cfg.erb | 203 ----------------------- templates/default/thruk-apache2.conf.erb | 71 -------- 14 files changed, 1 insertion(+), 399 deletions(-) delete mode 100644 files/default/icons/centos.gd2 delete mode 100644 files/default/icons/centos.gif delete mode 100644 files/default/icons/centos.jpg delete mode 100644 files/default/icons/centos.png delete mode 100644 files/default/icons/win40.gd2 delete mode 100644 files/default/icons/win40.gif delete mode 100644 files/default/icons/win40.jpg delete mode 100644 files/default/icons/win40.png delete mode 100644 files/default/thruk_local.conf delete mode 100644 recipes/thruk.rb delete mode 100644 templates/default/cgi.cfg.erb delete mode 100644 templates/default/thruk-apache2.conf.erb diff --git a/attributes/default.rb b/attributes/default.rb index 9cca5cc..4916de0 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -37,8 +37,6 @@ default["shinken"]["bin_dir"] = "/usr/bin" end -default["shinken"]["thruk"]["docroot"] = "/usr/share/thruk/root/thruk/" - default["shinken"]["log_dir"] = "/var/log/shinken" default["shinken"]["scheduler" ]["port"] = 7768 diff --git a/examples/roles/shinken.rb b/examples/roles/shinken.rb index 5fc9555..73c02a7 100644 --- a/examples/roles/shinken.rb +++ b/examples/roles/shinken.rb @@ -2,7 +2,7 @@ description "Monitoring server" run_list "role[monitoring]", "recipe[shinken::mongodb]", "recipe[mongodb]", "recipe[shinken::pnp]","role[shinken_poller]", "recipe[shinken::reactionner]", -"recipe[shinken::scheduler]", "recipe[shinken::broker]", "recipe[shinken::thruk]", +"recipe[shinken::scheduler]", "recipe[shinken::broker]", "recipe[shinken::broker-webui]", "recipe[shinken::receiver]", "recipe[shinken::arbiter]", "recipe[shinken::plugins]", "recipe[shinken::xmpp]" diff --git a/files/default/icons/centos.gd2 b/files/default/icons/centos.gd2 deleted file mode 100644 index 1da67773af4d94533dd9c0ce1a8aee3c8ba9f817..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6423 zcmd6sX;@QN8pr?6eDR~7)UUPfORaRoWu|JYsI87O+E(poZO09jv9!}p6|MU&E*(+S z(Eze4i0s>dLL%#w00|_71Z4>*5Fp7-Ac+ZK-gA7C5(QUg?B#j6_nr$Uzx#iev&46! z7w{X5r=R`!ErwvokX|}47>B>VKUiPAPA38b1L5UGpYMS(E4gkxLLJPKEifj|hVA}MV(bB9ev`-i`SYRE>CkI8qpNra^fx9zA2SBVeZK@ZrP%@0fGu%;CB@yC0$}e>?Qo#}eCUw;2=vfJcp)Tt`1YKa3hRYET(P zA`yRg_Wu2uR;xv?!vc%^EQ|>=VYoRBhS({b(-8MA-Fv~5vl|vd?ZTwkubo9&Mp{=bA_4?b0ty+w@s*l{3TJr^3%;hM1 z5R5p*$L{umhJ)z77Y!kEIXabcL@YRi@DERuokHRlBD9n@qA)P4Pdj^d8mXJZAvEjp zDtwxbWL%L>z*Xr)ZgGmGsMBYopz$C=%HDCev*+2h+tJ1JBR*Y48P1R1g`iOZZeyJF zVij_CC*Z=^-R}07r9oWZ*X0W-n+io+6x1CF2(R$=V0#h1^Kb7$`qoIUWAw-W98|uT z$`6sL*@P6;8fc9Y+`j)U={MDb@p<}%&OQcBnjA%^|BaBD$8ckLFxT;Q^^2&O#dYiK zRwL)0KQh!C&}7U<2J!aw{j>P4ymttdQ6-RG5+h{RF_Z@9qD7`f;#v`||MAuRt2KyG z(|!~377=Op7c?4jkz4lz($(vUv4Aw)?2f~M_?T9T8~=gyUlP*oD6!?CGP0QaT3b+y z!c$ognmS)PKUjTXHKbY>gDCkNh@_KAv(0E03hBHNS+!g7Kqx`7>T~Yr{`f9U-j9lq zd{jmhLF9b|#b>f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0||_pC`Y0o9nI9Mv~kglmj-UY<$C793GfisM{O8Bf9zU%U+hb*lYE!>!?!8_8T>2mU1^+XptZ{E*C#{QoXX`ZqwYoDa$Fvl!KV1& z$68gh{|w4K0!uuf@$Y?>Zd>*3(XvZ_GMC53FA4L{OI4WUQ_RZ6uG;y4r}S)P|DoKd z>Wn}BiJF;Tu3b{yG40}Pu6Jv?_^O)Ql$C#lJ=k@5OFsYK&AzQqx+=ZY=P>F$W~rR< zKoQd(-UnTylP)}$vvi2 z+3xCL`&QjsZ_58hk2DR<$AI7mM8?A0%sb#WeXME_TZ`L0+`b9&wl7W`^^`dAZqaUE_D7!&)@^w8 zPyXW4OUn|r3*Nrfaa(pqDa-np+pS_{#`9O_~g^|tmg~`_FNi^cCpm|zX<^U4{uNa diff --git a/files/default/icons/centos.png b/files/default/icons/centos.png deleted file mode 100644 index e626bcf3e9fc2dd34cd48f2844f5f1557410b434..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2206 zcmV;P2x0e$P)4;0GYE{%$>x{NlTdnPAae<+*4rq}DqVbp7v2S{IPYU&?>+_!HZxa!9`-GUP+d%fp*QGoQr zJl-vJ%a$!Rn=RmV54N0f7A$t=EkHRNy|y+NhO$_!*|TTA6Y7Qy8-i&a>K|;3apo^{ z=FO*svj046tO38Hqoe1|n>T#`ola*>WG0g-;KOnG9kg^UQnU(TEeAYO_#sjh=Bhj3 zb82B$ZEbB6-V4PzIoM{i5s2X@FxW>J9j}IGgD{W}24QWALD#DP9)&6zZqP9pi z7Kz3xdyaJ5eIDm+V9M6iMTJdQ1v-A zBJ932)WO7R_Bhn??5(#Mn^PE@Z?V6ln>FOCx6yZD-hgwp#96R45AT{MWql)>rZ zl`3nl&R)uphKH!H0pEK+zUpKS_|5$MU(*NYDK^*WBg-`hO{k#$`7bbuNx>QGlk}DH z=9K@WuT3i0lL~%M8JsO$2fjLnbafrE)w-iSXk)cLG8F#_!H++>tjKK@J>;jaOKMAP zFw0ErL-hP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%d<9k@T!BAc8UD^gK%JVUuJk!QaS#NGK-p1Hu!pz4HW|F-9 z(Fk|5rYNMY1V{iO;Kqmc>+-}{)JmvlPg)!5>+3}A64FrWB|`P%+f~-WkXq}qjh)K# zCTfw?eNRRPE% U)pbSh#{aHTQ22Kv|C|2b0Mo(94FCWD diff --git a/files/default/icons/win40.gif b/files/default/icons/win40.gif deleted file mode 100644 index 05803bc4c0e8a85c1a39ca477ce04095ec2abeb3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1800 zcmb`G>pR!_%X-H_PM5AbKZmsQzCY5IEX@rPt8_Ke%%P3>#L5<6cAXKkRwVo6no`d3AVxKFm|`PQVFl zL%`-RD=$}rLLGp?5c~H#r=&n;X12Mx`ocmeHElX4M}xyT7Z*c9A(WT*TS*C2S_%~u zXeufokqAmiXlraV)Yofo+}OK)8|v?ehKBY=M|USC470PlYPDf$Nw3jBD=YfdRo&aS zkW40f`&PHG@Z09*C*0O*_iSzLv|63JJM;bfZHc71py2NULD4Bzy2DXF07KyjM-`(= zoqo^4ih4y@-YxCRxttr9_?N%s72Ldi$HR*k78NTft-PFH!1W85RWD6WO+9(~6m59` zzyTZ&FfjlV4NM|{u^-sS0{hc}X&j)w29$X~o(AL>fb^*7*TJqCF3Cn3-qbO;3C za6Cdn0)v8ly}j8&VF8`)cJ*rct5=h)t=D&VKd!AULy+OprL?H1$gQnSjb?RrcBZ}k zCbR+|HQ1d4x*4$Z5-dFddvm}r3wEY~b`rcE0zb<@YbD4`0GDDw+69mj4dO$M;s3#_VNfeW{6-XWKHHm;r1Uys~vPujbiZMa{uE3eT_4;mJfy5-63U#3uSu$>Gin!&$1f!6)i zN}ogM3&(xTJ+hu%1TS$ zym_;>wzjgevb?;!xVShzKCV({)z#YC+T7gS*w|QK zUte2WD;A6M^YgQ_vokU>l9G}V5)xu!V#342LqkJ@gM-hWJ?ro9&*Sm9T&}05=b1BS zJUl#DES9^wJA=V+b91B7Xf7@;4h{|^5($sTo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rxG`98^;ZG)xs_B^6 z@J;8}X}`<<9W3L2$^L@C%56t3Ala;Fi+NPckj<%;sLhI;9={T1UY zrNc*FCSB@vK5kz;LV5w8nnRGBt@i5YA9$1$W&1EFECj2*$}nlE_6r&~Kl8?_J0D{x z?qYuJY`i*1VhZmSFbbRI9rm^!)8q(8xkCA9yPtQa(B!FmdrnE((5f`j5>m3$3sF*I zUS=VFJsZEUUoNp1@}r-(ns!QB7m2^R6cAWN5AT0*NY`4{-P=;$y3;a_lX5*SPV^?z zIWR2(fk00hrZ6w3%*nPLd+1fYP>H3fb7L)8Z8P}KG`vC_N`&JbuIhf@K0$M0z7NQw8aO2mY-}qo#N!2N7^|r)FGVdGuX*wZy|h(o8} z$fh&5y@Bwe8>>b#uE3dI`Fc?EK^{ApLfaD?YZ4rl}xt4#+}{`!VnkROsxy_{Ox`NiMYB#yC7gb#1t$OAVqZJxDI$kTcm0^X?G4Gap{0}*YGv1O^9G%;e*W;0s8v}?{(ztuDzmWm#TWR446f{ zMZB91T?4YyBkrrm5Lkz^SG4P5KHfNfclm<`b!jew4G~uR%ep`CDTc=tX$|rEw8$nA zqMwlOZ1QwQasyMnGLdj(lGri%)qdbkVy-K9%Cxb7O&p(mJ6*NT4S@hK=QeyFYF*2B|yD8NIuyZ=Arl@81 zOuHD+0%Y{%=oPS2#t=#89=zb3?}$28V45$T57jX4V6XR5rJDH z;})OM9t&T+;vTG-P^4I3XU^4kHa2MFoh)a4GfBzw?HIH5vx}E34}|?BnBYVEEl=+p z7^0Ya!N^R@`PP{n(M17{OlqJQ?EC6yS45PxYXiz4=8$K`D_@L1-l}$XESgcZQNYf~ zm0MrqITKbuS(1nuIBvTGDcj@ybkSfTOEAm%F|8i&c0216^P6C1sF|d3HP;M+sgw%kwfC$_P|vjlVq-Rf)Jn4U`;kC9J*t4bFQWD*ylh diff --git a/files/default/icons/win40.png b/files/default/icons/win40.png deleted file mode 100644 index cd34eafb90ebfef06c1552273dbf680dda5813a9..0000000000000000000000000000000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^Bd$Bz*Us;=%>Q#uC@v%+P9AwY2=brshv} zd*|a~X|cm%pOe9JVtnx6UucCAfJ&vfbH}lAC0|rTLP7vw)haqaA1W0b4)VquNK2D3 zj8do5rKhL+`?KBMWlvyz0%!nMtF^1^+U3iaeSLjC`lxj4)~(6O$&-^4fGQ#a5fSL? z>!RsJ**OcYTrt+wbtoBy!{Ml|uAZKrmO6%e2n`Jl3=9km3}hGv07X&bh=1B zganplv$L}gA3prJQhaFWR(pH<>C>n4^73$3tMQ=4#Kdi>MTm%qh=_i`y=q;5&svbyvwEaD%L�< KMNUMnLSTZ>Ltga& diff --git a/files/default/thruk_local.conf b/files/default/thruk_local.conf deleted file mode 100644 index 23e53e5..0000000 --- a/files/default/thruk_local.conf +++ /dev/null @@ -1,36 +0,0 @@ -# -# This file is managed by Chef. Local modifications will be overwritten. -# -############################################ -# put your own settings into this file -# settings from this file will override -# those from the thruk.conf -############################################ -enable_shinken_features = 1 -logo_path_prefix = /thruk/icons/ -physical_logo_path = /usr/share/thruk/root/thruk/icons -start_page = /thruk/cgi-bin/tac.cgi -first_day_of_week = 0 - - - ahas = 1 # For Hosts Too - broadcast_notification = 0 # Broadcast - force_check = 1 # Forced Check - force_notification = 0 # Forced Notification - send_notification = 0 # Send Notification - sticky_ack = 1 # Sticky Acknowledgement - persistent_comments = 1 # Persistent Comments - persistent_ack = 1 # Persistent Acknowledgement Comments - ptc = 0 # For Child Hosts Too - use_expire = 0 # Use expire for acknowledgements (for cores which support this) - - - - - name = External Shinken - type = livestatus - - peer = 127.0.0.01:50000 - - - diff --git a/recipes/thruk.rb b/recipes/thruk.rb deleted file mode 100644 index 237f3e4..0000000 --- a/recipes/thruk.rb +++ /dev/null @@ -1,86 +0,0 @@ -### Include base recipe -# See [shinken::broker](broker.html) -include_recipe "shinken::broker" - -major = node['platform_version'].to_i -machine = node['kernel']['machine'] -platform_family = node['platform_family'] -thruk_version = "1.68" - -include_recipe "apache2" -include_recipe "apache2::mod_rewrite" -include_recipe "apache2::mod_php5" -include_recipe "apache2::mod_fcgid" -include_recipe "apache2::mod_ssl" - -apache_site "000-default" do - enable false -end - -remote_file "#{Chef::Config[:file_cache_path]}/thruk-#{thruk_version}-1.#{platform_family}#{major}.#{machine}.rpm" do - action :create_if_missing - source "http://www.thruk.org/files/pkg/v#{thruk_version}/#{platform_family}#{major}/#{machine}/thruk-#{thruk_version}-1.#{platform_family}#{major}.#{machine}.rpm" - backup false - not_if "rpm -qa | grep -q '^thruk-#{thruk_version}'" - notifies :install, "rpm_package[thruk]", :immediately -end - -rpm_package "thruk" do - source "#{Chef::Config[:file_cache_path]}/thruk-#{thruk_version}-1.#{platform_family}#{major}.#{machine}.rpm" - options "--nodeps" - action :nothing -end - -file "thruk-cleanup" do - path "#{Chef::Config[:file_cache_path]}/thruk-#{thruk_version}-1.#{platform_family}#{major}.#{machine}.rpm" - action :delete -end - - -remote_directory "/usr/share/thruk/root/thruk/icons" do - mode 0755 -end - -cookbook_file "/etc/thruk/thruk_local.conf" do - mode 0644 -end - -file "#{node['apache']['dir']}/conf.d/thruk.conf" do - action :delete - notifies :reload, "service[apache2]", :delayed -end - -cookbook_file "#{node['apache']['dir']}/ssl/#{node['shinken']['cert_name']}.crt" do - source "certs/#{node['shinken']['cert_name']}.crt" -end - -cookbook_file "#{node['apache']['dir']}/ssl/#{node['shinken']['cert_name']}.key" do - source "certs/#{node['shinken']['cert_name']}.key" -end - -if !node['shinken']['cert_ca_name'].nil? - cookbook_file "#{node['apache']['dir']}/ssl/#{node['shinken']['cert_ca_name']}.crt" do - source "certs/#{node['shinken']['cert_ca_name']}.crt" - end -end - -template "#{node['apache']['dir']}/sites-available/thruk.conf" do - source "thruk-apache2.conf.erb" - mode 00644 - if ::File.symlink?("#{node['apache']['dir']}/sites-enabled/thruk.conf") - notifies :reload, "service[apache2]", :immediately - end -end - -template "/etc/thruk/cgi.cfg" do - mode 0644 - notifies :restart, "service[apache2]", :delayed -end - -apache_site "thruk.conf" - -service "thruk" do - action [:enable, :start] - subscribes :restart, "cookbook_file[/etc/thruk/thruk_local.conf]", :immediately -end - diff --git a/templates/default/cgi.cfg.erb b/templates/default/cgi.cfg.erb deleted file mode 100644 index 1c06179..0000000 --- a/templates/default/cgi.cfg.erb +++ /dev/null @@ -1,203 +0,0 @@ -################################################################# -# -# CGI.CFG - Sample CGI Configuration File -# -################################################################# - -# CONTEXT-SENSITIVE HELP -# This option determines whether or not a context-sensitive -# help icon will be displayed for most of the CGIs. -# Values: 0 = disables context-sensitive help -# 1 = enables context-sensitive help - -show_context_help=0 - -# AUTHENTICATION USAGE -# This option controls whether or not the CGIs will use any -# authentication when displaying host and service information, as -# well as committing commands for processing. -# -# Read the HTML documentation to learn how the authorization works! -# -# NOTE: It is a really *bad* idea to disable authorization, unless -# you plan on removing the command CGI (cmd.cgi)! Failure to do -# so will leave you wide open to kiddies messing with Thruk and -# possibly hitting you with a denial of service attack by filling up -# your drive by continuously writing to your command file! -# -# Setting this value to 0 will cause the CGIs to *not* use -# authentication (bad idea), while any other value will make them -# use the authentication functions (the default). - -use_authentication=1 - - - - -# x509 CERT AUTHENTICATION -# When enabled, this option allows you to use x509 cert (SSL) -# authentication in the CGIs. This is an advanced option and should -# not be enabled unless you know what you're doing. - -use_ssl_authentication=0 - - - - -# DEFAULT USER -# Setting this variable will define a default user name that can -# access pages without authentication. This allows people within a -# secure domain (i.e., behind a firewall) to see the current status -# without authenticating. You may want to use this to avoid basic -# authentication if you are not using a secure server since basic -# authentication transmits passwords in the clear. -# -# Important: Do not define a default username unless you are -# running a secure web server and are sure that everyone who has -# access to the CGIs has been authenticated in some manner! If you -# define this variable, anyone who has not authenticated to the web -# server will inherit all rights you assign to this user! - -default_user_name=thrukadmin - - - -# SYSTEM/PROCESS INFORMATION ACCESS -# This option is a comma-delimited list of all usernames that -# have access to viewing the process information as -# provided by the Extended Information CGI (extinfo.cgi). By -# default, *no one* has access to this unless you choose to -# not use authorization. You may use an asterisk (*) to -# authorize any user who has authenticated to the web server. -# Alternatively you can specify contactgroups too - -authorized_for_system_information=thrukadmin -authorized_contactgroup_for_system_information=<%= node["shinken"]["cgi"]["admin_group"] %> - - -# CONFIGURATION INFORMATION ACCESS -# This option is a comma-delimited list of all usernames that -# can view ALL configuration information (hosts, commands, etc). -# By default, users can only view configuration information -# for the hosts and services they are contacts for. You may use -# an asterisk (*) to authorize any user who has authenticated -# to the web server. -# Alternatively you can specify contactgroups too - -authorized_for_configuration_information=thrukadmin -authorized_contactgroup_for_configuration_information=<%= node["shinken"]["cgi"]["admin_group"] %> - - -# SYSTEM/PROCESS COMMAND ACCESS -# This option is a comma-delimited list of all usernames that -# can issue shutdown and restart commands via the -# command CGI (cmd.cgi). Users in this list can also change -# the program mode to active or standby. By default, *no one* -# has access to this unless you choose to not use authorization. -# You may use an asterisk (*) to authorize any user who has -# authenticated to the web server. -# Alternatively you can specify contactgroups too - -authorized_for_system_commands=thrukadmin -authorized_contactgroup_for_system_commands=<%= node["shinken"]["cgi"]["admin_group"] %> - - -# GLOBAL HOST/SERVICE VIEW ACCESS -# These two options are comma-delimited lists of all usernames that -# can view information for all hosts and services that are being -# monitored. By default, users can only view information -# for hosts or services that they are contacts for (unless you -# you choose to not use authorization). You may use an asterisk (*) -# to authorize any user who has authenticated to the web server. -# Alternatively you can specify contactgroups too - -authorized_for_all_services=thrukadmin -authorized_contactgroup_for_all_services=<%= node["shinken"]["cgi"]["read_groups"] %> - -authorized_for_all_hosts=thrukadmin -authorized_contactgroup_for_all_hosts=<%= node["shinken"]["cgi"]["read_groups"] %> - - -# GLOBAL HOST/SERVICE COMMAND ACCESS -# These two options are comma-delimited lists of all usernames that -# can issue host or service related commands via the command -# CGI (cmd.cgi) for all hosts and services that are being monitored. -# By default, users can only issue commands for hosts or services -# that they are contacts for (unless you you choose to not use -# authorization). You may use an asterisk (*) to authorize any -# user who has authenticated to the web server. -# Alternatively you can specify contactgroups too - -authorized_for_all_service_commands=thrukadmin -authorized_contactgroup_for_all_service_commands=<%= node["shinken"]["cgi"]["admin_group"] %> - -authorized_for_all_host_commands=thrukadmin -authorized_contactgroup_for_all_host_commands=<%= node["shinken"]["cgi"]["admin_group"] %> - -# READ-ONLY USERS -# A comma-delimited list of usernames that have read-only rights in -# the CGIs. This will block any service or host commands normally shown -# on the extinfo CGI pages. It will also block comments from being shown -# to read-only users. -# Alternatively you can specify contactgroups too - -authorized_for_read_only= -authorized_contactgroup_for_read_only=<%= node["shinken"]["cgi"]["read_groups"] %> - -# REFRESH RATE -# This option allows you to specify the refresh rate in seconds -# of various CGIs (status, statusmap, extinfo, and outages). - -refresh_rate=90 - - - -# ESCAPE HTML TAGS -# This option determines whether HTML tags in host and service -# status output is escaped in the web interface. If enabled, -# your plugin output will not be able to contain clickable links. - -escape_html_tags=1 - - -# URL TARGET FRAMES -# These options determine the target frames in which notes and -# action URLs will open. - -action_url_target=_blank -notes_url_target=_blank - - -# LOCK AUTHOR NAMES OPTION -# This option determines whether users can change the author name -# when submitting comments, scheduling downtime. If disabled, the -# author names will be locked into their contact name, as defined in your Monitoring. -# Values: 0 = allow editing author names -# 1 = lock author names (disallow editing) - -lock_author_names=1 - - -# SOUND OPTIONS -# These options allow you to specify an optional audio file -# that should be played in your browser window when there are -# problems on the network. The audio files are used only in -# the status CGI. Only the sound for the most critical problem -# will be played. Order of importance (higher to lower) is as -# follows: unreachable hosts, down hosts, critical services, -# warning services, and unknown services. If there are no -# visible problems, the sound file optionally specified by -# 'normal_sound' variable will be played. -# -# = -# -# Note: All audio files use relative paths from /thruk/cgi-bin/status.cgi -# and must be accessible by web - -host_unreachable_sound=../media/critical.wav -host_down_sound=../media/critical.wav -service_critical_sound=../media/critical.wav -service_warning_sound=../media/warning.wav -service_unknown_sound=../media/unknown.wav -#normal_sound=../media/ok.wav - diff --git a/templates/default/thruk-apache2.conf.erb b/templates/default/thruk-apache2.conf.erb deleted file mode 100644 index bc5161c..0000000 --- a/templates/default/thruk-apache2.conf.erb +++ /dev/null @@ -1,71 +0,0 @@ - - ServerName <%= node['fqdn'] %> - Redirect permanent / https://<%= node['fqdn'] %>/ - - - - ServerAdmin root@localhost - ServerName <%= node['fqdn'] %> - DocumentRoot <%= node['shinken']['thruk']['docroot'] %> - CustomLog <%= node['shinken']['log_dir'] %>/apache_access.log combined - ErrorLog <%= node['shinken']['log_dir'] %>/apache_error.log - - SSLEngine On - SSLCertificateFile <%= node['apache']['dir'] %>/ssl/<%= node['shinken']['cert_name'] %>.crt - SSLCertificateKeyFile <%= node['apache']['dir'] %>/ssl/<%= node['shinken']['cert_name'] %>.key -<% unless node['shinken']['cert_ca_name'].nil? %> - SSLCertificateChainFile <%= node['apache']['dir'] %>/ssl/<%= node['shinken']['cert_ca_name'] %>.crt -<% end %> - - - AddHandler fcgid-script .sh - IPCCommTimeout 120 - - - Options FollowSymLinks - AllowOverride All - order allow,deny - allow from all - - - Options FollowSymLinks - allow from all - - - Options FollowSymLinks - allow from all - - - # redirect to a startup page when there is no pidfile yet - RewriteEngine On - RewriteRule ^/$ /thruk [R=301,L] - RewriteCond %{REQUEST_METHOD} GET - RewriteCond %{REQUEST_URI} !^/thruk/startup.html - RewriteCond %{REQUEST_URI} !^/thruk/side.html - RewriteCond %{REQUEST_URI} !^/thruk/.*\.(css|png|js) - RewriteCond %{REQUEST_URI} ^/thruk - RewriteCond /var/cache/thruk/thruk.pid !-f - RewriteRule ^(.*)$ /thruk/startup.html?$1 [R=302,L,NE,QSA] - - Alias /thruk/documentation.html /usr/share/thruk/root/thruk/documentation.html - Alias /thruk/startup.html /usr/share/thruk/root/thruk/startup.html - AliasMatch ^/thruk/(.*\.cgi|.*\.html) /usr/share/thruk/fcgid_env.sh/thruk/$1 - AliasMatch ^/thruk/plugins/(.*?)/(.*)$ /etc/thruk/plugins/plugins-enabled/$1/root/$2 - Alias /thruk/themes/ /etc/thruk/themes/themes-enabled/ - Alias /thruk /usr/share/thruk/root/thruk - - - Options ExecCGI - AuthName "Monitoring Access" - AuthType Basic - AuthUserFile "/etc/shinken/htpasswd.users" - require valid-user - - - Order Deny,Allow - Allow from all - Satisfy any - - - - From 49df2c747700fdf282175eb16881e41620a95f8c Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Wed, 19 Jun 2013 19:21:46 +0300 Subject: [PATCH 44/56] add python-ldap package --- recipes/base.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/recipes/base.rb b/recipes/base.rb index cb916b3..5d54cda 100644 --- a/recipes/base.rb +++ b/recipes/base.rb @@ -90,7 +90,11 @@ end if node[:platform] == "centos" + cookbook_file "/etc/init.d/shinken" do mode "0755" end + + package "python-ldap" + end From 1060b68df725f81bdb9f94509bc7158a8f3be363 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Wed, 19 Jun 2013 23:47:22 +0300 Subject: [PATCH 45/56] move thruk to separate cookbook --- attributes/default.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 4916de0..f82ed9d 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -76,8 +76,4 @@ "max_workers" => 15 }) - -default["shinken"]["cert_name"] = node["fqdn"] -default["shinken"]["cgi"]["admin_group"] = "admins" -default["shinken"]["cgi"]["read_groups"] = "all" default["shinken"]["auto_poller_tags"] = false From b0ddf19cc5caee7ff4944b11b092b61b67d82b4d Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Wed, 19 Jun 2013 23:48:21 +0300 Subject: [PATCH 46/56] fixes for debian --- attributes/pnp.rb | 6 ++++++ recipes/mongodb.rb | 3 +-- recipes/pnp.rb | 30 ++++++++++++++++++++++++------ 3 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 attributes/pnp.rb diff --git a/attributes/pnp.rb b/attributes/pnp.rb new file mode 100644 index 0000000..a58ac44 --- /dev/null +++ b/attributes/pnp.rb @@ -0,0 +1,6 @@ +case node['platform_family'] +when 'rhel' + default["shinken"]["pnp"]["fpm"] = "php-fpm" +else + default["shinken"]["pnp"]["fpm"] = "php5-fpm" +end diff --git a/recipes/mongodb.rb b/recipes/mongodb.rb index f50f739..655a3fc 100644 --- a/recipes/mongodb.rb +++ b/recipes/mongodb.rb @@ -1,9 +1,8 @@ include_recipe "mongodb::10gen_repo" include_recipe "mongodb" -include_recipe "python::pip" +include_recipe "python" package "gcc" -package "python-devel" python_pip "pymongo" do action :install diff --git a/recipes/pnp.rb b/recipes/pnp.rb index 615bd5e..245f165 100644 --- a/recipes/pnp.rb +++ b/recipes/pnp.rb @@ -1,11 +1,27 @@ -if node[:platform] == "centos" +case node[:platform] +when "centos" include_recipe "yum::repoforge" +when "debian" + include_recipe "apt" + apt_repository "backports" do + uri "http://backports.debian.org/debian-backports" + distribution "#{node['lsb']['codename']}-backports" + components ["main"] + action :add + end + apt_repository "dotdeb" do + uri "http://packages.dotdeb.org/" + distribution node['lsb']['codename'] + components ["all"] + key "http://www.dotdeb.org/dotdeb.gpg" + action :add + end end package "pnp4nagios" -package "php-fpm" +package node["shinken"]["pnp"]["fpm"] -service "php-fpm" do +service node["shinken"]["pnp"]["fpm"] do action [:enable, :start] end @@ -13,7 +29,9 @@ action [:enable, :start] end -template "#{node['apache']['dir']}/conf.d/pnp4nagios.conf" do - mode 0644 - notifies :reload, "service[apache2]", :delayed +if node.has_key?("apache") + template "#{node['apache']['dir']}/conf.d/pnp4nagios.conf" do + mode 0644 + notifies :reload, "service[apache2]", :delayed + end end From b06fa48da09dfd027bf1f45d53318ee2980c6bd2 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Wed, 19 Jun 2013 23:48:47 +0300 Subject: [PATCH 47/56] add packs directory --- recipes/base.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/base.rb b/recipes/base.rb index 5d54cda..1bba863 100644 --- a/recipes/base.rb +++ b/recipes/base.rb @@ -80,6 +80,8 @@ end end +directory "/etc/shinken/packs" + directory "/etc/shinken/objects" do action :delete recursive true From 93946b2858e00791678efde87f9da7aacf7bbe1e Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Wed, 19 Jun 2013 23:49:08 +0300 Subject: [PATCH 48/56] check for nagios attribute --- recipes/arbiter-hosts.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/recipes/arbiter-hosts.rb b/recipes/arbiter-hosts.rb index f33270e..8be67a1 100644 --- a/recipes/arbiter-hosts.rb +++ b/recipes/arbiter-hosts.rb @@ -87,11 +87,15 @@ poller_tag n["domain"] end - (n["nagios"]["host_definition"]||{}).each_pair do |k, v| - self.send k, v - end - - if (n["nagios"]["host_definition"]|| {})["use"].nil? + if n.has_key?("nagios") + (n["nagios"]["host_definition"]||{}).each_pair do |k, v| + self.send k, v + end + + if (n["nagios"]["host_definition"]|| {})["use"].nil? + use ["#{n['platform']}-host"] + end + else use ["#{n['platform']}-host"] end end From 98da0cce487fa658c229a112102f6abfdbf68748 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Wed, 19 Jun 2013 23:49:33 +0300 Subject: [PATCH 49/56] move thruk to separate cookbook --- metadata.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/metadata.rb b/metadata.rb index ec0b048..0f7712b 100644 --- a/metadata.rb +++ b/metadata.rb @@ -7,7 +7,6 @@ depends "apt" depends "nginx" -depends "mongodb", " >= 0.12" +depends "mongodb", ">= 0.12" depends "python" -depends "apache2" depends "yum" From 543f4820de78681d7b50e6d9f04973b09f37ad4f Mon Sep 17 00:00:00 2001 From: Cyberflow Date: Tue, 8 Oct 2013 11:41:53 +0300 Subject: [PATCH 50/56] chenge service hostgroup difinition to array --- resources/service.rb | 2 +- templates/default/definitions/services/service.cfg.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/service.rb b/resources/service.rb index a9e8906..9c5f643 100644 --- a/resources/service.rb +++ b/resources/service.rb @@ -26,7 +26,7 @@ def self.validation_callback(items, combination = true) attribute :service_key, :kind_of => String, :name_attribute => true attribute :host_name, :kind_of => String -attribute :hostgroup_name, :kind_of => String +attribute :hostgroup_name, :kind_of => Array attribute :service_description, :kind_of => String attribute :display_name, :kind_of => String attribute :servicegroups, :kind_of => Array diff --git a/templates/default/definitions/services/service.cfg.erb b/templates/default/definitions/services/service.cfg.erb index a555dc5..b032269 100644 --- a/templates/default/definitions/services/service.cfg.erb +++ b/templates/default/definitions/services/service.cfg.erb @@ -12,7 +12,7 @@ define service { host_name <%= @host_name %> <% end %> <% if not @hostgroup_name.nil? %> - hostgroup_name <%= @hostgroup_name %> + hostgroup_name <%= @hostgroup_name.join(",") %> <% end %> <% if not @service_description.nil? %> service_description <%= @service_description %> From 79d2b095d1bdca1fa7cc9d38f4c152f313130e34 Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Thu, 10 Oct 2013 15:19:51 +0300 Subject: [PATCH 51/56] fix logic for removing users --- recipes/arbiter-contacts.rb | 2 +- recipes/broker.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/arbiter-contacts.rb b/recipes/arbiter-contacts.rb index 59848c5..a7e40a2 100644 --- a/recipes/arbiter-contacts.rb +++ b/recipes/arbiter-contacts.rb @@ -92,7 +92,7 @@ end end -search(:users, "nagios:* NOT action:remove") do |c| +search(:users, "nagios:* AND NOT action:remove") do |c| shinken_contact c["id"] do register true diff --git a/recipes/broker.rb b/recipes/broker.rb index 995ae8b..27e07ce 100644 --- a/recipes/broker.rb +++ b/recipes/broker.rb @@ -60,7 +60,7 @@ # add the sysadmins to the htpasswd -users = search(:users, "nagios:* AND password:* NOT action:remove") +users = search(:users, "nagios:* AND password:* AND NOT action:remove") contacts = search(:shinken_contacts, "password:*") template "/etc/shinken/htpasswd.users" do From b542df09d3a716f4b45e0e557ca01ff476e8e6dc Mon Sep 17 00:00:00 2001 From: Martha Greenberg Date: Thu, 10 Oct 2013 15:20:09 +0300 Subject: [PATCH 52/56] add automatic role for virtualization and allow override of poller_tag. --- recipes/arbiter-hosts.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/recipes/arbiter-hosts.rb b/recipes/arbiter-hosts.rb index 8be67a1..fe6a947 100644 --- a/recipes/arbiter-hosts.rb +++ b/recipes/arbiter-hosts.rb @@ -80,11 +80,19 @@ host_name n["hostname"] address n["ipaddress"] host_alias n["fqdn"] - hostgroups ["+#{n['os']}",n['roles'].join(",")] + if n["virtualization"].has_key?("role") + hostgroups ["+#{n['os']}","#{n['virtualization']['system']}-#{n['virtualization']['role']}",n['roles'].join(",")] + else + hostgroups ["+#{n['os']}",n['roles'].join(",")] + end # setup automatic poller tags if node["shinken"]["auto_poller_tags"] - poller_tag n["domain"] + if n.has_key?("shinken") and n["shinken"].has_key?("poller_tag") + poller_tag n["shinken"]["poller_tag"] + else + poller_tag n["domain"] + end end if n.has_key?("nagios") From 0ae1d57d02e8e8101524cd0c00ed04db72ef4338 Mon Sep 17 00:00:00 2001 From: Cyberflow Date: Mon, 28 Oct 2013 12:01:12 +0200 Subject: [PATCH 53/56] add business_impact to service definitions --- providers/service.rb | 1 + resources/service.rb | 1 + templates/default/definitions/services/service.cfg.erb | 3 +++ 3 files changed, 5 insertions(+) diff --git a/providers/service.rb b/providers/service.rb index b6ad516..ed599b0 100644 --- a/providers/service.rb +++ b/providers/service.rb @@ -58,6 +58,7 @@ :icon_image_alt => new_resource.icon_image_alt, :escalations => new_resource.escalations, :service_dependencies => new_resource.service_dependencies, + :business_impact => new_resource.business_impact, :register => new_resource.register, :use => new_resource.use diff --git a/resources/service.rb b/resources/service.rb index 9c5f643..1d7c8b9 100644 --- a/resources/service.rb +++ b/resources/service.rb @@ -68,6 +68,7 @@ def self.validation_callback(items, combination = true) attribute :icon_image_alt, :kind_of => String attribute :escalations, :kind_of => String attribute :service_dependencies, :kind_of => String +attribute :business_impact :callbacks => validation_callback([:0, :1, :2, :3, :4, :5]) attribute :register, :kind_of => [TrueClass, FalseClass], :default => true attribute :use, :kind_of => Array, :default => [] diff --git a/templates/default/definitions/services/service.cfg.erb b/templates/default/definitions/services/service.cfg.erb index b032269..1c34bdd 100644 --- a/templates/default/definitions/services/service.cfg.erb +++ b/templates/default/definitions/services/service.cfg.erb @@ -127,6 +127,9 @@ define service { <% end %> <% if not @service_dependencies.nil? %> service_dependencies <%= @service_dependencies %> +<% end %> +<% if not @business_impact.nil? %> + business_impact <%= @business_impact %> <% end %> register <%= @register ? "1": "0" %> <% if @use %> From 25787fdba4add788ea1763fee18eb0dbfb529c62 Mon Sep 17 00:00:00 2001 From: Cyberflow Date: Mon, 28 Oct 2013 12:17:05 +0200 Subject: [PATCH 54/56] fix syntax error --- resources/service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/service.rb b/resources/service.rb index 1d7c8b9..03b3e3e 100644 --- a/resources/service.rb +++ b/resources/service.rb @@ -68,7 +68,7 @@ def self.validation_callback(items, combination = true) attribute :icon_image_alt, :kind_of => String attribute :escalations, :kind_of => String attribute :service_dependencies, :kind_of => String -attribute :business_impact :callbacks => validation_callback([:0, :1, :2, :3, :4, :5]) +attribute :business_impact, :callbacks => validation_callback([:0, :1, :2, :3, :4, :5]) attribute :register, :kind_of => [TrueClass, FalseClass], :default => true attribute :use, :kind_of => Array, :default => [] From 7e82e0ccad966f9015f6adad486424db41511d3a Mon Sep 17 00:00:00 2001 From: Cyberflow Date: Mon, 28 Oct 2013 12:34:34 +0200 Subject: [PATCH 55/56] fix syntax error --- resources/service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/service.rb b/resources/service.rb index 03b3e3e..63a78e1 100644 --- a/resources/service.rb +++ b/resources/service.rb @@ -68,7 +68,7 @@ def self.validation_callback(items, combination = true) attribute :icon_image_alt, :kind_of => String attribute :escalations, :kind_of => String attribute :service_dependencies, :kind_of => String -attribute :business_impact, :callbacks => validation_callback([:0, :1, :2, :3, :4, :5]) +attribute :business_impact, :callbacks => validation_callback([0, 1, 2, 3, 4, 5]) attribute :register, :kind_of => [TrueClass, FalseClass], :default => true attribute :use, :kind_of => Array, :default => [] From d15ee9dec129bd46f192c37796a8bf11e753e7b5 Mon Sep 17 00:00:00 2001 From: Cyberflow Date: Mon, 28 Oct 2013 13:08:08 +0200 Subject: [PATCH 56/56] fix type to integer --- resources/service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/service.rb b/resources/service.rb index 63a78e1..0d45f10 100644 --- a/resources/service.rb +++ b/resources/service.rb @@ -68,7 +68,7 @@ def self.validation_callback(items, combination = true) attribute :icon_image_alt, :kind_of => String attribute :escalations, :kind_of => String attribute :service_dependencies, :kind_of => String -attribute :business_impact, :callbacks => validation_callback([0, 1, 2, 3, 4, 5]) +attribute :business_impact, :kind_of => Integer attribute :register, :kind_of => [TrueClass, FalseClass], :default => true attribute :use, :kind_of => Array, :default => []