Andrew Bogott has submitted this change and it was merged.

Change subject: Initial shinken setup for labs
......................................................................


Initial shinken setup for labs

- Sets up a simple server with basic webui and
  a guest account
- Sets up contactgroups for toollabs & betacluster
- No autogeneration of hosts yet, modules/roles
  will have to declare them using cfg files
- Resource collection on labs will have security
  issues, so different method of doing this will
  have to be found

Change-Id: I626438cf194db2e2816aa8cf4a63cdcf64f0154b
---
A manifests/role/labsshinken.pp
A modules/shinken/files/contactgroups.cfg
A modules/shinken/files/contacts.cfg
A modules/shinken/files/shinken.cfg
A modules/shinken/manifests/server.pp
A modules/shinken/templates/webui.cfg.erb
6 files changed, 283 insertions(+), 0 deletions(-)

Approvals:
  Andrew Bogott: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/manifests/role/labsshinken.pp b/manifests/role/labsshinken.pp
new file mode 100644
index 0000000..250d41a
--- /dev/null
+++ b/manifests/role/labsshinken.pp
@@ -0,0 +1,8 @@
+# = Class: role::labs::shinken
+# Sets up a shinken server for labs
+
+class role::labs::shinken {
+    class { 'shinken::server':
+        auth_secret => 'This is insecure, should switch to using private repo',
+    }
+}
diff --git a/modules/shinken/files/contactgroups.cfg 
b/modules/shinken/files/contactgroups.cfg
new file mode 100644
index 0000000..a20e4cc
--- /dev/null
+++ b/modules/shinken/files/contactgroups.cfg
@@ -0,0 +1,14 @@
+# This file is managed by puppet
+# Add contact 'guest' to all groups so webUI will show the guest accout
+# status for services
+define contactgroup {
+    contactgroup_name       toollabs
+    alias                   ToolLabs Administrators
+    members                 guest,yuvipanda
+}
+
+define contactgroup {
+    contactgroup_name       betacluster
+    alias                   Beta Cluster Administrators
+    members                 guest,yuvipanda,greg_g
+}
diff --git a/modules/shinken/files/contacts.cfg 
b/modules/shinken/files/contacts.cfg
new file mode 100644
index 0000000..cfcd6c5
--- /dev/null
+++ b/modules/shinken/files/contacts.cfg
@@ -0,0 +1,47 @@
+# This file is managed by puppet
+# Do not put any private info here (such as phone numbers)
+# Labs monitoring will not support phone paging for the foreseeable future
+
+# Guest contact, with no notifications and not much permissions
+define contact {
+    contact_name                        guest
+    alias                               Guest Account
+    email                               guest@guest
+    host_notifications_enabled          0
+    service_notifications_enabled       0
+    host_notification_period            none
+    service_notification_period         none
+    service_notification_commands       notify-service-by-email
+    host_notification_commands          notify-host-by-email
+    host_notification_options           d,u,r
+    service_notification_options        w,u,r,c
+    password                            guest
+}
+
+define contact {
+    contact_name                        yuvipanda
+    alias                               Yuvi Panda
+    email                               [email protected]
+    host_notifications_enabled          1
+    service_notifications_enabled       1
+    host_notification_period            24x7
+    service_notification_period         24x7
+    service_notification_commands       notify-service-by-email
+    host_notification_commands          notify-host-by-email
+    host_notification_options           d,u,r
+    service_notification_options        w,u,r,c
+}
+
+define contact {
+    contact_name                        greg_g
+    alias                               Greg G
+    email                               [email protected]
+    host_notifications_enabled          1
+    service_notifications_enabled       1
+    host_notification_period            24x7
+    service_notification_period         24x7
+    service_notification_commands       notify-service-by-email
+    host_notification_commands          notify-host-by-email
+    host_notification_options           d,u,r
+    service_notification_options        w,u,r,c
+}
diff --git a/modules/shinken/files/shinken.cfg 
b/modules/shinken/files/shinken.cfg
new file mode 100644
index 0000000..57fe408
--- /dev/null
+++ b/modules/shinken/files/shinken.cfg
@@ -0,0 +1,116 @@
+# This file is managed by puppet
+#-- Arbiter Daemon --
+
+# Set to 0 if you want to make this daemon (arbiter) NOT run
+daemon_enabled=1
+# Lock file (with pid) for Arbiterd
+lock_file=/var/run/shinken/arbiterd.pid
+# If you want to set the working directory of the
+# arbiter, just uncomment this
+workdir=/var/lib/shinken
+# User that will be used by the arbiter. 
+# If commented, run as current user (root?)
+shinken_user=shinken
+shinken_group=shinken
+
+
+#-- Security using SSL --
+
+# Only enabled when used with Pyro3
+use_ssl=0
+# WARNING : Put full paths for certs
+#certs_dir=../etc/certs
+#ca_cert=../etc/certs/ca.pem
+#server_cert=../etc/certs/server.pem
+hard_ssl_name_check=0
+
+
+#-- Log --
+
+# The arbiter can have it's own local log
+local_log=/var/log/shinken/arbiterd.log
+# If not need, don't dump initial states into logs
+log_initial_states=0
+
+
+#-- Monitoring configuration --
+cfg_dir=shinken-specific/
+
+# Configuration files with common objects like commands, timeperiods,
+# or templates that are used by the host/service/contacts
+cfg_file=commands.cfg
+cfg_file=timeperiods.cfg
+#cfg_file=escalations.cfg
+#cfg_file=dependencies.cfg
+cfg_file=contacts.cfg
+
+# Now templates of hosts, services and contacts
+cfg_file=templates.cfg
+#cfg_file=time_templates.cfg
+
+# Now groups
+#cfg_file=servicegroups.cfg
+#cfg_file=hostgroups.cfg
+cfg_file=contactgroups.cfg
+
+# And now real hosts, services, packs and discovered hosts
+# They are directory, and we will load all .cfg file into them, and 
+# their sub-directory
+cfg_dir=hosts
+#cfg_dir=services
+cfg_dir=packs
+#cfg_dir=objects/discovery
+
+# You will find global MACROS into this file
+resource_file=resource.cfg
+
+
+#-- Monitoring advanced configuration --
+
+# Number of minutes between 2 retention save, here 1hour
+retention_update_interval=60
+
+# Number of interval (5min by default) to spread the first checks
+# for hosts and services
+max_service_check_spread=5
+max_host_check_spread=5
+
+# after 10s, checks are killed and exit with CRITICAL state (RIP)
+service_check_timeout=10
+
+# flap_history is the lengh of history states we keep to look for
+# flapping.
+# 20 by default, can be useful to increase it. Each flap_history
+# increases cost:
+#    flap_history cost = 4Bytes * flap_history * (nb hosts + nb services)
+# Example: 4 * 20 * (1000+10000) ~ 900Ko for a quite big conf. So, go for it!
+flap_history=20
+
+# Max plugin output for the plugins launched by the pollers, in bytes
+max_plugins_output_length=65536
+
+# Enable or not the state change on impact detection (like
+# an host going unreach if a parent is DOWN for example). It's for
+# services and hosts.
+# Remark: if this option is absent, the default is 0 (for Nagios
+# old behavior compatibility)
+enable_problem_impacts_states_change=1
+
+# if 1, disable all notice and warning messages at
+# configuration checking
+disable_old_nagios_parameters_whining=0
+
+# If you need to set a specific timezone to your deamons, uncomment it
+#use_timezone=FR/Paris
+
+# Disabling env macros is good for performances. If you really need it, enable 
it.
+enable_environment_macros=0
+
+# By default don't launch event handlers during downtime. Put 0 to
+# get back the default nagios behavior
+no_event_handlers_during_downtimes=1
+
+# [Optionnal], a pack distribution file is a local file near the arbiter
+# that will keep host pack id association, and so push same host on the same
+# scheduler if possible between restarts.
+pack_distribution_file=pack_distribution.dat
diff --git a/modules/shinken/manifests/server.pp 
b/modules/shinken/manifests/server.pp
new file mode 100644
index 0000000..39d25df
--- /dev/null
+++ b/modules/shinken/manifests/server.pp
@@ -0,0 +1,84 @@
+# = Class: shinken::server
+# Sets up a shinken monitoring server
+
+class shinken::server(
+    $auth_secret
+) {
+    package { 'shinken':
+        ensure  => present,
+    }
+
+    service { 'shinken':
+        ensure => running,
+    }
+
+    file { '/etc/shinken/modules':
+        ensure  => directory,
+        owner   => 'shinken',
+        group   => 'shinken',
+        require => Package['shinken'],
+    }
+
+    file { '/etc/shinken/modules/webui.cfg':
+        ensure  => present,
+        content => template('shinken/webui.cfg.erb'),
+        owner   => 'shinken',
+        group   => 'shinken',
+        require => File['/etc/shinken/modules'],
+        notify  => Service['shinken'],
+    }
+
+    file { '/etc/shinken/shinken.cfg':
+        ensure  => present,
+        source  => 'puppet:///modules/shinken/shinken.cfg',
+        owner   => 'shinken',
+        group   => 'shinken',
+        require => Package['shinken'],
+        notify  => Service['shinken'],
+    }
+
+    file { '/etc/shinken/contacts.cfg':
+        ensure  => present,
+        source  => 'puppet:///modules/shinken/contacts.cfg',
+        owner   => 'shinken',
+        group   => 'shinken',
+        require => Package['shinken'],
+        notify  => Service['shinken'],
+    }
+
+    file { '/etc/shinken/contactgroups.cfg':
+        ensure  => present,
+        source  => 'puppet:///modules/shinken/contactgroups.cfg',
+        owner   => 'shinken',
+        group   => 'shinken',
+        require => Package['shinken'],
+        notify  => Service['shinken'],
+    }
+
+    # Default localhost config, we do not need this
+    file { '/etc/shinken/hosts/localhost.cfg':
+        ensure  => absent,
+        require => Package['shinken'],
+        notify  => Service['shinken'],
+    }
+}
+
+# = Class: shinken::hosts
+# Setup a shinken hosts definition file
+# FIXME: Autogenerate hosts definitions later on
+class shinken::hosts(
+    $name,
+    $ensure  = present,
+    $source  = undef,
+    $content = undef
+) {
+    file { "/etc/shinken/hosts/$name.cfg":
+        ensure  => ensure,
+        source  => source,
+        content => content,
+        owner   => 'shinken',
+        group   => 'shinken',
+        notify  => Service['shinken'],
+        require => Package['shinken']
+    }
+}
diff --git a/modules/shinken/templates/webui.cfg.erb 
b/modules/shinken/templates/webui.cfg.erb
new file mode 100644
index 0000000..517c49f
--- /dev/null
+++ b/modules/shinken/templates/webui.cfg.erb
@@ -0,0 +1,14 @@
+define module{
+      module_name      WebUI
+      module_type      webui
+
+      host             0.0.0.0
+      port             7767
+
+      # CHANGE THIS VALUE or someone may forge your cookies
+      auth_secret      <%= @auth_secret %>
+
+      allow_html_output  0
+
+      modules          Cfg_password
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/160626
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I626438cf194db2e2816aa8cf4a63cdcf64f0154b
Gerrit-PatchSet: 23
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Yuvipanda <[email protected]>
Gerrit-Reviewer: Andrew Bogott <[email protected]>
Gerrit-Reviewer: coren <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to