Detailed manual. Installing from source.
Nagios installation.
Nagios can monitor servers and services, and maintains a statistics, alsoyou can see how your server (s) and receive a notification about errors or critical issues via e-mail or SMS.
Create user and give him the password
/usr/sbin/useradd -m nagios
passwd nagios
Create a group nagcmd and give the right to command execution via web interface, add the user nagios and apache to this group
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd apache
Download Nagios source here:
http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.1.tar.gz – the latest version, which I installed
http://www.nagios.org/download/ – If the previous link is not working, look here
Download Nagios Plugins here:
http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz – the latest version, which I installed
http://www.nagios.org/download/ – If the previous link is not working, look here
Unpack the archive with Nagios and install it
tar xzf nagios-3.2.1.tar.gz
cd nagios-3.2.1
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
Change the configuration of Nagios-but unless you know what and where to turn, change at least a mailbox to yours (the line “email”)
vi /usr/local/nagios/etc/objects/contacts.cfg
Make sure that you have created the file /etc/httpd/conf.d/ nagios.conf
If not, create all necessary folders, that is /etc/httpd/conf.d/ and start again
make install-webconf
Then open Apache config, usually /etc/httpd/conf/httpd.conf and add a line:
Include "/nagios.confetc/httpd/conf.d/"
Restart Apache
service httpd restart
If there are no errors and Apache start his fine – go ahead, if not read error_log or contact with me and I will help to you.
Setting user/password to nagios web-interface:
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
So we’ve set username nagiosadmin (if desired, can use another one), and password. Remember this information, and better – write it down.
Next step – Nagios plugins:
tar xzf nagios-plugins-1.4.14.tar.gz
cd nagios-plugins-1.4.14
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
Add Nagios to boot:
chkconfig --add nagios
chkconfig nagios on
Check Nagios configuration for errors:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If there are no errors – continue, otherwise contact me via email or contact form on the website.
Nagios is ready and you can check it via link http://your_domain/nagios/
Known problems after installation:
1. After installation, I have the plugin does not work PING, I get a message that the server is “dead”, although other services are “online” fix this problem is very simple:
chmod u+s /bin/ping
2. When trying to set any changes via the web interface (for example, double-check one or another service) writes an error:
Error: Could not open command file '/usr/local/nagios/var/rw/nagios.cmd' for update!
The permissions on the external command file and/or directory may be incorrect. Read the FAQs on how to setup proper permissions.
An error occurred while attempting to commit your command for processing.
Do the following:
chmod 777 /usr/local/nagios/var/rw/nagios.cmd
After each restart Nagios the problem could happen again …, you can add this command to crond (for example)
3. If there is SuPHP module – a web interface, you can not see in at least after my numerous attempts to raise it did not work, if anyone out – write, would be very thankful
4. If you are installing nagios-plugins at startup and getting an error:
check_http.o: In function `check_http':
/opt/nagios-plugins-1.4.11/plugins/check_http.c:789: undefined reference to `np_net_ssl_read'
/opt/nagios-plugins-1.4.11/plugins/check_http.c:828: undefined reference to `np_net_ssl_cleanup'
/opt/nagios-plugins-1.4.11/plugins/check_http.c:785: undefined reference to `np_net_ssl_write'
/opt/nagios-plugins-1.4.11/plugins/check_http.c:734: undefined reference to `np_net_ssl_init'
/opt/nagios-plugins-1.4.11/plugins/check_http.c:736: undefined reference to `np_net_ssl_check_cert'
/opt/nagios-plugins-1.4.11/plugins/check_http.c:737: undefined reference to `np_net_ssl_cleanup'
collect2: ld returned 1 exit status
make[1]: *** [check_http] Error 1
make[1]: Leaving directory `/opt/nagios-plugins-1.4.11/plugins'
make: *** [install-recursive] Error 1
need to run make distclean and reconfigure.
Setup NRPE and its configuration on the remote server.
NRPE – Nagios can monitor through other remote servers, even those that may be in the local area network (main “monitoring” the server must have access both in LAN and the Internet). How is this useful? You do not need to run through all the web configuration interface or a few servers in FireFox plug-in Nagios Checker, enough to have access only to Web-based master “monitoring” server.
Nagios should be installed on the master server, NRPE and Nagios_plugins on both.
Installing XINETD and OpenSSL
yum install xinetd openssl-devel
Download NRPE:
http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz – the latest version, which I setup
http://www.nagios.org/download/ – if a previous non-working link, look here
Setup NRPE:
tar -xzf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-xinetd
Adding NRPE port to the list of services:
nano /etc/services
add lines:
nrpe 5666/tcp # nrpe
nrpe 5666/udp # nrpe
Restart Nagios and XINETD:
service nagios restart
service xinetd restart
Testing NRPE:
/usr/local/nagios/libexec/check_nrpe -H localhost
should display: