Icinga 2 & Openindiana

Diesen Beitrag schrieb ich 5 Jahre und 8 Monate zuvor; die nachfolgenden Ausführungen müssen heute weder genau so nach wie vor funktionieren, noch meiner heutigen Meinung entsprechen. Behalte das beim Lesen (und vor allem: beim Nachmachen!) bitte stets im Hinterkopf.

Geschätzte Lesezeit: 3 Minuten

Hierbei handelt es sich um einen alten Artikel aus dem Archiv, den ich lediglich der Vollständigkeit halber hier im Blog eingliedere.

What’s this all about?

In this howto I’ll try to cover the aspects to get Icinga 2 client core up and running on an Openindiana host. I did not take care about database integration, so if you’re willing to use Icinga 2 as a master on Openindiana you’re on your own – it’s probably not that complicated, but who knows?

Build process is based on oi-userland 2, but unfortunately Icinga 2 still isn’t a verified component there; I have too few testers to confirm the resulting package as valid… My goal would be to get it in the official oi-userland - meanwhile you

  • either have to check out oi-userland and do it on your own or
  • you have to checkout my fork with icinga2 branch – your choice

So let’s start building the icinga2 package on Openindiana. Use this howto on your own risk.

  • I wrote it based on illumos-9b40c3052b
  • it’s also tested for illumos-68d7704518
  • it’s verified on a freshly installed illumos-022bfefbca

I’m running it in production since 02/2018 without any issues, so it might be suitable for you, too.

Icinga 2 on Openindiana

Install some dependencies

You should build your packages as root as anything else is just annoying.

$ pkg install build-essential boost libyajl2

Preparing Git

Now prepare the environment: you are invited to use my fork on GitHub.

$ mkdir /scratch
$ cd /scratch
$ git clone https://github.com/sysadmama/oi-userland.git

Local package repository

$ cd /scratch/oi-userland/components
$ gmake setup

This creates /scratch/oi-userland/i368/repo for later package installation use.

Branch icinga2-2.10.2

$ cd /scratch/oi-userland/
$ git branch -a
* oi/hipster
  remotes/origin/HEAD -> origin/oi/hipster
  remotes/origin/feature_icinga2-2.10.2
  remotes/origin/oi/hipster
  remotes/origin/unleashed
  remotes/origin/upstream
$ git checkout -b icinga2 remotes/origin/feature_icinga2-2.10.2
Branch 'icinga2' set up to track remote branch 'feature_icinga2-2.10.2' from 'origin'.
Switched to a new branch 'icinga2'

Building the package

$ cd /scratch/oi-userland/components/sysutils/icinga2

Cleaning up everything

$ gmake clobber

Installing required packages and preparing the environment

$ gmake env-prep
$ gmake prep

Building the software and creating sample manifest

$ gmake sample-manifest

Now you’re able to vimdiff and to update the component manifest if needed – but usually it isn’t

Generate dependencies

$ gmake REQUIRED_PACKAGES

If not provided at the end of the component Makefile, the list of dependencies should be generated; usually not necessary in our context.

Tests

$ gmake test

Pre-publish

Check if the publication of the component can complete without actually publishing the package to the local repository.

$ gmake pre-publish

Publish

Everything was fine? Publish it to your /scratch/oi-userland/i386/repo – now you can use it!

$ gmake publish

Using this userland repo

What are the currently used publishers?

$ pkg publisher
PUBLISHER                   TYPE     STATUS P LOCATION
openindiana.org              origin   online F http://pkg.openindiana.org/hipster/

So we have to add our own repo:

$ pkg set-publisher -p file:///scratch/oi-userland/i386/repo
## Maybe needed: $ pkg set-publisher --non-sticky openindiana.org
$ pkg publisher
PUBLISHER                   TYPE     STATUS P LOCATION
userland                    origin   online F file:///scratch/oi-userland/i386/repo/
openindiana.org             origin   online F http://pkg.openindiana.org/hipster/

And when new builded packages are ready, refresh repo:

$ pkgrepo refresh -s /scratch/oi-userland/i386/repo/
$ pkgrepo rebuild -s /scratch/oi-userland/i386/repo/

And finally: install the package!

$ pkg search icinga2
$ pkg install icinga2
$ pkg info icinga2
          Name: system/monitoring/icinga2
       Summary: Icinga 2 - An open source host and network monitoring system
      Category: Applications/System Utilities
         State: Installed
     Publisher: userland
       Version: 2.10.2
        Branch: 2018.0.0.0
Packaging Date: January 16, 2019 at 08:06:11 AM
          Size: 367.47 MB
          FMRI: pkg://userland/system/monitoring/icinga2@2.10.2-2018.0.0.0:20190116T080611Z
   Project URL: https://github.com/icinga
    Source URL: https://github.com/Icinga/icinga2/archive/v2.10.2.tar.gz

With icinga2.xml I deliver a basic version for SVC. Let’s check ist.

$ svcs icinga2
STATE          STIME    FMRI
disabled       11:44:29 svc:/application/monitoring/icinga2:default
Disabled means: this service is not running. So let’s enable it.

$ svcadm enable icinga2
$ svcs icinga2
STATE          STIME    FMRI
online         Jan_24   svc:/application/monitoring/icinga2:default

If you encounter issues when starting your daemon, take a look at the logfiles stored in /var/svc/log – try tail -f application-monitoring-icinga2\:default.log

Building the check plugins

I found no way to get the check plugins into oi-userland, and I tried several times… Spending enough time and with help from the mailing list it probably would be possible, but I didn’t follow this approach. So what I do it to build the nagios-plugins completely by hand. But as you’ll see: this is not hard at all.

Wait - what? nagios-plugins?

I know the wars of monitoring-plugins vs. nagios-plugins, but I’m not interested in that. In fact, it’s not possible to compile monitoring-plugins on OpenSolaris Hipster without accident. As I am not an developer – I can’t fix the source to get it running and it’s not my job – I decided to use a working alternative. Feel free to do it your way.

Getting source

Obtain latest source tarball, unpack and prepare it.

$ cd /usr/src
$ wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
$ tar xvfz nagios-plugins-2.2.1.tar.gz
$ cd nagios-plugins-2.2.1

Configure and build

Use a prefix you prefer – in fact there’s no need to have nagios in that PATH, but I usually keep it due to historical reasons.

$ ./configure \
--with-nagios-user=icinga \
--with-nagios-group=icinga \
--prefix=/usr/lib/nagios/plugins \
--libexecdir=/usr/lib/nagios/plugins \
--enable-perl-modules
$ gmake
$ gmake install && gmake install-root

And that’s it! 🙂 The plugins are installed under /usr/lib/nagios/plugins as known from other systems, and they’re ready to use.

Alle Bilder dieser Seite: © Marianne Spiller – Alle Rechte vorbehalten
Hintergrundbild: Blick in meine Stiftebox, 2019, 1500x 1000px, Bild genauer anschauen – © Marianne Spiller – Alle Rechte vorbehalten

Eure Gedanken zu „Icinga 2 & Openindiana“

Ich freue mich über jeden Kommentar, es sei denn, er ist blöd. Deshalb behalte ich mir auch vor, die richtig blöden kurzerhand wieder zu löschen. Die Kommentarfunktion ist über GitHub realisiert, weshalb ihr euch zunächst dort einloggen und „utterances“ bestätigen müsst. Die Kommentare selbst werden im Issue-Tracker und mit dem Label „✨💬✨ comment“ erfasst – jeder Blogartikel ist ein eigenes Issue. Über GitHub könnt ihr eure Kommentare somit jederzeit bearbeiten oder löschen.