#############################
##### 1. Icinga2 Server #####
#############################
##### Dependencies #####
apt-get update && apt-get install wget bash-completion unzip build-essential gcc perl libssl-dev perl-doc libxml-libxml-perl libxml2-dev uuid uuid-dev libsoap-lite-perl libarchive-zip-perl libcrypt-ssleay-perl libclass-methodmaker-perl libdata-dump-perl libtime-duration-perl libdevel-stacktrace-perl libclass-data-inheritable-perl libcrypt-openssl-rsa-perl libcrypt-x509-perl libuuid-perl liburi-perl libnet-dns-perl snmp e2fsprogs libnagios-object-perl libxml-perl libconvert-units-perl libmath-calc-units-perl libmonitoring-plugin-perl liblwp-useragent-determined-perl libexception-class-perl libpath-class-perl libtry-tiny-perl libxml-sax-perl libxml-namespacesupport-perl libmodule-build-perl libnet-inet6glue-perl mailutils nagios-snmp-plugins
##### MYSQL Server #####
apt-get install mysql-server mysql-client&& mysql_secure_installation
##### Icinga2 installation #####
apt-get install icinga2 icinga2-ido-mysql nagios-nrpe-plugin
##### Activate Icinga2 features #####
icinga2 feature enable ido-mysql && icinga2 feature enable command && icinga2 feature enable livestatus && icinga2 feature enable perfdata && icinga2 feature enable statusdata
#############################
##### 2. Icinga2 WebGUI #####
#############################
##### Installation #####
apt-get install icingaweb2 libapache2-mod-php php-xml
usermod -a -G nagios www-data
##### Create Logfile #####
mkdir /var/log/icingaweb2/ && touch /var/log/icingaweb2/icingaweb2.log && chown -R www-data:www-data /var/log/icingaweb2
##### Give Icingaweb access to icinga2 DB #####
mysql -u root -p
GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON icinga2.* TO 'icingaweb'@'localhost' IDENTIFIED BY '*******';
mysql> FLUSH PRIVILEGES;
mysql> quit
##### Create Token #####
icingacli setup config directory --group icingaweb2
icingacli setup token create
##### Set Timezone in php.ini #####
nano /etc/php/7.0/apache2/php.ini
## Set in line ca. 924 ##
date.timezone = "Europe/Berlin"
###################################################
##### 3. VMWare vSphere Perl SDK installation #####
###################################################
##### Install old libww-perl to avoid plugin timeout #####
cd /usr/src
mkdir libwww-perl
cd libwww-perl
wget http://192.168.11.6/libwww-perl-5.837.tar.gz
tar -xzf 5.837.tar.gz
cd libwww-perl-libwww-perl-5.837/
perl Makefile.PL INSTALL_BASE=/usr/src/check_vmware_esx
make
make install
##### If you on Debian do this #####
echo ubuntu > /etc/tmp-release
##### Set environment variable #####
export http_proxy=
export ftp_proxy=
##### Install Software #####
cd /usr/src
wget http://192.168.11.6/VMware-vSphere-Perl-SDK-5.5.0.i386.tar.gz
tar -xzvf VMware-vSphere-Perl-SDK-5.5.0.i386.tar.gz
cd vmware-vsphere-cli-distrib
./vmware-install.pl
##### Add path to libwww-perl to '/usr/share/perl/5.XX/VMware/VICommon.pm' #####
use lib "/usr/src/check_vmware_esx/lib/perl5"; ## @beginning of file
##### Find following lines in '/usr/share/perl/5.XX/VMware/VICommon.pm' #####
return defined $user_agent->cookie_jar and
$user_agent->cookie_jar->as_string ne '';
## and change it to these ##
return (defined $user_agent->cookie_jar and
$user_agent->cookie_jar->as_string ne '');
##### Get VMWare check plugin #####
cd /usr/lib/nagios/plugins
wget http://192.168.11.6/check_esxi.py
chmod +x check_esxi.py
##### Finally reboot and configure web interface #####
http://IP-Adresse/icingaweb2/setup