Install Icinga2 and Icingaweb2 » History » Version 2
Jon Goldberg, 06/08/2017 07:33 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 | I followed this guide: |
||
| 9 | 2 | Jon Goldberg | <http://linoxide.com/ubuntu-how-to/install-icinga2-ubuntu-16-04/>. |
| 10 | 1 | Jon Goldberg | Here's where I deviated from the guide: |
| 11 | |||
| 12 | - I installed nagios-plugins - but in Ubuntu 16.04 this has Samba as a |
||
| 13 | dependency. So then I also ran |
||
| 14 | `apt remove samba-common samba-libs`. |
||
| 15 | - I didn't install PHP 5.6 - Icingaweb2 is now PHP7-compatible. |
||
| 16 | - I uncommented the second line in |
||
| 17 | /etc/php/7.0/mods-available/zend-framework.ini, ran |
||
| 18 | `phpenmod zend-framework` and restarted Apache (to work around this |
||
| 19 | bug: |
||
| 20 | <https://bugs.launchpad.net/ubuntu/+source/icingaweb2/+bug/1574250> |
||
| 21 | |||
| 22 | ### Configuration |
||
| 23 | |||
| 24 | - Run `icinga2 node wizard. `Select "N" to create a master node. |
||
| 25 | - Enable the command module to allow issuing commands from Icingaweb2: |
||
| 26 | `icinga2 feature enable command`; service icinga2 restart |
||
| 27 | - Add an API user for remote checks. For instance, a user that can |
||
| 28 | receive backupninja checks: |
||
| 29 | |||
| 30 | <div class="code panel pdl" style="border-width: 1px;"> |
||
| 31 | |||
| 32 | <div class="codeContent panelContent pdl"> |
||
| 33 | |||
| 34 | ``` |
||
| 35 | object ApiUser "backupninja" { |
||
| 36 | password = "<redacted>" |
||
| 37 | permissions = [ |
||
| 38 | { |
||
| 39 | permission = "actions/process-check-result" |
||
| 40 | filter = {{ match("backupninja", service.display_name) }} |
||
| 41 | } |
||
| 42 | ] |
||
| 43 | } |
||
| 44 | |||
| 45 | ``` |
||
| 46 | |||
| 47 | |||
| 48 | ### Install additional checks |
||
| 49 | |||
| 50 | #### Install Plugins |
||
| 51 | |||
| 52 | Place the following two scripts in your plugins directory |
||
| 53 | (`/usr/lib/nagios/plugins`) and ensure they're executable: |
||
| 54 | |||
| 55 | - **check\_drupal** - installs with the Drupal "nagios" plugin, also |
||
| 56 | available |
||
| 57 | 2 | Jon Goldberg | [here](http://cgit.drupalcode.org/nagios/plain/nagios-plugin/check_drupal?id=7da732e2d4943ec5368243f4cd2e33eb02769f23). |
| 58 | 1 | Jon Goldberg | - **check\_civicrm** - There are two scripts - one for Civi 4.6 and |
| 59 | below, another for 4.7 and up. 4.7 version is available |
||
| 60 | [here](https://github.com/PalanteJon/check_civicrm){.external-link}, |
||
| 61 | 4.6 version is |
||
| 62 | 2 | Jon Goldberg | <span>[here](https://raw.githubusercontent.com/aghstrategies/com.aghstrategies.civimonitor/master/check_civicrm.php).</span> |
| 63 | 1 | Jon Goldberg | - <span>**check\_domain** - This does a WHOIS lookup to ensure domain |
| 64 | names aren't about to expire. Install from |
||
| 65 | 2 | Jon Goldberg | [here](https://raw.githubusercontent.com/glensc/monitoring-plugin-check_domain/master/check_domain.sh).</span> |
| 66 | 1 | Jon Goldberg | - <span><span>**check\_rbl** - Check spam blacklists. File is |
| 67 | 2 | Jon Goldberg | [here](https://raw.githubusercontent.com/matteocorti/check_rbl/master/check_rbl), also install dependencies: |
| 68 | `apt install libreadonly-xs-perl libnagios-plugin-perl libdata-validate-ip-perl libdata-validate-domain-perl libnet-dns-perl` |
||
| 69 | 1 | Jon Goldberg | |
| 70 | 2 | Jon Goldberg | #### Define CheckCommand and Service objects for the new plugins |
| 71 | 1 | Jon Goldberg | |
| 72 | 2 | Jon Goldberg | Copy the CheckCommand and Service files from |
| 73 | 1 | Jon Goldberg | `icinga.jmaconsulting.biz:/etc/icinga2/zones.d/global-templates/CheckCommands` |
| 74 | 2 | Jon Goldberg | and `icinga.jmaconsulting.biz:/etc/icinga2/conf.d/services`. See [[Add New Checks to Icinga2]] for details. |
| 75 | 1 | Jon Goldberg | |
| 76 | |||
| 77 | 2 | Jon Goldberg | ### Set up vim syntax highlighting on the Icinga2 server |
| 78 | ``` |
||
| 79 | mkdir -p ~/.vim/{syntax,ftdetect} |
||
| 80 | cd ~/.vim/syntax |
||
| 81 | wget https://raw.githubusercontent.com/Icinga/icinga2/master/tools/syntax/vim/syntax/icinga2.vim |
||
| 82 | cd ~/.vim/ftdetect |
||
| 83 | wget https://raw.githubusercontent.com/Icinga/icinga2/master/tools/syntax/vim/ftdetect/icinga2.vim |
||
| 84 | ``` |