Install Icinga2 and Icingaweb2 » History » Version 4
Jon Goldberg, 06/08/2017 08:00 PM
| 1 | 1 | Jon Goldberg | {{last_updated_at}} by {{last_updated_by}} |
|---|---|---|---|
| 2 | # Install Icinga2 and Icingaweb2 |
||
| 3 | |||
| 4 | {{>toc}} |
||
| 5 | |||
| 6 | ### Installation (Master Node) |
||
| 7 | |||
| 8 | 4 | Jon Goldberg | Steps are adapted from [this guide](http://linoxide.com/ubuntu-how-to/install-icinga2-ubuntu-16-04/). |
| 9 | 1 | Jon Goldberg | |
| 10 | 4 | Jon Goldberg | #### Install Icinga2 |
| 11 | ``` |
||
| 12 | # These lines for Ubuntu 16.04 only: |
||
| 13 | apt install software-properties-common |
||
| 14 | add-apt-repository -y ppa:formorer/icinga |
||
| 15 | apt update |
||
| 16 | apt-get install icinga2 |
||
| 17 | |||
| 18 | |||
| 19 | # These 3 lines for Debian 8 only: |
||
| 20 | echo 'deb http://ftp.debian.org/debian jessie-backports main' > /etc/apt/sources.list.d/jessie-backports.list |
||
| 21 | apt-get update |
||
| 22 | apt-get -t jessie-backports install icinga2 |
||
| 23 | |||
| 24 | systemctl enable icinga2.service |
||
| 25 | systemctl start icinga2.service |
||
| 26 | ``` |
||
| 27 | |||
| 28 | #### Install Icingaweb2 |
||
| 29 | ``` |
||
| 30 | apt remove samba-common samba-libs |
||
| 31 | # Work around this bug: https://bugs.launchpad.net/ubuntu/+source/icingaweb2/+bug/1574250 |
||
| 32 | # FIRST, uncomment the second line in /etc/php/7.0/mods-available/zend-framework.ini |
||
| 33 | phpenmod zend-framework |
||
| 34 | systemctl restart apache2.service |
||
| 35 | ``` |
||
| 36 | 1 | Jon Goldberg | |
| 37 | ### Configuration |
||
| 38 | |||
| 39 | - Run `icinga2 node wizard. `Select "N" to create a master node. |
||
| 40 | - Enable the command module to allow issuing commands from Icingaweb2: |
||
| 41 | `icinga2 feature enable command`; service icinga2 restart |
||
| 42 | - Add an API user for remote checks. For instance, a user that can |
||
| 43 | receive backupninja checks: |
||
| 44 | |||
| 45 | <div class="code panel pdl" style="border-width: 1px;"> |
||
| 46 | |||
| 47 | <div class="codeContent panelContent pdl"> |
||
| 48 | |||
| 49 | ``` |
||
| 50 | object ApiUser "backupninja" { |
||
| 51 | password = "<redacted>" |
||
| 52 | permissions = [ |
||
| 53 | { |
||
| 54 | permission = "actions/process-check-result" |
||
| 55 | filter = {{ match("backupninja", service.display_name) }} |
||
| 56 | } |
||
| 57 | ] |
||
| 58 | } |
||
| 59 | ``` |
||
| 60 | |||
| 61 | ### Install additional checks |
||
| 62 | |||
| 63 | #### Install Plugins |
||
| 64 | |||
| 65 | Place the following two scripts in your plugins directory |
||
| 66 | (`/usr/lib/nagios/plugins`) and ensure they're executable: |
||
| 67 | |||
| 68 | - **check\_drupal** - installs with the Drupal "nagios" plugin, also |
||
| 69 | available |
||
| 70 | 2 | Jon Goldberg | [here](http://cgit.drupalcode.org/nagios/plain/nagios-plugin/check_drupal?id=7da732e2d4943ec5368243f4cd2e33eb02769f23). |
| 71 | 1 | Jon Goldberg | - **check\_civicrm** - There are two scripts - one for Civi 4.6 and |
| 72 | below, another for 4.7 and up. 4.7 version is available |
||
| 73 | [here](https://github.com/PalanteJon/check_civicrm){.external-link}, |
||
| 74 | 4.6 version is |
||
| 75 | 2 | Jon Goldberg | <span>[here](https://raw.githubusercontent.com/aghstrategies/com.aghstrategies.civimonitor/master/check_civicrm.php).</span> |
| 76 | 1 | Jon Goldberg | - <span>**check\_domain** - This does a WHOIS lookup to ensure domain |
| 77 | names aren't about to expire. Install from |
||
| 78 | 2 | Jon Goldberg | [here](https://raw.githubusercontent.com/glensc/monitoring-plugin-check_domain/master/check_domain.sh).</span> |
| 79 | 1 | Jon Goldberg | - <span><span>**check\_rbl** - Check spam blacklists. File is |
| 80 | 2 | Jon Goldberg | [here](https://raw.githubusercontent.com/matteocorti/check_rbl/master/check_rbl), also install dependencies: |
| 81 | `apt install libreadonly-xs-perl libnagios-plugin-perl libdata-validate-ip-perl libdata-validate-domain-perl libnet-dns-perl` |
||
| 82 | 1 | Jon Goldberg | |
| 83 | 2 | Jon Goldberg | #### Define CheckCommand and Service objects for the new plugins |
| 84 | 1 | Jon Goldberg | |
| 85 | 2 | Jon Goldberg | Copy the CheckCommand and Service files from |
| 86 | 1 | Jon Goldberg | `icinga.jmaconsulting.biz:/etc/icinga2/zones.d/global-templates/CheckCommands` |
| 87 | 2 | Jon Goldberg | and `icinga.jmaconsulting.biz:/etc/icinga2/conf.d/services`. See [[Add New Checks to Icinga2]] for details. |
| 88 | 1 | Jon Goldberg | |
| 89 | |||
| 90 | 2 | Jon Goldberg | ### Set up vim syntax highlighting on the Icinga2 server |
| 91 | ``` |
||
| 92 | mkdir -p ~/.vim/{syntax,ftdetect} |
||
| 93 | cd ~/.vim/syntax |
||
| 94 | wget https://raw.githubusercontent.com/Icinga/icinga2/master/tools/syntax/vim/syntax/icinga2.vim |
||
| 95 | cd ~/.vim/ftdetect |
||
| 96 | wget https://raw.githubusercontent.com/Icinga/icinga2/master/tools/syntax/vim/ftdetect/icinga2.vim |
||
| 97 | ``` |