Openindiana Monitoring

Icinga2 core

+++ THIS SECTION IS STILL UNDER CONSTRUCTION +++ I HAVE TO RE-CHECK IT +++ BUG HITS ME +++

+++ VERIFIED ON A FRESHLY INSTALLED illumos-022bfefbca +++

In this howto I’ll try to cover the aspects to get Icinga2 client core up and running on an Openindiana host. I did not take care about database integration, so if you’re willing to use Icinga2 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, but unfortunately Icinga2 still isn’t a verified component there; I have to few testers to confirm the resulting package as valid :wink: 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. I’m running it in production since 02/2018 without any issues, so it might be suitable for you, too.


Install some dependencies

You should build your packages as root as anything else is just annoying.
First install some dependencies.

$ 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

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 – usually it isn’t :wink:

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 and installing the package

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 now: 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! :slightly_smiling_face: The plugins are installed under /usr/lib/nagios/plugins as known from other systems, and they’re ready to use.

6 Likes

This doc doesn’t work due to missed /scratch/oi-userland/components/sysutils/icinga2 directory and not exists branch remotes/origin/feature_icinga2-2.10.2
GitHub repo was moved to https://github.com/OpenIndiana/oi-userland.git and all branches from the old GitHub repo were removed/merged.

Could you update your HowTo to valid state?