Class: Dolphin::Shinken

Inherits:
Base
  • Object
show all
Defined in:
lib/dolphin/ubuntu/shinken.rb

Overview

shinken related tasks

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Dolphin::Base

Instance Method Details

#clientObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/dolphin/ubuntu/shinken.rb', line 5

def client
  # upload files
  upload("#{@config_root}/shinken/client/*", "/tmp")

  menu = [
    %{
     # sudo apt-get -y install snmpd
     sudo mv /tmp/snmpd.conf /etc/snmp/
     sudo chown root:root /etc/snmp/snmpd.conf
     sudo service snmpd restart

    },
  ]

  execute menu
end

#configObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/dolphin/ubuntu/shinken.rb', line 52

def config
  # template: etc/packs/os/linux
  # upload files
  upload("#{@config_root}/shinken/server/*", "/tmp")

  menu = [
    %{
      sudo mv /tmp/nagios.cfg /usr/local/shinken/etc/
      sudo mv /tmp/shinken-specific.cfg /usr/local/shinken/etc/
      sudo mv /tmp/resource.cfg /usr/local/shinken/etc/
      sudo mv /tmp/contacts.cfg /usr/local/shinken/etc/
      sudo mv /tmp/commands.cfg /usr/local/shinken/etc/
      sudo mv /tmp/templates.cfg /usr/local/shinken/etc/
      sudo mv /tmp/staging.cfg /usr/local/shinken/etc/hosts/
      sudo mv /tmp/production.cfg /usr/local/shinken/etc/hosts/
      sudo mv /tmp/services.cfg /usr/local/shinken/etc/hosts/
      sudo service shinken restart
    },

  ]

  execute menu
end

#emailObject



77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/dolphin/ubuntu/shinken.rb', line 77

def email
  menu = [
    %{
      sudo apt-get -y install libio-socket-ssl-perl libdigest-hmac-perl libterm-readkey-perl libmime-lite-perl libfile-libmagic-perl libio-socket-inet6-perl
      sudo chown #{@user}:#{@user_group} #{@app_dir}
      cd #{@app_dir}
      if [ ! -d 'smtp-cli' ]; then git clone https://github.com/mludvig/smtp-cli.git ; fi
    },
  ]

  execute menu
end

#installObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/dolphin/ubuntu/shinken.rb', line 23

def install
  menu = [
    %{
      wget http://www.shinken-monitoring.org/pub/shinken-1.4.tar.gz
      tar -xvzf shinken-1.4.tar.gz
      cd ~/shinken-1.4
      sudo ./install -i

      sudo ./install -h
      sudo ./install -p nagios-plugins
      sudo ./install -p check_mem
      sudo ./install -p manubulon
      sudo ./install -p check_snmp_bandwidth
      sudo ./install -p check_snmp
      sudo ./install -p check_netint
      sudo ./install -p check_mongodb

      sudo apt-get -y install nagios-plugins
      # sudo ./install -a pnp4nagios
      # sudo ./install -a mongodb # already installed

      sudo update-rc.d mongodb enable
    },
  ]

  execute menu
end