cacti + npc + nagios 설치
1 2 | #yum install -y mysql-server.x86_64 mysql-devel.x86_64 php-mysql.x86_64 php-devel.x86_64 php.x86_64 php-snmp.x86_64 httpd.x86_64 net-snmp.x86_64 net-snmp-devel.x86_64 net-snmp-utils.x86_64 rrdtool.x86_64 rrdtool-devel.x86_64 ruby-rrdtool.x86_64 gcc.x86_64 make.x86_64 wget.x86_64 | cs |
2. cacti install
1 2 3 | # cd /usr/local/src/ ; wget http://www.cacti.net/downloads/cacti-0.8.8a.tar.gz # tar -xvf /usr/local/src/ cacti-0.8.8a.tar.gz | cs |
3. mysql root password set
1 2 3 4 5 6 7 8 9 | # service mysqld start ; chkconfig mysqld on # mysqladmin -u root password ’mypasswd' # mysql_secure_installation Set root password? [Y/n] n Remove anonymous users? [Y/n] Y Disallow root login remotely? [Y/n] Y Remove test database and access to it? [Y/n] Y Reload privilege tables now? [Y/n] Y | cs |
4. cacti DATABASE seting
1 2 | # sed -i -e '1i USE cacti;’ /usr/local/src/cacti-0.8.8a/cacti.sql ; sed -i -e '1i CREATE DATABASE cacti;’ /usr/local/src/cacti-0.8.8a/cacti.sql ; echo "CREATE USER cacti;" >> /usr/local/src/cacti-0.8.8a/cacti.sql ; echo "GRANT ALL ON cacti.* TO 'cacti'@'localhost' IDENTIFIED BY ’mypasswd';" >> /usr/local/src/cacti-0.8.8a/cacti.sql ; mysql -u root -p < /usr/local/src/cacti-0.8.8a/cacti.sql | cs |
5 “cacti” user create
1 2 | # useradd -s /sbin/nologin -M -N -G apache cacti | cs |
7. web directory & permission
1 2 | # mkdir -p /var/www/html/cacti ; cp -R /usr/local/src/cacti-0.8.8a/. /var/www/html/cacti ; chown -R cacti:apache /var/www/html/cacti | cs |
8. cacti “config.php” set ( /var/www/html/cacti/include/config.php)
1 2 3 4 5 | # vi +/database_username /var/www/html/cacti/include/config.php $database_username = "cacti"; $database_password = “mypasswd"; | cs |
9. snmpd start
1 2 | # service snmpd start ; chkconfig snmpd on | cs |
10. httpd confg set ( /etc/httpd/conf.d/php.conf )
1 2 3 4 | # vi /etc/httpd/conf.d/php.conf AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps | cs |
11. apache restart
1 2 | # service httpd start ; chkconfig httpd on | cs |
Log into http://localhost/cacti
12. nagios download
1 2 | # cd /usr/local/src/ ; wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.4.tar.gz ; tar -xvf nagios-3.4.4.tar.gz | cs |
13. user & group create
1 2 | # useradd -s /bin/bash nagios ; groupadd nagcmd ; usermod -G nagcmd nagios ; usermod -G nagcmd apache ; usermod -G nagcmd cacti | cs |
14. nagios - configure
1 2 | # cd /usr/local/src/nagios/ ; ./configure --with-command-group=nagcmd ; make all ; make install ; make install-init ; make install-config ; make install-commandmode ; make install-webconf | cs |
15. nagios plugin download
1 2 | # cd /usr/local/src/ ; wget http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.16/nagios-plugins-1.4.16.tar.gz ; tar -xvf nagios-plugins-1.4.16.tar.gz | cs |
16. nagios plugin install
1 2 | # cd /usr/local/src/nagios-plugins-1.4.16 ; ./configure --with-nagios-user=nagios --with-nagios-group=nagios ; make ; make install | cs |
17. nrpe download
1 2 | # cd /usr/local/src/ ; wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.13.tar.gz ; tar -xvf nrpe-2.13.tar.gz ; cd /root/nrpe-2.13 ; ./configure ; make ; make install | cs |
18. nrpe command check ( /usr/local/nagios/etc/objects/commands.cfg )
1 2 3 4 5 6 7 | # vi /usr/local/nagios/etc/objects/commands.cfg #NRPE define command{ command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ } | cs |
19. nagios start
1 2 | # /etc/rc.d/init.d/nagios start | cs |
20. admin account create “nagiosadmin"
1 2 3 4 | # htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin New password: Re-type new password: | cs |
21. "ndoutils-1.4b7" download & install
1 2 | # cd /usr/local/src/ ; wget http://sourceforge.net/projects/nagios/files/ndoutils-1.x/ndoutils-1.4b7/ndoutils-1.4b7.tar.gz ; tar -xvf ndoutils-1.4b7.tar.gz ; cd /usr/local/src/ndoutils-1.4b7 ; ./configure --disable-pgsql --with-mysql-lib=/usr/lib64/mysql --with-ndo2db-user=nagios --with-ndo2db-group=nagios ; make | cs |
1 2 | # cd /root ; tar -xvf npc-2.0.4.tar.gz ; cp -R /root/npc /var/www/html/cacti/plugins | cs |
* 위 사이트말고 검색해서 다운로드 받을것, (에러발생 함)
23 cp plugin
1 2 | # cp /usr/local/src/ndoutils-1.4b7/src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o ; cp /usr/local/src/ndoutils-1.4b7/config/ndomod.cfg /usr/local/nagios/etc/ndomod.cfg ; cp /usr/local/src/ndoutils-1.4b7/src/ndo2db-3x /usr/local/nagios/bin/ndo2db ; cp /usr/local/src/ndoutils-1.4b7/config/ndo2db.cfg /usr/local/nagios/etc/ndo2db.cfg | cs |
24 config ( /usr/local/nagios/etc/ndomod.cfg )
1 2 3 4 | # vi +/output=127.0.0.1 /usr/local/nagios/etc/ndomod.cfg output=127.0.0.1 #output=/usr/local/nagios/var/ndo.sock | cs |
25-1 config ( /usr/local/nagios/etc/ndomod.cfg )
1 2 3 4 | # vi +/output_type=tcpsocket /usr/local/nagios/etc/ndomod.cfg output_type=tcpsocket #output_type=unixsocket | cs |
25-2 config ( /usr/local/nagios/etc/ndo2db.cfg )
1 2 3 4 | # vi +/socket_type=unix /usr/local/nagios/etc/ndo2db.cfg #socket_type=unix socket_type=tcp | cs |
26. config nagios ( ndomod.cfg & nagios.cfg )
1 2 | # echo "broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg" >> /usr/local/nagios/etc/nagios.cfg ; sed -i 's/process_performance_data=0/process_performance_data=1/g' /usr/local/nagios/etc/nagios.cfg | cs |
27.
1 2 | # sed -i 's/db_host=localhost/db_host=127.0.0.1/g' /usr/local/nagios/etc/ndo2db.cfg ; sed -i 's/db_name=nagios/db_name=cacti/g' /usr/local/nagios/etc/ndo2db.cfg ; sed -i 's/db_prefix=nagios_/db_prefix=npc_/g' /usr/local/nagios/etc/ndo2db.cfg ; sed -i 's/db_user=ndouser/db_user=cacti/g' /usr/local/nagios/etc/ndo2db.cfg ; sed -i 's/db_pass=ndopassword/db_pass=mypasswd/g' /usr/local/nagios/etc/ndo2db.cfg ; chmod go+r /usr/local/nagios/etc/ndomod.cfg ; chmod go+r /usr/local/nagios/etc/ndo2db.cfg | cs |
28 download cacti plugin
1 2 | # cd /var/www/html/cacti/plugins ; wget http://docs.cacti.net/_media/plugin:settings-v0.7-1.tgz ; mv plugin\:settings-v0.7-1.tgz settings-v0.7-1.tgz ; tar -xvf settings-v0.7-1.tgz ; cd /var/www/html/cacti/plugins ; wget http://docs.cacti.net/_media/plugin:monitor-v1.2-1.tgz ; mv plugin\:monitor-v1.2-1.tgz monitor-v1.2-1.tgz ; tar -xvf monitor-v1.2-1.tgz | cs |
Nagios URL: http://localhost/nagios
29 “nd2db" database create
1 2 | # cd /usr/local/src/ndoutils-1.4b7/db/ ; ./installdb -u root -p “mypasswd" -h localhost -d cacti | cs |
30. “ndo2db" start script setup
1 2 3 4 5 6 | # vi /etc/init.d/ndo2db Copy Contents of: ndo2db script (Courtesy of Gaëtan from http://www.itpointofview.com/?p=191) # chmod gou+x /etc/init.d/ndo2db # /etc/init.d/ndo2db start # chkconfig ndo2db on | cs |
31. “nagios” apache group set
1 2 | #usermod -a -G nagios apache | cs |
32. permission set
1 2 | # chown -R nagios:apache /var/www/html/cacti/plugins ; chown -R nagios:nagios /usr/local/nagios | cs |
33. nagios restart
1 2 | # chkconfig nagios on ; service nagios restart | cs |