Riaan's SysAdmin Blog

My tips, howtos, gotchas, snippets and stuff. Use at your own risk!


Icinga2 on Solaris 11

I typically prefer using Nagios for network monitoring. Nagios itself is tricky to get going on Solaris and I have had a long running issue with Nagios on Solaris. Despite the issue around Nagios Core Worker timing out I still use Nagios on Solaris. If Linux is an option in a particular environment it would be preferable to use a packaged up Nagios from any of the popular distributions.

Having said that I have recently tried Icinga2 on Solaris and here is some notes around getting it running. Consider yourself warned this is not pretty but it runs surprisingly well and lightweight compared to Nagios. At least on Solaris SPARC.

There is a few hoops to jump through before compiling icinga2 like the compile environment and boost is particularly nasty. I will document that separate at some point in future. As I said you are on your own to get the compile environment and pre-requisites in order.

Stage and compile:

# pwd
# wget https://github.com/Icinga/icinga2/archive/v2.3.11.tar.gz
# gzip -d v2.3.11.tar.gz 
# tar xf v2.3.11.tar 
# mv v2.3.11.tar icinga-v2.3.11.tar
# cd icinga2-2.3.11/
# mkdir build && cd build
# cmake -D MYSQL_INCLUDE_DIR=/usr/mysql/5.1/include -D MYSQL_LIB=/usr/mysql/5.1/lib -DICINGA2_WITH_PGSQL=OFF ..

Issue 1 -- cmake:

# pwd
# diff CMakeLists.txt CMakeLists.txt.orig 
<     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -pthread -lm")
>     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")

** rerun cmake after fixing CMakeLists.txt

Compile issue 2 -- INFINITY:

# cd build/
# gmake VERBOSE=1

/usr/src/icinga2-2.3.11/lib/base/math-script.cpp:85:18: error: ‘INFINITY’ was not declared in this scope

# diff /usr/src/icinga2-2.3.11/lib/base/math-script.cpp /usr/src/icinga2-2.3.11/lib/base/math-script.cpp.orig
< #define INFINITY (__builtin_huge_val ())

# gmake VERBOSE=1

** takes a very long time

Compile issue 3 -- mysql.h:

/usr/src/icinga2-2.3.11/lib/db_ido_mysql/idomysqlconnection.hpp:27:19: fatal error: mysql.h: No such file or directory

# find / -name mysql.h

# cmake -D MYSQL_INCLUDE_DIR=/usr/mysql/5.5/include -D MYSQL_LIB=/usr/mysql/5.1/lib -DICINGA2_WITH_PGSQL=OFF ..
-- Could NOT find yajl (missing:  YAJL_LIBRARY YAJL_INCLUDE_DIR) 
running /usr/bin/cmake -E copy_if_different "/usr/src/icinga2-2.3.11/third-party/yajl/src/api/yajl_parse.h" "/usr/src/icinga2-2.3.11/build/third-party/yajl/src/../include/yajl"  2>&1
running /usr/bin/cmake -E copy_if_different "/usr/src/icinga2-2.3.11/third-party/yajl/src/api/yajl_gen.h" "/usr/src/icinga2-2.3.11/build/third-party/yajl/src/../include/yajl"  2>&1
running /usr/bin/cmake -E copy_if_different "/usr/src/icinga2-2.3.11/third-party/yajl/src/api/yajl_common.h" "/usr/src/icinga2-2.3.11/build/third-party/yajl/src/../include/yajl"  2>&1
running /usr/bin/cmake -E copy_if_different "/usr/src/icinga2-2.3.11/third-party/yajl/src/api/yajl_tree.h" "/usr/src/icinga2-2.3.11/build/third-party/yajl/src/../include/yajl"  2>&1
-- MySQL Include dir: /usr/mysql/5.5/include  library dir: /usr/mysql/5.1
-- MySQL client libraries: mysqlclient_r
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/src/icinga2-2.3.11/build

** of course rerun gmake


# gmake install
[  1%] Built target mmatch
[ 10%] Built target yajl
-- Installing: /usr/local/share/doc/icinga2/markdown/21-debug.md
-- Installing: /usr/local/share/doc/icinga2/markdown/12-distributed-monitoring-ha.md

Attempt first run:

# LD_LIBRARY_PATH=/usr/local/lib/:/usr/mysql/5.1/lib/mysql
# /usr/local/sbin/icinga2 daemon
[2015-11-10 06:59:17 -0800] information/cli: Icinga application loader (version: r2.3.11-1)
[2015-11-10 06:59:17 -0800] information/cli: Loading application type: icinga/IcingaApplication
[2015-11-10 06:59:17 -0800] information/ConfigItem: Checked 1 UserGroup(s).
[2015-11-10 06:59:17 -0800] information/ConfigItem: Checked 1 IcingaApplication(s).
[2015-11-10 06:59:17 -0800] information/ConfigItem: Checked 1 ScheduledDowntime(s).
[2015-11-10 06:59:17 -0800] information/ScriptGlobal: Dumping variables to file '/usr/local/var/cache/icinga2/icinga2.vars'
[2015-11-10 06:59:17 -0800] information/DynamicObject: Restoring program state from file '/usr/local/var/lib/icinga2/icinga2.state'
[2015-11-10 06:59:17 -0800] information/DynamicObject: Restored 157 objects. Loaded 5 new objects without state.
[2015-11-10 06:59:17 -0800] information/ConfigItem: Triggering Start signal for config items
[2015-11-10 06:59:17 -0800] information/DbConnection: Resuming IDO connection: ido-mysql
[2015-11-10 06:59:17 -0800] information/ConfigItem: Activated all objects.
[2015-11-10 06:59:17 -0800] information/IdoMysqlConnection: MySQL IDO instance id: 1 (schema version: '1.13.0')

Web front-end:

Definitely read:

# pwd
# mv master.zip icinga2_master_old.zip
# wget https://github.com/Icinga/icingaweb2/archive/master.zip

# unzip icinga2_master_20151110.zip
 inflating: icingaweb2-master/test/php/res/status/icinga.objects.cache  
  inflating: icingaweb2-master/test/php/res/status/icinga.status.dat  

Since I am upgrading in my case I followed header "Upgrading Icinga Web 2"

Before upgrade version.

# pwd
# more VERSION 

# mv icingaweb2 icingaweb2.20151110
# mv icingaweb2-master/ icingaweb2

Not sure if my upgrade actually needed the schema change(did not verify) this but I ran it just in case.

# pwd
# mysql -u root -p icinga < 2.0.0beta3-2.0.0rc1.sql 

** In addition although the v2.0.0-rc1 web front-end is working fine for me the latest (v2.0.0) is not. I have a problem on the dashboard I have not had time to track down. The error is: The filter column "view" is not allowed here.


Bio Info for Riaan