Installation and configuration for Nagios/Icinga
0) Prerequisites
- Apache
- PHP
- GCC compiler
- GD development libraries
You can use yum to install these packages by running the following commands (as root):
You also might need these packages if you don’t have them yet:
1) Create Account Information
Become the root user.
Create a new nagios/icinga user account and give it a password.
OR
Create a new nagcmd/icinga-cmd group for allowing external commands to be submitted through the web interface. Add both the nagios/icinga user and the apache user to the group.
OR
2) Add RPMforge repo
Find the appropriate rpmforge-release package for your distribution at http://repoforge.org/use/. For example, you can install it like:
3) Install Nagios/Icinga
OR
4) Customize Configuration
Edit the /etc/nagios/objects/contacts.cfg or /etc/icinga/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.
5) Configure the Web Interface
Create a nagiosadmin/icingaadmin account for logging into the web interface. Remember the password you assign to this account - you’ll need it later.
OR
Restart Apache to make the new settings take effect.
6) Install the Nagios Plugins
For both Nagios and Icinga, you need to install Nagios plugins.
7) Modify SELinux Settings
See if SELinux is in Enforcing mode.
Put SELinux into Permissive mode.
To make this change permanent, you’ll have to modify the settings in /etc/selinux/config and reboot.
8) Start Nagios/Icinga
Add Nagios/Icinga to the list of system services and have it automatically start when the system boots.
OR
Verify the sample Nagios/Icinga configuration files.
OR
If there are no errors, start Nagios.
OR
9) Login to the Web Interface
You should now be able to access the web interface at the URL below. You’ll be prompted for the username (nagiosadmin/icingaadmin) and password you specified earlier.
http://localhost/nagios/ OR http://localhost/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 to check all the services associated with your machine, as the checks are spread out over time.
Monitor Remote Linux Host using Nagios/Icinga
1. Install and configure Nagios Plugins and NRPE on the remote host
1) Create nagios account
2) Install nagios-plugin and nrpe
3) Edit nrpe.cfg to allow your nagios/icinga server and customise configuration
Edit nrpe configuration file:
Find line allowed_hosts . it is a comma separated list. add your nagios server ip to the list
For customised configuration, please see nrpe.cfg.
4) IPTables
If you are running iptables or a firewall between the server and host, make sure that the host is allowing port 5666 from the server’s IP address.
5) Start nrpe service on system start up
6) Start nrpe service
2. Configure on the monitoring server to monitor remote host
1) Install nrpe
2) Check check_nrpe on the monitoring server
Verify whether monitoring server can talk to the remotehost. For example:
3) Create host and service definition for remotehost
Create a new configuration file /etc/nagios/objects/remotehost.cfg OR /etc/icinga/objects/remotehost.cfg to define the host and service definition for this particular remotehost.
For more details, please see scilinux2.cfg.
4) Restart the nagios/Icinga service
Examples of customising configuration
1. Check disk space on local host
2. Check Apache on local host
3. Check how many Apache processes are running on local host
1) Add check_daemons in /etc/nagios/objects/commands.cfg OR /etc/icinga/objects/commands.cfg
2) Add service in /etc/nagios/objects/localhost.cfg OR /etc/icinga/objects/localhost.cfg
4. Check PostgreSQL on remote host
1) Add check_nrpe in /etc/nagios/objects/commands.cfg OR /etc/icinga/objects/commands.cfg on monitoring server
To check remote host, check_nrpe is essential.
Note: Make sure check_nrpe is in /usr/lib64/nagios/plugins($USER1$)
2) Add check_pgsql in /etc/nagios/nrpe.cfg on remote host
3) Check check_pgsql on monitoring server
If you see the error like:
Add user ‘nrpe’ on remote host.
4) Add service in /etc/nagios/objects/scilinux2.cfg OR /etc/icinga/objects/scilinux2.cfg
Note: All plugins in /usr/lib64/nagios/plugins, run them with -h for help. Fo example:
References
- http://nagios.sourceforge.net/docs/3_0/quickstart-fedora.html
- http://docs.icinga.org/latest/en/quickstart-icinga.html
- http://blog.roozbehk.com/post/25059446631/nrpe-monitoring-linux-remote-hosts-nagios
- http://www.thegeekstuff.com/2008/06/how-to-monitor-remote-linux-host-using-nagios-30/
- http://wiki.tyk.nu/index.php?title=Check_pgsql_-_NRPE_PostgreSQL_check
Twitter · Facebook
Linkedin · Delicious
GitHub · Douban · Xbox Live