Skip to content

Instantly share code, notes, and snippets.

@walterheck
Last active June 23, 2016 22:57
Show Gist options
  • Save walterheck/c651e47e81d2b84833f22b567dcc7dfd to your computer and use it in GitHub Desktop.
Save walterheck/c651e47e81d2b84833f22b567dcc7dfd to your computer and use it in GitHub Desktop.

If you're doing a lot of command line work with icinga configurations and you happen to use vim a lot, it is super useful to use the vim syntax highlighting that comes with icinga2. Here's how to set it up on a CentOS/RHEL 7 box.

  • First, make sure you have the icinga2-common package installed. This is a dependency of the icinga2 package, so it should be as easy as pie:
[root@icinga2 ~]# yum install icinga2
Loaded plugins: fastestmirror
icinga-stable-release             |  951 B  00:00:00
icinga-stable-release/7/primary   |  21 kB  00:00:00
Loading mirror speeds from cached hostfile
 * base: mirror.nl.leaseweb.net
 * extras: ftp.nluug.nl
 * updates: centos.mirror.transip.nl
icinga-stable-release             122/122
Resolving Dependencies
--> Running transaction check
---> Package icinga2.x86_64 0:2.4.10-1.el7.centos will be installed
--> Processing Dependency: icinga2-bin = 2.4.10-1.el7.centos for package: icinga2-2.4.10-1.el7.centos.x86_64
--> Running transaction check
---> Package icinga2-bin.x86_64 0:2.4.10-1.el7.centos will be installed
--> Processing Dependency: icinga2-common = 2.4.10-1.el7.centos for package: icinga2-bin-2.4.10-1.el7.centos.x86_64
--> Processing Dependency: libboost_system-mt.so.1.53.0()(64bit) for package: icinga2-bin-2.4.10-1.el7.centos.x86_64
--> Processing Dependency: libboost_program_options-mt.so.1.53.0()(64bit) for package: icinga2-bin-2.4.10-1.el7.centos.x86_64
--> Processing Dependency: libboost_thread-mt.so.1.53.0()(64bit) for package: icinga2-bin-2.4.10-1.el7.centos.x86_64
--> Processing Dependency: libboost_regex-mt.so.1.53.0()(64bit) for package: icinga2-bin-2.4.10-1.el7.centos.x86_64
--> Running transaction check
---> Package boost-program-options.x86_64 0:1.53.0-25.el7 will be installed
---> Package boost-regex.x86_64 0:1.53.0-25.el7 will be installed
--> Processing Dependency: libicuuc.so.50()(64bit) for package: boost-regex-1.53.0-25.el7.x86_64
--> Processing Dependency: libicui18n.so.50()(64bit) for package: boost-regex-1.53.0-25.el7.x86_64
--> Processing Dependency: libicudata.so.50()(64bit) for package: boost-regex-1.53.0-25.el7.x86_64
---> Package boost-system.x86_64 0:1.53.0-25.el7 will be installed
---> Package boost-thread.x86_64 0:1.53.0-25.el7 will be installed
---> Package icinga2-common.x86_64 0:2.4.10-1.el7.centos will be installed
--> Running transaction check
---> Package libicu.x86_64 0:50.1.2-15.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================================================
 Package                                        Arch                            Version                                         Repository                                      Size
=====================================================================================================================================================================================
Installing:
 icinga2                                        x86_64                          2.4.10-1.el7.centos                             icinga-stable-release                          9.1 k
Installing for dependencies:
 boost-program-options                          x86_64                          1.53.0-25.el7                                   base                                           155 k
 boost-regex                                    x86_64                          1.53.0-25.el7                                   base                                           294 k
 boost-system                                   x86_64                          1.53.0-25.el7                                   base                                            39 k
 boost-thread                                   x86_64                          1.53.0-25.el7                                   base                                            57 k
 icinga2-bin                                    x86_64                          2.4.10-1.el7.centos                             icinga-stable-release                          2.6 M
 icinga2-common                                 x86_64                          2.4.10-1.el7.centos                             icinga-stable-release                           90 k
 libicu                                         x86_64                          50.1.2-15.el7                                   base                                           6.9 M

Transaction Summary
=====================================================================================================================================================================================
Install  1 Package (+7 Dependent packages)

Total download size: 10 M
Installed size: 41 M
Is this ok [y/d/N]: y
Downloading packages:
(1/8): boost-system-1.53.0-25.el7.x86_64.rpm                                                                                                                  |  39 kB  00:00:00
warning: /var/cache/yum/x86_64/7/icinga-stable-release/packages/icinga2-2.4.10-1.el7.centos.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 34410682: NOKEY
Public key for icinga2-2.4.10-1.el7.centos.x86_64.rpm is not installed
(2/8): icinga2-2.4.10-1.el7.centos.x86_64.rpm                                                                                                                 | 9.1 kB  00:00:00
(3/8): boost-program-options-1.53.0-25.el7.x86_64.rpm                                                                                                         | 155 kB  00:00:00
(4/8): boost-thread-1.53.0-25.el7.x86_64.rpm                                                                                                                  |  57 kB  00:00:00
(5/8): icinga2-common-2.4.10-1.el7.centos.x86_64.rpm                                                                                                          |  90 kB  00:00:01
(6/8): boost-regex-1.53.0-25.el7.x86_64.rpm                                                                                                                   | 294 kB  00:00:03
(7/8): icinga2-bin-2.4.10-1.el7.centos.x86_64.rpm                                                                                                             | 2.6 MB  00:00:08
(8/8): libicu-50.1.2-15.el7.x86_64.rpm                                                                                                                        | 6.9 MB  00:00:10
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                976 kB/s |  10 MB  00:00:10
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ICINGA
Importing GPG key 0x34410682:
 Userid     : "Icinga Open Source Monitoring (Build server) <info@icinga.org>"
 Fingerprint: f51a 91a5 ee00 1aa5 d77d 53c4 c6e3 19c3 3441 0682
 Package    : icinga-rpm-release-7-1.el7.centos.noarch (@/icinga-rpm-release-7-1.el7.centos.noarch)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-ICINGA
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : boost-system-1.53.0-25.el7.x86_64                                                                                                                                 1/8
  Installing : boost-thread-1.53.0-25.el7.x86_64                                                                                                                                 2/8
  Installing : libicu-50.1.2-15.el7.x86_64                                                                                                                                       3/8
  Installing : boost-regex-1.53.0-25.el7.x86_64                                                                                                                                  4/8
  Installing : boost-program-options-1.53.0-25.el7.x86_64                                                                                                                        5/8
  Installing : icinga2-common-2.4.10-1.el7.centos.x86_64                                                                                                                         6/8
  Installing : icinga2-bin-2.4.10-1.el7.centos.x86_64                                                                                                                            7/8
  Installing : icinga2-2.4.10-1.el7.centos.x86_64                                                                                                                                8/8
  Verifying  : icinga2-common-2.4.10-1.el7.centos.x86_64                                                                                                                         1/8
  Verifying  : boost-program-options-1.53.0-25.el7.x86_64                                                                                                                        2/8
  Verifying  : boost-system-1.53.0-25.el7.x86_64                                                                                                                                 3/8
  Verifying  : icinga2-bin-2.4.10-1.el7.centos.x86_64                                                                                                                            4/8
  Verifying  : libicu-50.1.2-15.el7.x86_64                                                                                                                                       5/8
  Verifying  : boost-regex-1.53.0-25.el7.x86_64                                                                                                                                  6/8
  Verifying  : icinga2-2.4.10-1.el7.centos.x86_64                                                                                                                                7/8
  Verifying  : boost-thread-1.53.0-25.el7.x86_64                                                                                                                                 8/8

Installed:
  icinga2.x86_64 0:2.4.10-1.el7.centos

Dependency Installed:
  boost-program-options.x86_64 0:1.53.0-25.el7     boost-regex.x86_64 0:1.53.0-25.el7              boost-system.x86_64 0:1.53.0-25.el7     boost-thread.x86_64 0:1.53.0-25.el7
  icinga2-bin.x86_64 0:2.4.10-1.el7.centos         icinga2-common.x86_64 0:2.4.10-1.el7.centos     libicu.x86_64 0:50.1.2-15.el7

Complete!
  • Next, make sure vim is installed. This might sound like a major d'oh, but it's not installed by default on RHEL 7 machines so just trying to be complete.
 vim-common                                     x86_64                                 2:7.4.160-1.el7                                    base                                 5.9 M
 vim-filesystem                                 x86_64                                 2:7.4.160-1.el7                                    base                                 9.6 k

Transaction Summary


=====================================================================================================================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 7.0 M


Installed size: 23 M
Downloading packages:
(1/4): gpm-libs-1.20.7-5.el7.x86_64.rpm                                                                                                                       |  32 kB  00:00:00
(2/4): vim-filesystem-7.4.160-1.el7.x86_64.rpm                                                                                                                | 9.6 kB  00:00:00


(3/4): vim-enhanced-7.4.160-1.el7.x86_64.rpm                                                                                                                  | 1.0 MB  00:00:01
(4/4): vim-common-7.4.160-1.el7.x86_64.rpm                                                                                                                    | 5.9 MB  00:00:02
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                2.4 MB/s | 7.0 MB  00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : gpm-libs-1.20.7-5.el7.x86_64                                                                                                                                      1/4
  Installing : 2:vim-filesystem-7.4.160-1.el7.x86_64                                                                                                                             2/4
  Installing : 2:vim-common-7.4.160-1.el7.x86_64                                                                                                                                 3/4
  Installing : 2:vim-enhanced-7.4.160-1.el7.x86_64                                                                                                                               4/4
  Verifying  : 2:vim-common-7.4.160-1.el7.x86_64                                                                                                                                 1/4
  Verifying  : 2:vim-filesystem-7.4.160-1.el7.x86_64                                                                                                                             2/4
  Verifying  : gpm-libs-1.20.7-5.el7.x86_64                                                                                                                                      3/4
  Verifying  : 2:vim-enhanced-7.4.160-1.el7.x86_64                                                                                                                               4/4

Installed:
  vim-enhanced.x86_64 2:7.4.160-1.el7

Dependency Installed:
  gpm-libs.x86_64 0:1.20.7-5.el7                          vim-common.x86_64 2:7.4.160-1.el7                          vim-filesystem.x86_64 2:7.4.160-1.el7

Complete!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment