Linux can be a pain to configure. Here is a pretty simple setup procedure specifically for Nagios.
We’ve used VMWare for the main Nagios host so that’s what we’ll concentrate on here. The install on MS HV has some quirks but will work too.
Get the latest ISO for Fedora (CentOS if you’re using Hyper-V) and attach it to the VM you’re going to install into. Memory isn’t much of an issue so 512MB is sufficient (768MB is better, 1024MB is best). 20GB for the virtual hard drive is fine. One CPU is enough.
Do a basic install of Fedora (CentOS). You can choose to do a Web Server or Desktop install. Either will work fine. It is preferred to not install a GUI interface.
After the install configure the static IP address. To do this drop to a console and type setup
This will open a little text based configuration. From in here you’ll set your IP, turn off the firewall and configure the services that start/stop at boot.
The initial setup window looks similar to this:
From here you’re interested in Firewall, Network and System services.
Most settings are pretty obvious. System services however you’ll need to look close. The only major thing is to make sure httpd starts on boot. You want to turn off bluetooth, iptables and ip6tables.
When done, Quit and restart.
From a command line follow these directions:
yum install –y nagios
Remove access restrictions from Nagios apache config file:
It should look similar to this when done:
ScriptAlias /nagios/cgi-bin/ /usr/lib/nagios/cgi-bin/ <Directory /usr/lib/nagios/cgi-bin/> Options ExecCGI AuthType Basic AuthUserFile /etc/nagios/htpasswd.users AuthName "nagios" require valid-user </Directory> Alias /nagios/ /usr/share/nagios/html/ <Directory /usr/share/nagios/html/> Options None AuthType Basic AuthUserFile /etc/nagios/htpasswd.users AuthName "nagios" require valid-user </Directory>
service httpd restart
Setup User Authentication
htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
Enter a password for user nagiosadmin when prompted.
Check Nagios Configuration
The path here assumes you installed via yum under CentOS.
nagios -v /etc/nagios/nagios.cfg
These paths assumes you installed via yum under CentOS.
/etc/nagios/nagios.cfg (Main configuration file) /etc/nagios/objects (location of all files used to configure hosts and services) /usr/lib64/nagios/plugins (where all plugins for testing services should be) /usr/share/nagios/html (root of the nagios web site) /etc/nagios/private (more config files)