Changes

From Amahi Wiki
Jump to: navigation, search
329 bytes added ,  16:10, 17 July 2018
{{MessageBox|
backgroundcolor = red#faa|
image =Warning.png|
heading =WARNING|
These instructions were modified from documentation already on the [http://docs.icinga.org/1.4.0/en/ Icinga Website]. They are geared toward installing Icinga v1.4.
 
<div style="display:block;float:right;clear:right;margin-left:1em;text-align:center">[[File:Icinga-screenshot.png|275px|right|thumb|alt=Icinga Web 2.0 Interface|Icinga Web 2.0 Interface Screenshot]]</div>
These instructions are the combined effort documented in the following Icinga Documentation pages:
* [http://docs.icinga.org/1.4.0/en/ Icinga Version 1.4 Documentation]** [http://docs.icinga.org/1.4.0/en/quickstart-icinga.html Icinga Quickstart]** [http://docs.icinga.org/1.4.0/en/quickstart-idoutils.html Icinga with IDOUtils Quickstart]** [http://docs.icinga.org/1.4.0/en/icinga-web-scratch.html Installation of the Icinga-Web Frontend]** [http://docs.icinga.org/1.4.0/en/icinga-api.html Installation and use of the Icinga API]** [http://docs.icinga.org/1.2.0/en/icinga-web-pnp.html Integration of PNP4Nagios into Icinga Web]
* [https://wiki.icinga.org/display/howtos/Setting+up+icinga-mobile Setting up icinga-mobile]
* [http://docs.pnp4nagios.org/pnp-0.6/start PNP4Nagios Documenation]
If you have any questions then please contact me.
-- [[User:Sag47|Sag47]] 2122:5737, 18 July 2011 (PDT)
= What is Icinga? =
'''NOTE:''' If there is a kernel update then you should restart your machine after running yum update and start these instructions over.
{{Code|<pre>
yum check-update
yum update -y
yum groupinstall "Development Tools" "Legacy Software Development" -y
yum install <nowiki>httpd httpd-devel gcc glibc glibc-common gd gd-devel libjpeg libjpeg-devel libpng libpng-devel mysql mysql-server libdbi libdbi-devel libdbi-drivers libdbi-dbd-mysql net-snmp net-snmp-devel net-snmp-utils php php-cli php-pear php-xmlrpc php-xsl php-pdo php-gd php-ldap php-mysql php-mysql php-soap java-1.6.0-openjdk java-1.6.0-openjdk-devel zip unzip</nowiki> -y}}</PRE>
== Create a Webapp ==
Create /var/hda/web-apps/icinga/html/index.html and give it the following contents.
{{Text|Text=
<pre><nowiki><html>
<head>
<body>
</body>
</html></nowiki></pre>}}
'''NOTE:''' Icinga will install to /usr/local/icinga. Icinga Web will install to /usr/local/icinga-web
== Compile and install Icinga with IDOUtils ==
Create an icinga user, icinga-cmd group, and add the apache user and icinga user to the icinga-cmd group.
{{Code|<pre>
useradd -m icinga
groupadd icinga-cmd
usermod -a -G icinga-cmd icinga
usermod -a -G icinga-cmd apache}}</pre>
Now lets do some compiling.
{{Code|<pre>
cd /usr/local/src/
tar -xzf icinga-1.4.2.tar.gz
make all
make fullinstall
}}</pre>
Edit the ''/usr/local/icinga/etc/objects/contacts.cfg'' config file with your favorite editor and change the email address associated with the icingaadmin contact definition to the address you'd like to use for receiving alerts.
{{Code|<pre>
vim /usr/local/icinga/etc/objects/contacts.cfg
cp /usr/local/icinga/etc/ido2db.cfg-sample /usr/local/icinga/etc/ido2db.cfg
cp /usr/local/icinga/etc/idomod.cfg-sample /usr/local/icinga/etc/idomod.cfg
cp /usr/local/icinga/etc/modules/idoutils.cfg-sample /usr/local/icinga/etc/modules/idoutils.cfg}}</pre>
Create the icinga db/user/pass for IDOUtils to use and import the mysql database (you should still be in ''/usr/local/src/icinga-1.4.2'' working directory).
{{Code|<pre>hda-create-db-and-user icingamysql -u icinga -picinga icinga < module/idoutils/db/mysql/mysql.sql}}</pre>
Configure the password for the icinga directory.
{{Code|<pre>htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin}}</pre>
Configure the Apache config located in ''/etc/httpd/conf.d/''
{{Code|<pre>
ls /etc/httpd/conf.d/ <nowiki>|</nowiki> grep icinga
#you should see two files. Something like 1002-icinga.conf and icinga.conf
#and move </VirtualHost> from the middle of the file to the end.
#be sure to confirm that the contents of icinga.conf are within 1002-icinga.conf before removing it
rm -f /etc/httpd/conf.d/icinga.conf}}</pre>
Start icinga, idoutils and restart the apache server.
{{Code|<pre>service icinga start
service ido2db start
service httpd restart}}</pre>
Visit http://icinga and make sure that it is currently working.
== Install Nagios Plugins ==
Time to compile again!
{{Code|<pre>
cd /usr/local/src/
tar -xzf nagios-plugins-1.4.15.tar.gz
make
make install
service icinga restart}}</pre>
Now visit http://icinga/ and click on Service Detail in the menu on the left under Status. After about 5 mins everything should slowly start turning green.
== Install the latest Icinga API ==
Don't worry, there's nothing to compile here. But you still have to configure and install the Icinga API.
{{Code|<pre>cd /usr/local/src/
tar -xzf icinga-api-refs-heads-master.tar.gz
cd icinga-api
./configure <nowiki>--datarootdir=/usr/local/icinga/share --sysconfdir=/usr/local/icinga/etc --with-command-user=icinga-cmd --with-command-group=icinga-cmd --with-icinga-user=icinga --with-icinga-group=icinga --with-web-user=apache --with-web-group=apache</nowiki>
make install}}</pre>
== Install the Icinga Web 2.0 Interface ==
Create the Icinga Web db/user/pass.
{{Code|<pre>hda-create-db-and-user icinga_web}}</pre>
Configure and install the new web interface.
{{Code|<pre>cd /usr/local/src/
tar -xzf icinga-web-1.4.1.tar.gz
cd icinga-web-1.4.1
make install-apache-config
make db-initialize
#Choose y for every question asked by make db-initialize}}</pre>
Now we need to do the same thing with the virtual server as we did originally with the Icinga install so that it shows up for our Virtual Host.
{{Code|<pre>ls /etc/httpd/conf.d/ <nowiki>|</nowiki> grep icinga
#you should see two files. Something like 1002-icinga.conf and icinga-web.conf
cat /etc/httpd/conf.d/icinga-web.conf >> /etc/httpd/conf.d/1002-icinga.conf
#and move </VirtualHost> from the middle of the file to the end.
#be sure to confirm that the contents of icinga-web.conf are within 1002-icinga.conf before removing it
rm -f /etc/httpd/conf.d/icinga-web.conf*}}</pre>
Restart icinga, idoutils, and apache.
{{Code|<pre>service icinga restartservice httpd restart}}</pre>Go to the webpath (http://icinga/icinga-web/) and check if the webinterface web interface starts without exceptions (database connections web and api). You can login with user 'root' and password 'password'.
== Install the Icinga Mobile Interface ==
Time for more source work!
{{Code|<pre>cd /usr/local/src/
#if you want the latest then run git clone http://git.icinga.org/icinga-mobile.git
unzip icinga-mobile-0.1.0.zip
make compile
make install
make install-apache-config}}</pre>
Now we need to do the same thing with the virtual server as we did originally with the Icinga install so that it shows up for our Virtual Host.
{{Code|<pre>ls /etc/httpd/conf.d/ <nowiki>|</nowiki> grep icinga
#you should see two files. Something like 1002-icinga.conf and icinga-mobile.conf
cat /etc/httpd/conf.d/icinga-mobile.conf >> /etc/httpd/conf.d/1002-icinga.conf
#and move </VirtualHost> from the middle of the file to the end.
#be sure to confirm that the contents of icinga-mobile.conf are within 1002-icinga.conf before removing it
rm -f /etc/httpd/conf.d/icinga-mobile.conf*}}</pre>
Restart icinga, idoutils, and apache.
{{Code|<pre>service httpd restart}}</pre>
Now go to http://icinga/icinga-web and log in as root. Click on Admin > Users and Add new user. Give it the following settings.
== Add Icinga servers to the Admin CP ==
You will want to add two servers to your HDA Admin Control Panel. One for Icinga and one for IDOUtils.
{{Code|<pre><nowiki>echo 'Server.create(:name => "icinga", :comment => "Icinga")' | (cd /var/hda/platform/html && ./script/console production)</nowiki>}}</pre>
{{Code|<pre><nowiki>echo 'Server.create(:name => "ido2db", :comment => "IDOUtils")' | (cd /var/hda/platform/html && ./script/console production)</nowiki>}}</pre>
Now go to http://hda and visit Setup > Settings > Servers and you will see Icinga and IDOUtils showing up at the bottom.
# Unzip browser_detect.js to ''/var/hda/web-apps/icinga/html/''
# Create /var/hda/web-apps/icinga/html/index.html with the following contents.
{{Text|Text=
<pre><nowiki><html>
<head>
<body>
</body>
</html></nowiki></pre>}}
= Icinga Plugins =
* Download latest [http://sourceforge.net/projects/pnp4nagios/files/PNP-0.6/ PNP4Nagios from sourceforge] and move it to ''/usr/local/src/''
* Install the following packages
{{Code|<pre>yum install <nowiki>perl rrdtool rrdtool-perl</nowiki> -y}}</pre>
=== Set up PNP4Nagios ===
More compiling!
{{Code|<pre>
cd /usr/local/src/
tar -xzf pnp4nagios-0.6.13.tar.gz
./configure <nowiki>--with-nagios-user=icinga --with-nagios-group=icinga --with-httpd-conf=/etc/httpd/conf.d</nowiki>
make all
make fullinstall}}</pre>
Change some PNP4Nagios settings
{{Code|<pre>sed -i 's/\/nagios\/cgi-bin/\/icinga\/cgi-bin/' /usr/local/pnp4nagios/etc/config.php}}</pre>
Apache integration for PNP4Nagios.
{{Code|<pre>
cd /etc/httpd/conf.d/
sed -i 's/nagios\/etc\/htpasswd.users/icinga\/etc\/htpasswd.users/' pnp4nagios.conf
vim 1002-icinga.conf
rm pnp4nagios.conf
service httpd restart}}</pre>
Visit http://icinga/pnp4nagios/ and make sure all tests pass. Then remove the install.php file.
{{Code|<pre>rm /usr/local/pnp4nagios/share/install.php}}</pre>
Now enable processing performance data in Icinga. Edit icinga.conf and set ''process_performance_data=1''.
{{Code|<pre>vim /usr/local/icinga/etc/icinga.cfg}}</pre>
Uncommend the following lines in /usr/local/icinga/etc/icinga.cfg.
{{Text|Text=<pre>
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata}}
command_name process-service-perfdata
command_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl
}</nowiki></pre>}}</pre>
Restart Icinga
{{Code|<pre>service icinga restart}}</pre>
Now PNP4Nagios is installed. You can visit PNP4Nagios by going to http://icinga/pnp4nagios
==== Classic Interface ====
Add the following lines to the top of ''/usr/local/icinga/etc/objects/templates.cfg''
{{Text|Text=
<pre><nowiki>define host{
name host-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
register 0
}</nowiki></pre>}}
Edit /usr/local/icinga/etc/objects/templates.cfg and within the ''generic-host'' definition add the following line underneath "''name generic-host''".
{{Text|Text=<pre><nowiki>use host-pnp</nowiki></pre>}}
Edit /usr/local/icinga/etc/objects/templates.cfg and within the ''generic-service'' definition add the following line underneath "''name generic-service''".
{{Text|Text=<pre><nowiki>use srv-pnp</nowiki></pre>}}
==== New Interface ====
First make backup copies of the configuration files you need to modify.
{{Code|<pre>
cd /usr/local/icinga-web/app/modules/Cronks/data/xml/grid/
cp icinga-host-template.xml icinga-host-template.bak
cp icinga-service-template.xml icinga-service-template.bak}}</pre>
Now edit ''icinga-host-template.xml'' and right before the line ''<field name="host_info">'' add the following following field definition.
{{Text|Text=
<pre><nowiki><field name="pnp4nagios_host_link">
<!-- datasource maps a data field from api call -->
<parameter name="enabled">false</parameter>
</order>
</field></nowiki></pre>}}
Edit ''icinga-service-template.xml'' and right before the line ''<field name="service_info">'' add the following following field definition.
{{Text|Text=
<pre><nowiki><field name="pnp4nagios_service_link">
<!-- datasource maps a data field from api call -->
<parameter name="enabled">false</parameter>
</order>
</field></nowiki></pre>}}
You now have to clear the Icinga Web cache to finalize applying the settings you changed.
{{Code|<pre>/usr/local/icinga-web/bin/clearcache.sh}}</pre>
12,424

edits