System/OS
2014.01.17 10:42
[linux] CentOS 6.x Cati 설치 (yum)
조회 수 49011 댓글 0
Hi Guys,
I have written a Cacti Installation and basic setup guide for CentOS 6 64bit.
Could you check it over and let me know if I have missed anything or if I can improve my method of installing and setting up Cacti.
I should clarify things a little by announcing I am a beginner with Cacti and Linux, I have primarily made the guide as a learning experience for myself. If it helps anyone else in the future, that's just awesome!
I have used the website below to for parts of the initial install. I have modified their instructions to try and make the installation work for everyone in every situation. Also, I included a few bits they missed out.
http://www.tecmint.com/install-cacti-ne ... ora-17-12/ as a
Thanks Guys.
Installing and configuring Cacti with Cent OS 6.3
Before we can install Cacti, we must install the following packages.
• Apache : A Web server to display network graphs created by PHP and RRDTool.
• MySQL : A Database server to store cacti information.
• PHP : A script module to create graphs using RRDTool.
• PHP-SNMP : A PHP extension for SNMP to access data.
• NET-SNMP : A SNMP (Simple Network Management Protocol) is used to manage network.
• RRDTool : A database tool to manage and retrieve time series data like CPU load, Network Bandwidth etc.
• UnZip : A simple tool for extracting zip files
Once Cent OS 6.3 is installed login as “root” with the password you configured during the OS installation
Installing Apache
# yum install httpd httpd-devel
Install MySQL
# yum install mysql mysql-server
Install PHP
# yum install php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-mysql
Install PHP-SNMP
# yum install php-snmp
Install NET-SNMP
# yum install net-snmp-utils p net-snmp-libs php-pear-Net-SMTP
Install RRDTool
# yum install rrdtool
Install UnZip
# yum install unzip
Now that all the required packages are installed, we must start their services running.
Start Apache
# service httpd start
Start MySQL
# service mysqld start
Start SNMP
# service snmpd start
Setup start up links for Apache, MySQL and SNMP
Apache
# /sbin/chkconfig --levels 345 httpd on
MySQL
# /sbin/chkconfig --levels 345 mysqld on
SNMP
# /sbin/chkconfig --levels 345 snmpd on
Add the Extra Packages for Enterprise Linux (EPEL) repository (64-Bit CentOS 6 only). This is where the Cacti installation is downloaded from.
# wget http://download.fedoraproject.org/pub/e ... noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
Download and Install Cacti
# yum install cacti
Setup MySQL Server for Cacti
# mysqladmin -u root password Desired-Password-Here
Create MySQL Cacti Database
# mysql -u root -p
mysql> create database cacti;
mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY ‘Password-you-set-above’;
mysql> FLUSH privileges;
mysql> quit;
Setup Cacti Tables in MySQL
To being, we need to know the location of the cacti.sql file where the tables will be installed. Use the following command to show the location.
# rpm -ql cacti | grep cacti.sql
Sample Output
/usr/share/cacti-0.8.7d/cacti.sql
Now we need to install the tables into the cacti.sql file. Use the following command to do this, replace the green text for the location shown by the command above.
# mysql -u cacti -p cacti < /usr/share/cacti-0.8.7d/cacti.sql
Configure MySQL settings for Cacti
Open db.php with your preferred editor
# vi /etc/cacti/db.php
Make the changes highlighted in red
/* make sure these values reflect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "your-password-here";
$database_port = "3306";
$database_ssl = false;
Configure Apache Server for Cacti Installation
You need to allow access to Cacti from the ipranges you require. By default I choose to allow access from all IP addresses. This can be viewd as an unsecure option and you may wish to follow a different path. (Google is your friend).
Open /etc/httpd/conf.d/cacti.conf with your preferred editor
# vi /etc/httpd/conf.d/cacti.conf
Add the following section at the bottom of the config file
Alias /cacti /usr/share/cacti
<Directory /usr/share/cacti/>
Order Deny,Allow
Deny from none
Allow from all
</Directory>
In order for this change to take effect, Apache must be restarted. Issue the following command to restart Apache
# service httpd restart
Setting Cron for Cacti
Open the Cacti cron file and and uncomment the line to enable the poller.php to run every5 mins.
#vi /etc/cron.d/cacti
Delete the # in the following line
#*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
Configure firewall to allow access to Cacti from the web
Open the iptables file
# vi /etc/sysconfig/iptables
Add the following line
# -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
Restart iptables
# service iptables restart
Complete Cacti Installation via web installer
Open http://SERVER-IP/cacti to view the web installer.
Basic Cacti configuration
In order for Cacti to be able to complete all the tasks we require, a few plugins need to be installed. These are;
• Monitor
• Errorimage
• Settings
• Jqueryskin
• Discovery
• Weathermap
• Realtime
• Nectar
• Thold
• Watermark
• Hmib
• Syslog
All the required plugins can be found either on Cacti website (docs.cacti.net/plugins).
Download the required plugins
We will be using the wget command to download the plugins as required. The links in this document refer to the plugins at the date of the documents publication. You may need to obtain the current links from the docs.cacti.net/plugins site.
Switch to the Cacti plugins directory
# cd /usr/share/cacti/plugins
Monitor Plugin
# wget http://docs.cacti.net/_media/plugin:monitor-v1.3-1.tgz
Error Image
# wget http://docs.cacti.net/_media/plugin:err ... v0.2-1.tgz
Settings
# wget http://docs.cacti.net/_media/plugin:set ... 0.71-1.tgz
Jqueryskin (If below link doesn’t work get current link from http://www.freedrive.com/folder/342025)
wget http://node1.nirvanix.com/jN8Cdrq0~3CM6 ... ryskin.zip
Discovery
# wget http://docs.cacti.net/_media/plugin:dis ... v1.5-1.tgz
Weathermap
# wget http://www.network-weathermap.com/files ... -0.97a.zip
Realtime
# wget http://docs.cacti.net/_media/plugin:realtime-v0.5-2.tgz
Nectar
# wget http://docs.cacti.net/_media/plugin:nectar-v0.35a.tgz
Thold
# wget http://docs.cacti.net/_media/plugin:thold-v0.4.9-3.tgz
Watermark (If below link doesn’t work get current link from http://www.freedrive.com/folder/342025)
wget http://node1.nirvanix.com/2-sZuPC-~7g88 ... ermark.zip
Hmib
# wget http://docs.cacti.net/_media/plugin:hmib-v1.4-2.tgz
Syslog
# wget http://docs.cacti.net/_media/plugin:syslog-v1.22-2.tgz
Renaming the plugins ready for extraction
Before we can install any plugins we need to remove the “plugin:” prefiex has been attached to any of the plugins hosted on the cacti website. Other plugins like weathermap don’t have this prefix and can be ignored at this step.
To check which files need to be corrected list all the plugins we have just downloaded
# ls
Sample Output
Index.php
Plugin:monitor-v1.5-1.tgz
Plugin:discovery-v1.5-1.tgz
Plugin:hmib-v1.4-2.tgz
Every file which has the “plugin:” prefix needs to be renamed with the “mv” command. To use this command simply write “mv PLUGINS-OLD-NAME PLUGINS-NEW-NAME” at the command prompt for each plugin.
# mv plugin:monitor-v1.3-1.tgz monitor-v1.3-1.tgz
# mv plugin:discovery-v1.5-1.tgz discovery-v1.5-1.tgz
# mv plugin:hmib-v1.4-2.tgz hmib-v1.4-2.tgz
# mv plugin:nectar-v0.35a.tgz nectar-v0.35a.tgz
# mv plugin:settings-v0.71-1.tgz settings-v0.71-1.tgz
# mv plugin:thold-v0.4.9-3.tgz thold-v0.4.9-3.tgz
# mv plugin:errorimage-v0.2-1.tgz errorimage-v0.2-1.tgz
# mv plugin:realtime-v0.5-2.tgz realtime-v0.5-2.tgz
# mv plugin:syslog-v1.22-2.tgz syslog-v1.22-2.tgz
At the point we need to check that all the plugins are named correctly. Issue the “ls” command and look for any plugins which have the prefiex “plugin:”. If you see any rename them as shown above and then continue.
Extracting the plugins
In order to extract the plugins, issue the “tar –zvxf PLUGIN-NAME” command for each plugin compressed with .tgz and “unzip PLUGIN-NAME” for each plugin compressed with .zip
# tar -zvxf monitor-v1.3-1.tgz
# tar -zvxf discovery-v1.5-1.tgz
# tar -zvxf hmib-v1.4-2.tgz
# tar -zvxf nectar-v0.35a.tgz
# tar -zvxf settings-v0.71-1.tgz
# tar -zvxf thold-v0.4.9-3.tgz
# tar -zvxf errorimage-v0.2-1.tgz
# tar -zvxf realtime-v0.5-2.tgz
# tar -zvxf syslog-v1.22-2.tgz
# unzip php-weathermap-0.97a.zip
# unzip watermark.zip
# unzip jqueryskin.zip
Tidy up the Plugins Folder
Now that all the plugins have been extracted, we need to remove the compressed files
# rm -rf monitor-v1.3-1.tgz
# rm -rf discovery-v1.5-1.tgz
# rm -rf hmib-v1.4-2.tgz
# rm -rf nectar-v0.35a.tgz
# rm -rf settings-v0.71-1.tgz
# rm -rf thold-v0.4.9-3.tgz
# rm -rf errorimage-v0.2-1.tgz
# rm -rf realtime-v0.5-2.tgz
# rm -rf syslog-v1.22-2.tgz
# rm -rf php-weathermap-0.97a.zip
# rm -rf watermark.zip
# rm -rf jqueryskin.zip
Confirm that all compressed files have been deleted by listing all files in the folder
# ls
If any compressed files remain, issue the “rm -rf COMPRESSED-FILE-NAME” command to remove them
Configuring the plugins
In order for the plugins to Install correctly some of them require a little configuring before they will work.
Realtime Graphs
Realtime Graphs requires a directory to store temp images as the realtime graphs are created. This directory needs to be writeable. Change directorys to the extracted reatime graphs folder.
# cd /usr/share/cacti/plugins/realtime
Create a new directory called “temp”
# mkdir temp
Set the permissions on the new directory to be writable by all
# chmod 777 temp
PHPWeathermap
We need to activate the editor in editor.php. Navigate to the correct folder
# cd /usr/share/cacti/plugins/weathermap
Make the configs directory writeable by the user
# chmod 777 configs
Make the output directory writable by the user
# chmod 777 output
Open the editor.php
# vi editor.php
Set ENABLED=true at the top of editor.php, then save and exit the editor
Set the max PHP file size to 768Mb.
To find the php.ini use the command
#find / -name php.ini
Change directory to the correct directory and open php.ini in your chosen editor
#cd /etc
#vi php.ini
Scroll down until you see “memory_limit = 128M”. Edit this to be “memory_limit = 768M” then save and close the editor
Install Webmin
Webmin makes simple tasks like setting the system time and keeping things up to date very easy.
Change directory to the root directory
# cd /root/
Make a new directory to download webmin into
# mkdir webmin
Change directory to your newly created Webmin directory
# cd /root/webmin/
Download the latest tar.gz version of Webmin (Get link from http://www.webmin.com/download.html)
# wget http://prdownloads.sourceforge.net/weba ... 610.tar.gz
Extract the Webmin download
# tar -xf webmin-1.610.tar
Change directory to the extracted Webmin directory
# cd webmin-1.610
Run the Webmin setup (accept default settings and enter a new password)
# ./setup.sh /usr/local/webmin
Add Webmins port to the iptables open the iptables file
# vi /etc/sysconfig/iptables
Add the following line
# -A INPUT -m state -state NEW -m tcp -p tcp -dport 10000 -j ACCEPT
Restart iptables
# service iptables restart
Configure the servers clock so that all Cacti graphs show the correct time
1. Login to Webmins web interface YOUR-SERVERS-IP:10000
2. Click “Hardware” on the left
3. Click “System Time” on the left
4. Set the “System Time” to the correct time
5. Click “Apply”
6. Set the “Hardware Time” to the correct time
7. Click “Save”
8. Click Logout on the left
Activate Plugins
1. View the cacti website (YOUR-SERVER-IP/Cacti)
2. Click “Plugin Management” on the left
3. Install and activate all plugins excluding Syslog (we will activate syslog in a moment)
4. Click “Settings” on the left
5. Click the “Misc” tab across the top
6. In the “Realtime Graphs” section input “/usr/share/cacti/plugins/realtime/temp” in the “Cache Directory”
7. Click “Save”
8. Check that the “Cache Directory” now shows “[OK: DIR FOUND]”
9. Click the “Visual” tab
10. In the “Watermark” section select “No Grid Fit”
11. Press “Save”
12. Click “Plugin Management” on the left
13. Click “Install” on Syslog
14. Change the “Retention Policy” to 3 Months
15. Click “Install”
16. Click “Activate” on the Syslog plugin
Install Advanced Ping 2.2
1. Download Advanced Ping template to your pc (http://www.freedrive.com/folder/342025)
2. In the Cacti web interface click “Import/Export” on the left
3. Click “Import Templates”
4. Click “Choose File”
5. Select the Advanced Ping template you downloaded
6. Click “Import” at the bottom
Finally, add your devices to Cacti and graph them as per your requirements.
[출처] http://forums.cacti.net/viewtopic.php?f=21&t=49363
-
[sql] 쿼리로 문자열 검색해서 일괄 치환하기
-
[php] XE 관리자 IP대역 설정 오류 해결법
-
[c] 64bit 머신에서 inet_ntoa() 사용시 Segment fault 대처 방법법
-
[ios] NSString 간단한 정규식 사용법
-
[ios] iOS 6.0 이상 회전 하기 (이전 버전과 비교 변경 부분)
-
[ios] 네트워크 인디케이터(NetworkActivityIndicator) 작동
-
[js] 주소표시줄 URL 읽어오기 (변경까지)
-
[linux] CentOS 6.x Cati 설치 (yum)
-
[ios] UIWebView에서 NSURLRequest에 Cookie 실어 보내기
-
[ios] UIWebView 쿠키 유지
-
[php] substr() 한글 자를 때 깨짐 방지
-
[linux] iconv를 이용하여 euc-kr 문서를 utf-8로 대량으로 변환하기