This shows you the differences between two versions of the page.
| — |
icinga:icinga_configuration1.8 [2020/04/10 17:38] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== ICINGA 1.8 Installation ====== | ||
| + | |||
| + | Due to the fact that some repositories do not have recent version of Icinga, it becomes very important to install from without using the repositories {{http://10.12.112.4/dokuwiki/lib/plugins/fckg/fckeditor/editor/images/smiley/msn/regular_smile.gif?nolink&}} | ||
| + | |||
| + | |||
| + | If you are planning to install from source then please use the official release tarball. | ||
| + | |||
| + | |||
| + | This guide is intended to provide you with simple instructions on how to install Icinga from source (code) and have it monitoring your local machine within 20 minutes. {{http://10.12.112.4/dokuwiki/lib/plugins/fckg/fckeditor/editor/images/smiley/msn/thumbs_up.gif?nolink&}}No advanced installation options are discussed here - just the basics that will work for most of the users who want to get started. | ||
| + | |||
| + | |||
| + | ===== What You'll End Up With ===== | ||
| + | |||
| + | |||
| + | Icinga and the plugins will be installed underneath **/usr/local/icinga** Icinga will be configured to monitor a few aspects of your local system (CPU load, disk usage, etc.) | ||
| + | |||
| + | |||
| + | The Icinga classic web interface will be accessible at ''[[http://localhost/icinga/|http://localhost/icinga/]]'' or ''[[http://yourdomain.com/icinga|http://yourdomain.com/icinga]]'' | ||
| + | |||
| + | |||
| + | ===== Prerequisites ===== | ||
| + | |||
| + | |||
| + | During portions of the installation you'll need to have root access to your machine. | ||
| + | |||
| + | |||
| + | Make sure you've installed the following packages on your system before continuing. [[http://www.apache.org/|Apache]] | ||
| + | |||
| + | |||
| + | * Apache | ||
| + | * Mysql server | ||
| + | * SNMP | ||
| + | |||
| + | |||
| + | At one time or another you may need to use SNMP-based checks so it is a good idea to install the required packages now. Otherwise some plugins are not compiled i.e. not available when you need them and it would require a recompile of the plugins. | ||
| + | |||
| + | |||
| + | ===== Install packages ===== | ||
| + | |||
| + | |||
| + | You can install these packages by running the following commands (as root or using ''sudo''). | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> apt-get install apache2 mysql-server build-essential libgd2-xpm-dev | ||
| + | #> apt-get install libjpeg62 libjpeg62-dev libpng12 libpng12-dev | ||
| + | #> apt-get install snmp snmpd snmp-mibs-downloader libsnmp5-dev | ||
| + | </code> | ||
| + | |||
| + | |||
| + | ===== Create Account Information ===== | ||
| + | |||
| + | |||
| + | Become the root user. | ||
| + | |||
| + | |||
| + | <code> | ||
| + | $> su -l | ||
| + | </code> | ||
| + | |||
| + | |||
| + | OR | ||
| + | |||
| + | |||
| + | <code> | ||
| + | $ sudo -i | ||
| + | </code> | ||
| + | |||
| + | |||
| + | Create a new //icinga// user account and give it a password: | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> /usr/sbin/useradd -m icinga | ||
| + | #> passwd icinga | ||
| + | </code> | ||
| + | |||
| + | |||
| + | On some distributions you'll need to add the group in a single step: | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> /usr/sbin/groupadd icinga | ||
| + | </code> | ||
| + | |||
| + | |||
| + | For sending commands from the classic web interface to Icinga, you'll need to create a new group icinga-cmd. Add the webuser and the Icinga user to this group: | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> /usr/sbin/groupadd icinga-cmd | ||
| + | |||
| + | #> /usr/sbin/usermod -a -G icinga-cmd icinga | ||
| + | |||
| + | #> /usr/sbin/usermod -a -G icinga-cmd www-data | ||
| + | </code> | ||
| + | |||
| + | |||
| + | ===== Download Icinga and the Plugins ===== | ||
| + | |||
| + | |||
| + | Change to your local source directory i.e. /usr/src | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> cd /usr/src | ||
| + | </code> | ||
| + | |||
| + | |||
| + | Get the current source from the [[http://www.icinga.org/|Icinga Website]]. | ||
| + | |||
| + | |||
| + | Don't forget to download the [[http://www.nagiosplugins.org/|Nagios Plugins]]. | ||
| + | |||
| + | |||
| + | ===== Compile and install Icinga ===== | ||
| + | |||
| + | |||
| + | Extract the Icinga source code tarball (or change directory to the GIT snapshot) | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> cd /usr/src/ | ||
| + | #> tar xvzf icinga-1.8.tar.gz | ||
| + | #> cd icinga-1.8 | ||
| + | </code> | ||
| + | |||
| + | |||
| + | Run the Icinga configure script. You will get help by using the –help flag. | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> ./configure –with-command-group=icinga-cmd | ||
| + | </code> | ||
| + | |||
| + | |||
| + | Compile the Icinga source code. To see available options, only use "make". | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> make all | ||
| + | </code> | ||
| + | |||
| + | |||
| + | Install binaries, init script, sample config files, some eventhandlers, and set permissions on the external command directory. | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> make install | ||
| + | #> make install-init | ||
| + | #> make install-config | ||
| + | #> make install-eventhandlers | ||
| + | #> make install-commandmode | ||
| + | </code> | ||
| + | |||
| + | |||
| + | Don't start Icinga yet - there's still more that needs to be done… | ||
| + | |||
| + | |||
| + | ===== Customize Configuration ===== | ||
| + | |||
| + | |||
| + | Sample configuration files have been installed by using | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> make install-config | ||
| + | </code> | ||
| + | |||
| + | |||
| + | into /usr/local/icinga/etc/. You'll need to make just one change before you proceed… \\ Edit the ///usr/local/icinga/etc/objects/contacts.cfg// config file with your favourite editor and change the email address associated with the //icingaadmin// contact definition to the address you'd like to use for receiving alerts. | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> vi /usr/local/icinga/etc/objects/contacts.cfg | ||
| + | </code> | ||
| + | |||
| + | |||
| + | ===== Configure the Classic Web Interface ===== | ||
| + | |||
| + | |||
| + | \\ Icinga ships with the Classic Web Interface ("the CGIs") which can be installed via | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> make cgis #> make install-cgis #> make install-html | ||
| + | </code> | ||
| + | |||
| + | |||
| + | If you are interested in the new Icinga Web, please refer to [[http://10.12.1.150/icinga/docs/en/icinga-web-scratch.html|Install Icinga Web Interface]]. \\ | ||
| + | Install the Icinga Classic web config file in the Apache conf.d directory. | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> make install-webconf | ||
| + | </code> | ||
| + | |||
| + | |||
| + | Create an //icingaadmin// account for logging into the Icinga classic web interface. If you want to change it later, use the same command. Remember the password you assign to this account - you'll need it later. | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin | ||
| + | </code> | ||
| + | |||
| + | |||
| + | If you want to change it later or want to add another user, use the following command: | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> htpasswd /usr/local/icinga/etc/htpasswd.users <USERNAME> | ||
| + | </code> | ||
| + | |||
| + | |||
| + | Reload/Restart Apache to make the new settings take effect.<nowiki> | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> service httpd restart | ||
| + | </code> | ||
| + | |||
| + | |||
| + | OR | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> /etc/init.d/apache2 reload | ||
| + | </code> | ||
| + | |||
| + | |||
| + | Compile and Install the Nagios Plugins | ||
| + | |||
| + | |||
| + | Extract the Nagios plugins source code tarball. | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> cd /usr/src | ||
| + | #> tar xvzf nagios-plugins-1.4.16.tar.gz | ||
| + | #> cd nagios-plugins-1.4.16 | ||
| + | </code> | ||
| + | |||
| + | |||
| + | Compile and install the plugins by changing install directory to /usr/local/icinga | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> ./configure - -prefix=/usr/local/icinga –with-cgiurl=/icinga/cgi-bin –with-htmurl=/ | ||
| + | icinga- -with-nagios-user=icinga –with-nagios-group=icinga | ||
| + | |||
| + | #> make | ||
| + | #> make install | ||
| + | </code> | ||
| + | |||
| + | |||
| + | ===== Start Icinga ===== | ||
| + | |||
| + | |||
| + | Add Icinga to the list of system services and have it automatically start when the system boots (make sure you have installed the init script before). | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> chkconfig –add icinga | ||
| + | #> chkconfig icinga on | ||
| + | #> update-rc.d icinga defaults | ||
| + | </code> | ||
| + | |||
| + | |||
| + | Verify the sample Icinga configuration files. | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> /usr/local/icinga/bin/icinga -v /usr/local/icinga/etc/icinga.cfg | ||
| + | </code> | ||
| + | |||
| + | |||
| + | Instead of specifying the paths to binary and config file you can issue | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> /etc/init.d/icinga show-errors | ||
| + | </code> | ||
| + | |||
| + | |||
| + | which results in an OK message if everything is fine or several lines which show the location of the error(s). | ||
| + | |||
| + | |||
| + | If there are no errors, start Icinga. | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> service icinga start | ||
| + | </code> | ||
| + | |||
| + | |||
| + | OR | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> /etc/init.d/icinga start | ||
| + | </code> | ||
| + | |||
| + | |||
| + | ===== Login to the Classic Web Interface ===== | ||
| + | |||
| + | |||
| + | You should now be able to access the Icinga classic web interface at the URL below. You'll be prompted for the username ( //icingaadmin// ) and password you specified earlier. [[http://localhost/icinga/|http://localhost/icinga/]] or '' [[http://yourdomain.com/icinga/|http://yourdomain.com/icinga/]] Click on the "Service Detail" navbar link to see details of what's being monitored on your local machine. It will take a few minutes for Icinga to check all the services associated with your machine. | ||
| + | |||
| + | |||
| + | ===== Other Modifications ===== | ||
| + | |||
| + | |||
| + | Make sure your system's firewall rules are configured to allow access to the web server if you want to access the Icinga classic interface remotely. | ||
| + | |||
| + | |||
| + | <code> | ||
| + | #> iptables -A INPUT -p tcp -m tcp –dport 80 -j ACCEPT | ||
| + | </code> | ||
| + | |||
| + | |||
| + | Setting up your mail transfer agent (MTA) like exim, sendmail or postfix to allow Icinga sending notification emails won't be explained here. | ||
| + | |||
| + | |||
| + | Please refer to the [[http://www.nagioswiki.org/|Nagios-Wiki]] for more resources. | ||
| + | |||
| + | |||
| + | ===== You're Done ===== | ||
| + | |||
| + | |||
| + | Congratulations! You successfully installed Icinga. Your journey into monitoring has just begun. | ||