好久以前的实验了,可能不完整,不做解释。
[root@test nagios-cn-3.0.1.1]# ./configure --with-command-group=nagcmd --with-httpd-conf=/usr/local/apache/conf/ --with-gd-lib=/usr/lib --with-gd-inc=/usr/include/
[root@test nagios-cn-3.0.1.1]# make all [root@test nagios-cn-3.0.1.1]# make install [root@test nagios-cn-3.0.1.1]# make install-init [root@test nagios-cn-3.0.1.1]# make install-commandmode [root@test nagios-cn-3.0.1.1]# make install-config [root@test nagios-cn-3.0.1.1]# /usr/local/apache/bin/htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin New password: Re-type new password: Adding password for user nagiosadmin [root@test nagios-cn-3.0.1.1]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg [root@test /]# cd nagios-plugins-1.4.11 [root@test nagios-plugins-1.4.11]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-redhat-pthread-workaround [root@test etc]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg Nagios 3.0.1 Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org) Last Modified: 04-01-2008 License: GPL Reading configuration data... Running pre-flight check on configuration data... Checking services... Checked 9 services. Checking hosts... Checked 2 hosts. Checking host groups... Checked 1 host groups. Checking service groups... Checked 0 service groups. Checking contacts... Checked 1 contacts. Checking contact groups... Checked 1 contact groups. Checking service escalations... Checked 0 service escalations. Checking service dependencies... Checked 0 service dependencies. Checking host escalations... Checked 0 host escalations. Checking host dependencies... Checked 0 host dependencies. Checking commands... Checked 24 commands. Checking time periods... Checked 5 time periods. Checking for circular paths between hosts... Checking for circular host and service dependencies... Checking global event handlers... Checking obsessive compulsive processor commands... Checking misc settings... Total Warnings: 0 Total Errors: 0 Things look okay - No serious problems were detected during the pre-flight check [root@test etc]# /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg [root@test etc]# ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 07:44 ? 00:00:05 init root 2 1 0 07:44 ? 00:00:00 [keventd] root 3 1 0 07:44 ? 00:00:00 [kapmd] root 4 1 0 07:44 ? 00:00:00 [ksoftirqd_CPU0] root 9 1 0 07:44 ? 00:00:00 [bdflush] root 5 1 0 07:44 ? 00:00:00 [kswapd] root 6 1 0 07:44 ? 00:00:00 [kscand/DMA] root 7 1 0 07:44 ? 00:00:00 [kscand/Normal] root 8 1 0 07:44 ? 00:00:00 [kscand/HighMem] root 10 1 0 07:44 ? 00:00:00 [kupdated] root 11 1 0 07:44 ? 00:00:00 [mdrecoveryd] root 19 1 0 07:44 ? 00:00:00 [kjournald] root 77 1 0 07:44 ? 00:00:00 [khubd] root 1230 1 0 07:44 ? 00:00:00 [kjournald] root 1231 1 0 07:44 ? 00:00:00 [kjournald] root 1500 1 0 07:44 ? 00:00:00 syslogd -m 0 root 1504 1 0 07:44 ? 00:00:00 klogd -x root 1513 1 0 07:44 ? 00:00:00 /usr/sbin/sshd root 1524 1 0 07:44 ? 00:00:00 xinetd -stayalive -reuse -pidfile /var/run/xinetd.pid root 1534 1 0 07:44 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/test root 1543 1 0 07:44 tty1 00:00:00 /sbin/mingetty tty1 root 1544 1 0 07:44 tty2 00:00:00 /sbin/mingetty tty2 root 1545 1 0 07:44 tty3 00:00:00 /sbin/mingetty tty3 root 1546 1 0 07:44 tty4 00:00:00 /sbin/mingetty tty4 root 1547 1 0 07:44 tty5 00:00:00 /sbin/mingetty tty5 root 1548 1 0 07:44 tty6 00:00:00 /sbin/mingetty tty6 mysql 1563 1534 0 07:44 ? 00:00:00 [mysqld] mysql 1564 1563 0 07:44 ? 00:00:00 [mysqld] mysql 1565 1564 0 07:44 ? 00:00:00 [mysqld] mysql 1566 1564 0 07:44 ? 00:00:00 [mysqld] mysql 1567 1564 0 07:44 ? 00:00:00 [mysqld] mysql 1568 1564 0 07:44 ? 00:00:00 [mysqld] mysql 1569 1564 0 07:44 ? 00:00:00 [mysqld] mysql 1570 1564 0 07:44 ? 00:00:00 [mysqld] mysql 1571 1564 0 07:44 ? 00:00:00 [mysqld] mysql 1572 1564 0 07:44 ? 00:00:00 [mysqld] root 1573 1513 0 07:48 ? 00:00:00 /usr/sbin/sshd wang 1575 1573 0 07:48 ? 00:00:03 [sshd] wang 1576 1575 0 07:48 pts/0 00:00:00 -bash root 1605 1576 0 07:48 pts/0 00:00:00 [su] root 1606 1605 0 07:48 pts/0 00:00:01 bash root 1643 1 0 07:49 ? 00:00:00 /usr/local/apache/bin/httpd -k start nobody 1644 1643 0 07:49 ? 00:00:00 [httpd] nobody 1645 1643 0 07:49 ? 00:00:00 [httpd] nobody 1646 1643 0 07:49 ? 00:00:00 [httpd] nobody 1647 1643 0 07:49 ? 00:00:00 [httpd] nobody 1648 1643 0 07:49 ? 00:00:00 [httpd] nagios 1676 1 0 07:49 ? 00:00:00 [nagios] root 1901 1513 0 07:59 ? 00:00:00 /usr/sbin/sshd wang 1903 1901 0 07:59 ? 00:00:00 [sshd] wang 1904 1903 0 07:59 pts/1 00:00:00 -bash root 1933 1904 0 07:59 pts/1 00:00:00 [su] root 1934 1933 0 07:59 pts/1 00:00:00 bash nagios 20498 1 0 08:14 ? 00:00:00 [nagios] nagios 20501 1 0 08:14 ? 00:00:00 [nagios] nagios 20502 20501 0 08:14 ? 00:00:00 /usr/local/nagios/libexec/check_ping -H 127.0.0.1 -w 3000.0,80% -c 5000.0,100% -p 5 nagios 20503 20502 0 08:14 ? 00:00:00 [ping] root 20504 1606 0 08:14 pts/0 00:00:00 ps -ef [root@test etc]# /usr/local/nagios/bin/nagios -s /usr/local/nagios/etc/nagios.cfg Nagios 3.0.1 Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org) Last Modified: 04-01-2008 License: GPL Timing information on object configuration processing is listed below. You can use this information to see if precaching your object configuration would be useful. Object Config Source: Config files (uncached) OBJECT CONFIG PROCESSING TIMES (* = Potential for precache savings with -u option) ---------------------------------- Read: 0.006746 sec Resolve: 0.000793 sec * Recomb Contactgroups: 0.000034 sec * Recomb Hostgroups: 0.000035 sec * Dup Services: 0.000036 sec * Recomb Servicegroups: 0.000004 sec * Duplicate: 0.000003 sec * Inherit: 0.000007 sec * Recomb Contacts: 0.000003 sec * Sort: 0.000016 sec * Register: 0.000352 sec Free: 0.000062 sec ============ TOTAL: 0.008104 sec * = 0.000944 sec (11.65%) estimated savings Timing information on configuration verification is listed below. CONFIG VERIFICATION TIMES (* = Potential for speedup with -x option) ---------------------------------- Object Relationships: 0.000130 sec Circular Paths: 0.000004 sec * Misc: 0.000310 sec ============ TOTAL: 0.000444 sec * = 0.000004 sec (0.9%) estimated savings EVENT SCHEDULING TIMES ------------------------------------- Get service info: 0.000075 sec Get host info info: 0.000008 sec Get service params: 0.000016 sec Schedule service times: 0.000104 sec Schedule service events: 0.000046 sec Get host params: 0.000004 sec Schedule host times: 0.000025 sec Schedule host events: 0.000009 sec ============ TOTAL: 0.000287 sec Projected scheduling information for host and service checks is listed below. This information assumes that you are going to start running Nagios with your current config files. HOST SCHEDULING INFORMATION --------------------------- Total hosts: 2 Total scheduled hosts: 2 Host inter-check delay method: SMART Average host check interval: 300.00 sec Host inter-check delay: 150.00 sec Max host check spread: 30 min First scheduled check: Mon Oct 13 08:15:33 2008 Last scheduled check: Mon Oct 13 08:18:03 2008 SERVICE SCHEDULING INFORMATION ------------------------------- Total services: 9 Total scheduled services: 9 Service inter-check delay method: SMART Average service check interval: 300.00 sec Inter-check delay: 33.33 sec Interleave factor method: SMART Average services per host: 4.50 Service interleave factor: 5 Max service check spread: 60 min First scheduled check: Mon Oct 13 08:16:39 2008 Last scheduled check: Mon Oct 13 08:21:06 2008 CHECK PROCESSING INFORMATION ---------------------------- Check result reaper interval: 10 sec Max concurrent service checks: Unlimited PERFORMANCE SUGGESTIONS ----------------------- I have no suggestions - things look okay. [root@test etc]# /usr/local/nagios/bin/nagios -sp /usr/local/nagios/etc/nagios.cfg Nagios 3.0.1 Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org) Last Modified: 04-01-2008 License: GPL Timing information on object configuration processing is listed below. You can use this information to see if precaching your object configuration would be useful. Object Config Source: Config files (uncached) OBJECT CONFIG PROCESSING TIMES (* = Potential for precache savings with -u option) ---------------------------------- Read: 0.002956 sec Resolve: 0.000061 sec * Recomb Contactgroups: 0.000017 sec * Recomb Hostgroups: 0.000018 sec * Dup Services: 0.000017 sec * Recomb Servicegroups: 0.000002 sec * Duplicate: 0.000002 sec * Inherit: 0.000003 sec * Recomb Contacts: 0.000002 sec * Sort: 0.000008 sec * Register: 0.000188 sec Free: 0.000028 sec ============ TOTAL: 0.003970 sec * = 0.000798 sec (20.10%) estimated savings Timing information on configuration verification is listed below. CONFIG VERIFICATION TIMES (* = Potential for speedup with -x option) ---------------------------------- Object Relationships: 0.000068 sec Circular Paths: 0.000002 sec * Misc: 0.000136 sec ============ TOTAL: 0.000206 sec * = 0.000002 sec (1.0%) estimated savings EVENT SCHEDULING TIMES ------------------------------------- Get service info: 0.000040 sec Get host info info: 0.000005 sec Get service params: 0.000008 sec Schedule service times: 0.000049 sec Schedule service events: 0.000023 sec Get host params: 0.000002 sec Schedule host times: 0.000013 sec Schedule host events: 0.000005 sec ============ TOTAL: 0.000145 sec Projected scheduling information for host and service checks is listed below. This information assumes that you are going to start running Nagios with your current config files. HOST SCHEDULING INFORMATION --------------------------- Total hosts: 2 Total scheduled hosts: 2 Host inter-check delay method: SMART Average host check interval: 300.00 sec Host inter-check delay: 150.00 sec Max host check spread: 30 min First scheduled check: Mon Oct 13 08:16:01 2008 Last scheduled check: Mon Oct 13 08:18:31 2008 SERVICE SCHEDULING INFORMATION ------------------------------- Total services: 9 Total scheduled services: 9 Service inter-check delay method: SMART Average service check interval: 300.00 sec Inter-check delay: 33.33 sec Interleave factor method: SMART Average services per host: 4.50 Service interleave factor: 5 Max service check spread: 60 min First scheduled check: Mon Oct 13 08:17:07 2008 Last scheduled check: Mon Oct 13 08:21:34 2008 CHECK PROCESSING INFORMATION ---------------------------- Check result reaper interval: 10 sec Max concurrent service checks: Unlimited PERFORMANCE SUGGESTIONS ----------------------- I have no suggestions - things look okay. OBJECT PRECACHING ----------------- Object config files were precached. [root@test etc]# ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 07:44 ? 00:00:05 init root 2 1 0 07:44 ? 00:00:00 [keventd] root 3 1 0 07:44 ? 00:00:00 [kapmd] root 4 1 0 07:44 ? 00:00:00 [ksoftirqd_CPU0] root 9 1 0 07:44 ? 00:00:00 [bdflush] root 5 1 0 07:44 ? 00:00:00 [kswapd] root 6 1 0 07:44 ? 00:00:00 [kscand/DMA] root 7 1 0 07:44 ? 00:00:00 [kscand/Normal] root 8 1 0 07:44 ? 00:00:00 [kscand/HighMem] root 10 1 0 07:44 ? 00:00:00 [kupdated] root 11 1 0 07:44 ? 00:00:00 [mdrecoveryd] root 19 1 0 07:44 ? 00:00:00 [kjournald] root 77 1 0 07:44 ? 00:00:00 [khubd] root 1230 1 0 07:44 ? 00:00:00 [kjournald] root 1231 1 0 07:44 ? 00:00:00 [kjournald] root 1500 1 0 07:44 ? 00:00:00 syslogd -m 0 root 1504 1 0 07:44 ? 00:00:00 klogd -x root 1513 1 0 07:44 ? 00:00:00 /usr/sbin/sshd root 1524 1 0 07:44 ? 00:00:00 xinetd -stayalive -reuse -pidfile /var/run/xinetd.pid root 1534 1 0 07:44 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/test root 1543 1 0 07:44 tty1 00:00:00 /sbin/mingetty tty1 root 1544 1 0 07:44 tty2 00:00:00 /sbin/mingetty tty2 root 1545 1 0 07:44 tty3 00:00:00 /sbin/mingetty tty3 root 1546 1 0 07:44 tty4 00:00:00 /sbin/mingetty tty4 root 1547 1 0 07:44 tty5 00:00:00 /sbin/mingetty tty5 root 1548 1 0 07:44 tty6 00:00:00 /sbin/mingetty tty6 mysql 1563 1534 0 07:44 ? 00:00:00 [mysqld] mysql 1564 1563 0 07:44 ? 00:00:00 [mysqld] mysql 1565 1564 0 07:44 ? 00:00:00 [mysqld] mysql 1566 1564 0 07:44 ? 00:00:00 [mysqld] mysql 1567 1564 0 07:44 ? 00:00:00 [mysqld] mysql 1568 1564 0 07:44 ? 00:00:00 [mysqld] mysql 1569 1564 0 07:44 ? 00:00:00 [mysqld] mysql 1570 1564 0 07:44 ? 00:00:00 [mysqld] mysql 1571 1564 0 07:44 ? 00:00:00 [mysqld] mysql 1572 1564 0 07:44 ? 00:00:00 [mysqld] root 1573 1513 0 07:48 ? 00:00:00 /usr/sbin/sshd wang 1575 1573 0 07:48 ? 00:00:04 [sshd] wang 1576 1575 0 07:48 pts/0 00:00:00 -bash root 1605 1576 0 07:48 pts/0 00:00:00 [su] root 1606 1605 0 07:48 pts/0 00:00:01 bash root 1643 1 0 07:49 ? 00:00:00 /usr/local/apache/bin/httpd -k start nobody 1644 1643 0 07:49 ? 00:00:00 [httpd] nobody 1645 1643 0 07:49 ? 00:00:00 [httpd] nobody 1646 1643 0 07:49 ? 00:00:00 [httpd] nobody 1647 1643 0 07:49 ? 00:00:00 [httpd] nobody 1648 1643 0 07:49 ? 00:00:00 [httpd] nagios 1676 1 0 07:49 ? 00:00:00 [nagios] root 1901 1513 0 07:59 ? 00:00:00 /usr/sbin/sshd wang 1903 1901 0 07:59 ? 00:00:00 [sshd] wang 1904 1903 0 07:59 pts/1 00:00:00 -bash root 1933 1904 0 07:59 pts/1 00:00:00 [su] root 1934 1933 0 07:59 pts/1 00:00:00 bash nagios 20498 1 0 08:14 ? 00:00:00 [nagios] root 20535 1606 0 08:16 pts/0 00:00:00 ps -ef [root@test conf]# vim httpd.conf Alias /phpmyadmin /phpmyadmin Alias /cacti/ /usr/local/cacti/ ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin <Directory "/usr/local/nagios/sbin"> Options ExecCGI AllowOverride None Order allow,deny Allow from all AuthName "Nagios Access" AuthType Basic AuthUserFile /usr/local/nagios/etc/htpasswd.users Require valid-user </Directory> Alias /nagios /usr/local/nagios/share <Directory "/usr/local/nagios/share"> Options None AllowOverride None Order allow,deny Allow from all AuthName "Nagios Access" AuthType Basic AuthUserFile /usr/local/nagios/etc/htpasswd.users Require valid-user # # Directives to allow use of AWStats as a CGI
客户端部分
[root@localhost opt]# cd nrpe-2.12
[root@localhost nrpe-2.12]# useradd nagios -g nagios -d /usr/local/nagios/ -s /sbin/nologin [root@localhost nrpe-2.12]# mkdir -p /usr/local/nagios/etc [root@localhost nrpe-2.12]# mkdir /usr/local/nagios/bin [root@localhost nrpe-2.12]# mkdir /usr/local/nagios/libexec [root@localhost nrpe-2.12]# chown -R nagios.nagios /usr/local/nagios/etc/ [root@localhost nrpe-2.12]# ./configure [root@localhost nrpe-2.12]# make all [root@localhost nrpe-2.12]# make install-plugin [root@localhost nrpe-2.12]# cp ./sample-config/nrpe.cfg /usr/local/nagios/etc/ [root@localhost nrpe-2.12]# cp src/nrpe /usr/local/nagios/bin/ [root@localhost nrpe-2.12]# cd .. [root@localhost opt]# tar xzvf nagios-plugins-1.4.13.tar.gz [root@localhost opt]# cd nagios-plugins-1.4.13 [root@localhost nagios-plugins-1.4.13]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-redhat-pthread-workaround [root@localhost nagios-plugins-1.4.13]# make [root@localhost nagios-plugins-1.4.13]# make install [root@localhost nagios-plugins-1.4.13]# /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d [root@localhost nagios-plugins-1.4.13]# netstat -anpt |grep 5566 [root@localhost nagios-plugins-1.4.13]# netstat -anpt |grep 5666 tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN 19690/nrpe