Install and configure Nagios on Fedora
1. open ports:
sudo -l
iptables -I INPUT -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I OUTPUT -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
iptables -I INPUT -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I OUTPUT -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT
(or disable iptables)
2. add repositopy DAG
3. yum install rddtool-devel lobjpeg-devel gd gd devel httpd php gcc perl-devel
4. disable selinux
5. useradd -m nagios
6. passwd nagios
7. groupadd nagcmd
8. usermod -a -G nagcmd nagios apache
9. yum install wget
10. wget http://sourceforge.net/projects/nagios/files/nagios-4.x/nagios-4.0.8/nagios-4.0.8.tar.gz
11. wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
12.
Run the Nagios configure script, passing the name of the group you created earlier like so:
./configure --with-command-group=nagcmd
Compile the Nagios source code.
make all
Install binaries, init script, sample config files and set permissions on the external command directory.
make install make install-init make install-config make install-commandmode
13.
Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you'd like to use for receiving alerts.
vi /usr/local/nagios/etc/objects/contacts.cfg
14. Configure the Web Interface
Install the Nagios web config file in the Apache conf.d directory.
make install-webconf
Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account - you'll need it later.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Restart Apache to make the new settings take effect.
service httpd restart
15. Compile and Install the Nagios Plugins
Extract the Nagios plugins source code tarball.
cd ~/downloads tar xzf nagios-plugins-2.0.3.tar.gz cd nagios-plugins-2.0.3
Compile and install the plugins.
./configure --with-nagios-user=nagios --with-nagios-group=nagios make make install
16. Start Nagios
Add Nagios to the list of system services and have it automatically start when the system boots.
chkconfig --add nagios chkconfig nagios on
Verify the sample Nagios configuration files.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If there are no errors, start Nagios.
service nagios start
17. stop firewall
chkconfig firewalld off
reboot
18. Adding ICONS to Nagios Map:
add png icon to /usr/local/nagios/share/images/icons/
The icons must be 40 X 40 pixels as this is what Nagios uses
to grub icons:
http://blog.shvetsov.com/2010/09/convert-png-to-gd2-for-nagios-status.html
add to /usr/local/nagios/etc/objects/windows.cfg
define host
{
icon_image windowsserver.png
statusmap_image windowsserver.png
}