| Languages: |
English • Deutsch |
Nagios from Source (Fedora)
|
These Best Practice guide are intended to provide you with simple instructions on how to install Nagios from source (code) on Fedora and have it monitoring your local machine within 20 minutes.
No advanced installation options are discussed here - just the basics that will work for 95% of users who want to get started.
The advanced installations are discussed on another Best Practice Guide. The basic Nagios installation is always this Best Practice.
[root@nag-server ~]# yum install httpd glib2-devel gcc make automake autoconf gd gd-devel
[root@nag-server ~]# groupadd -g 9000 nagios [root@nag-server ~]# groupadd -g 9001 nagcmd [root@nag-server ~]# useradd -u 9000 -g nagios -G nagcmd -d /usr/local/nagios -c "Nagios Admin" nagios
[root@nag-server ~]# vi /etc/sysconfig/selinux # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted
[root@nag-server ~]# cd /usr/local/src [root@nag-server src]# wget http://downloads.sourceforge.net/nagios/nagios-3.0.3.tar.gz [root@nag-server src]# wget http://downloads.sourceforge.net/nagiosplug/nagios-plugins-1.4.12.tar.gz
[root@nag-server src]# tar -xvzf nagios-3.0.3.tar.gz
[root@nag-server src]# cd nagios-3.0.3
[root@nag-server nagios-3.0.3]# ./configure --enable-nanosleep --with-command-group=nagcmd
...
...
...
*** Configuration summary for nagios 3.0.3 06-25-2008 ***:
General Options:
-------------------------
Nagios executable: nagios
Nagios user/group: nagios,nagios
Command user/group: nagios,nagcmd
Embedded Perl: no
Event Broker: yes
Install ${prefix}: /usr/local/nagios
Lock file: ${prefix}/var/nagios.lock
Check result directory: ${prefix}/var/spool/checkresults
Init directory: /etc/rc.d/init.d
Apache conf.d directory: /etc/httpd/conf.d
Mail program: /bin/mail
Host OS: linux-gnu
Web Interface Options:
------------------------
HTML URL: http://localhost/nagios/
CGI URL: http://localhost/nagios/cgi-bin/
Traceroute (used by WAP): /bin/traceroute
Review the options above for accuracy. If they look okay,
type 'make all' to compile the main program and CGIs.
[root@nag-server nagios-3.0.3]#
[root@nag-server nagios-3.0.3]# make all
[root@nag-server nagios-3.0.3]# make install [root@nag-server nagios-3.0.3]# make install-init [root@nag-server nagios-3.0.3]# make install-commandmode [root@nag-server nagios-3.0.3]# make install-config
[root@nag-server ~]# ls -ld /usr/local/nagios/ drwx------ 9 nagios nagios 4096 2008-08-29 15:07 /usr/local/nagios/ [root@nag-server ~]# [root@nag-server ~]# chmod 755 /usr/local/nagios/ [root@nag-server ~]# [root@nag-server ~]# ls -ld /usr/local/nagios/ drwxr-xr-x 9 nagios nagios 4096 2008-08-29 15:07 /usr/local/nagios/ [root@nag-server ~]#
[root@nag-server nagios-3.0.3]# cp /usr/local/src/nagios-3.0.3/sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf
[root@nag-server nagios-3.0.3]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin New password: Re-type new password: Adding password for user nagiosadmin [root@nag-server nagios-3.0.3]#
[root@nag-server nagios-3.0.3]# grep -R "^User" /etc/httpd/conf* /etc/httpd/conf/httpd.conf:User apache [root@nag-server nagios-3.0.3]# [root@nag-server nagios-3.0.3]# usermod -G nagcmd apache
[root@nag-server nagios-3.0.3]# /etc/init.d/httpd restart
[root@nag-server nagios-3.0.3]# chkconfig httpd on
[root@nag-server src]# yum install openssl-devel mysql-devel mysql-server mysql openldap-devel net-snmp-libs net-snmp-devel net-snmp net-snmp-perl net-snmp-utils
[root@nag-server src]# tar xvzf nagios-plugins-1.4.12.tar.gz
[root@nag-server src]# cd nagios-plugins-1.4.12
[root@nag-server nagios-plugins-1.4.12]# ./configure --with-ipv6
...
...
...
config.status: creating po/Makefile
--with-apt-get-command:
--with-ping6-command: /bin/ping6 -n -U -w %d -c %d %s
--with-ping-command: /bin/ping -n -U -w %d -c %d %s
--with-ipv6: yes
--with-mysql: /usr/bin/mysql_config
--with-openssl: yes
--with-gnutls: no
--enable-extra-opts: no
--with-perl: /usr/bin/perl
--enable-perl-modules: no
--with-cgiurl: /nagios/cgi-bin
--with-trusted-path: /bin:/sbin:/usr/bin:/usr/sbin
[root@nag-server nagios-plugins-1.4.12]#
[root@nag-server nagios-plugins-1.4.12]# make
[root@nag-server nagios-plugins-1.4.12]# make install
[root@nag-server ~]# service nagios start [root@nag-server ~]# chkconfig --add nagios [root@nag-server ~]# chkconfig nagios on
You should now be able to access the Nagios web interface at the URL below. You'll be prompted for the username (nagiosadmin) and password you specified earlier.
http://localhost/nagios/