- rhel6.5安裝配置
cacti
兩台主機:
IP:
172.25.23.20
核心版本172.25.23.21
軟體版本:2.6.32-431.el6.x86_64
cacti-0.8.8h.tar.gz
cacti-spine-0.8.8h.tar.gz
- 首先在
上面安轉172.25.23.20
依賴的軟體包cacti
- 安裝
沒有提供的軟體包Yum
,通過軟體包php-snmp
來進行安裝php-snmp-5.3.3-26.el6.x86_64.rpm
[root@server20 ~]# rpm -ivh /mnt/php-snmp-5.3.3-26.el6.x86_64.rpm
warning: /mnt/php-snmp--el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]
:php-snmp ########################################### [100%]
- 編輯配置檔案更改時區
[[email protected] ~]# vim /etc/php.ini
[Date]
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
date.timezone = Asia/Shanghai
- 解壓cacti的主檔案,到httpd的釋出目錄裡面
[[email protected] mnt]# tar zxf cacti-0.8.8h.tar.gz -C /var/www/html/
[[email protected] mnt]# ln -sv /var/www/html/cacti-0.8.8h/ /var/www/html/cacti
`/var/www/html/cacti' -> `/var/www/html/cacti-0.8.8h/
- 啟動httpd服務:
[root@server20 html]# /etc/init.d/httpd start
Starting httpd: [ OK ]
- 確定服務的啟動狀态是正常的
[rhel6.5]cacti的安裝配置 - 修改cacti的配置檔案cacti/include/config.php 關于資料庫連接配接的選項
[[email protected] html]# vim cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "westos";
$database_port = "3306";
$database_ssl = false;
/*
Edit this to point to the default URL of your Cacti install
ex: if your cacti install as at http://serverip/cacti/ this
would be set to /cacti/
*/
//$url_path = "/cacti/";
$url_path = "/cacti/";
/* Default session name - Session name must contain alpha characters */
//$cacti_session_name = "Cacti";
$cacti_session_name = "Cacti";
- 啟動myql資料庫并且進行資料庫的安全設定,因為這是安裝資料庫之後的第一次使用
[[email protected] html]# /etc/init.d/mysqld start
Initializing MySQL database: Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h server20.com password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
[ OK ]
Starting mysqld: [ OK ]
- 確定啟動狀态是正常的
[rhel6.5]cacti的安裝配置 - 執行資料庫的安全配置腳本
[[email protected] html]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL
- 建立
資料庫,并且執行cacti
資料庫的導入操作cacti
[root@server20 html]# mysql -pwestos -e "create database cacti"
[root@server20 html]# mysql -pwestos cacti < cacti/cacti.sql
- 執行授權操作
- 確定登入是正常的
[[email protected] html]# mysql -ucacti -pwestos cacti
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
- 在使用浏覽器進行重新整理
[rhel6.5]cacti的安裝配置 - 點選
next
[rhel6.5]cacti的安裝配置 - 選擇
,點選New Install
;next
[rhel6.5]cacti的安裝配置 - 確定這裡的狀态都是正常的,點選進入
界面login
[rhel6.5]cacti的安裝配置 - 點選進行登陸,這裡使用的使用者名和密碼都是
;admin
[rhel6.5]cacti的安裝配置 - 登陸之後,會強制進行使用者密碼的修改,輸入新的密碼;
[rhel6.5]cacti的安裝配置 - 點選之後進入新的頁面
[rhel6.5]cacti的安裝配置 - 選擇
可以檢視本機的裝置的資訊device
- 點選
,可以選擇時間段,檢視平均負載等資訊graphs
[rhel6.5]cacti的安裝配置 - 檢視
檔案的屬主或者屬組,,然後添加制定的使用者/var/www/html/cacti
- 切換到這個使用者并且建立定時任務
[root@server20 cacti]# su - cacti
[cacti@server20 ~]$ crontab -e
*/5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null >&
crontab: installing new crontab
[cacti@server20 ~]$ logout
- 複制時區檔案到系統時間檔案裡面
[[email protected] rra]# cd /usr/share/zoneinfo/Asia/
[[email protected] Asia]# pwd
/usr/share/zoneinfo/Asia
[[email protected] Asia]# cp Shanghai /etc/localtime
cp: overwrite `/etc/localtime'? y
- 關于localhost使用cacti來監控系統性能的配置已經完成,接下來配置
監控cacti
172.25.23.21
- 首先安裝
net-snmp-*
- 啟動snmpd服務:
[root@server21 ~]# /etc/init.d/snmpd start
Starting snmpd: [ OK ]
[root@server21 ~]# snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
- 修改配置檔案如下
[[email protected] ~]# vim /etc/snmp/snmpd.conf
# First, map the community name "public" into a "security name"
# sec.name source community
#com2sec notConfigUser default public
com2sec local localhost westos
com2sec mynetwork 172.25.23.0/24 westos
# Second, map the security name into a group name:
# groupName securityModel securityName
#group notConfigGroup v1 notConfigUser
#group notConfigGroup v2c notConfigUser
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyRWGroup usm local
group MyROGroup v1 mynetwork
group MyROGroup v2c mynetwork
group MyROGroup usm mynetwork
# Third, create a view for us to let the group have rights to:
# Make at least snmpwalk -v localhost -c public system fast again.
# name incl/excl subtree mask(optional)
view systemview included
view systemview included
view all included
# Finally, grant the group read-only access to the systemview view.
# group context sec.model sec.level prefix read write notif
#access notConfigGroup "" any noauth exact systemview none none
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none
#syslocation Unknown (edit /etc/snmp/snmpd.conf)
#syscontact Root <[email protected]> (configure /etc/snmp/snmp.local.conf)
syslocation RHEL6
syscontact Root <[email protected]>
# Check the / partition and make sure it contains at least megs.
#disk /
disk /
- 使用指令探測
服務是否正常啟動snmpd
[[email protected] ~]# snmpwalk -v 1 -c westos localhost IP-MIB::ipAdEntIfIndex
IP-MIB::ipAdEntIfIndex = INTEGER:
IP-MIB::ipAdEntIfIndex = INTEGER:
- 顯示的結果如下:
- 在
上面進行探測server20.com
- 確定探測的結果如下
[rhel6.5]cacti的安裝配置 - 是上面對于配置檔案的修改,可以通過檢查錯誤日志來檢視檔案的修改是否是正确的
- 檔案是
,/var/log/messages
[rhel6.5]cacti的安裝配置 - 點選
之後,點選device
Add
[rhel6.5]cacti的安裝配置 - 按照這個要求進行建立
[rhel6.5]cacti的安裝配置 [rhel6.5]cacti的安裝配置 - 建立
的圖形server21.com
[rhel6.5]cacti的安裝配置 [rhel6.5]cacti的安裝配置 - 接下來點選
和Graphy tree
default tree
[rhel6.5]cacti的安裝配置 - 接下來點選
用于添加新的圖形界面add
[rhel6.5]cacti的安裝配置 - 這裡 改為
然後點選host
進行儲存save
[rhel6.5]cacti的安裝配置 - 這裡就可以看到
發送回來的資訊了hosts server21.com
[rhel6.5]cacti的安裝配置 - 接下來配置
cacti-spine-0.8.8h
- 首先編譯環境的依賴問題
- 然後執行
[root@server20 ~]# tar zxf cacti-spine-0.8.8h.tar.gz -C /usr/local/
[root@server20 ~]# cd /usr/local/cacti-spine-0.8.8h/
[root@server20 cacti-spine-.h]# sh bootstrap
- 直到出現這個畫面
[rhel6.5]cacti的安裝配置 - 執行
[root@server20 cacti-spine-.h]# ./configure
[root@server20 cacti-spine-.h]# make
[root@server20 cacti-spine-.h]# make install
- 首先複制配置檔案
[root@server20 local]# cd spine/
[root@server20 spine]# ls
bin etc
[root@server20 spine]# cd etc/
[root@server20 etc]# ls
spine.conf.dist
[root@server20 etc]# pwd
/usr/local/spine/etc
[root@server20 etc]# cp spine.conf.dist /etc/spine.conf
- 修改
的類型為poller Type
spine
[rhel6.5]cacti的安裝配置 - 同時還需要添加
的配置路徑spine
[rhel6.5]cacti的安裝配置 - 然後更改配置檔案,添加連接配接資料庫的資訊
[root@server20 bin]# vim /etc/spine.conf
DB_Host localhost
DB_Database cacti
DB_User cacti
DB_Pass westos
DB_Port
- 使用絕對路徑的方式啟動服務
- 通過上面的方式就完成了,插件
的配置spine