本次實(shí)驗(yàn)接著上次實(shí)驗(yàn)的環(huán)境。實(shí)戰(zhàn)Cacti網(wǎng)絡(luò)監(jiān)控(1)——基礎(chǔ)安裝配置
創(chuàng)新互聯(lián)是一家專業(yè)提供定州企業(yè)網(wǎng)站建設(shè),專注與成都網(wǎng)站制作、成都網(wǎng)站設(shè)計(jì)、H5技術(shù)、小程序制作等業(yè)務(wù)。10年已為定州眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)站制作公司優(yōu)惠進(jìn)行中。
實(shí)驗(yàn)內(nèi)容:
1.監(jiān)控物理主機(jī)
2.Spine 多線程監(jiān)控
3.monitor監(jiān)控插件
1.監(jiān)控物理主機(jī)
在物理主機(jī)上配置如下:
<1>yum install net-snmp.x86_64 -y ##安裝snmp服務(wù)
yum install net-snmp-utils.x86_64 -y
<2>vim /etc/snmp/snmpd.conf
41 #com2sec notConfigUser default public
42 com2sec local localhost public
43 com2sec mynetwork 172.25.254.0/24 public
44
45 ####
46 # Second, map the security name into a group name:
47
48 # groupName securityModel securityName
49 #group notConfigGroup v1 notConfigUser
50 #group notConfigGroup v2c notConfigUser
51 group MyRWGroup v1 local
52 group MyRWGroup v2c local
53 group MyRWGroup usm local
54 group MyROGroup v1 mynetwork
55 group MyROGroup v2c mynetwork
56 group MyROGroup usm mynetwork
57 ####
58 # Third, create a view for us to let the group have rights to:
59
60 # Make at least snmpwalk -v 1 localhost -c public system fast again.
61 # name incl/excl subtree mask(optional)
62 view systemview included .1.3.6.1.2.1
63 view systemview included .1.3.6.1.2.1.25.1.1
64 view all included .1 80
65 ####
69 #access notConfigGroup "" any noauth exact systemview none n one
70 access MyROGroup "" any noauth exact all none none
71 access MyRWGroup "" any noauth exact all all none
72 # --
170 syslocation RHEL6.5
171 syscontact Root
331 disk / 10000
<3>systemctl start snmpd
<4>snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex ##-v指版本,-c指密鑰,即客戶端snmp.conf里面所設(shè)置的,公認(rèn)的密鑰組為public(這也是snmp眾所都知的bug之一,不安全!,當(dāng)然也可以自己改個(gè)密碼),IP——MIB指獲取系統(tǒng)(物理機(jī))的IP信息
*****************************************************************************************
[root@willis Desktop]# snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
IP-MIB::ipAdEntIfIndex.10.52.115.4 = INTEGER: 24
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.172.25.254.6 = INTEGER: 22
IP-MIB::ipAdEntIfIndex.192.168.122.1 = INTEGER: 5 *************************************************************************************************************
<5>snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.9
*************************************************************************************************************
[root@foundation38 snmp]# snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.9 ##查看系統(tǒng)信息管理塊
UCD-SNMP-MIB::dskIndex.1 = INTEGER: 1
UCD-SNMP-MIB::dskPath.1 = STRING: /
UCD-SNMP-MIB::dskDevice.1 = STRING: /dev/mapper/rhel-root
UCD-SNMP-MIB::dskMinimum.1 = INTEGER: 10000
UCD-SNMP-MIB::dskMinPercent.1 = INTEGER: -1
UCD-SNMP-MIB::dskTotal.1 = INTEGER: 225661280
UCD-SNMP-MIB::dskAvail.1 = INTEGER: 102136208
UCD-SNMP-MIB::dskUsed.1 = INTEGER: 123525072
UCD-SNMP-MIB::dskPercent.1 = INTEGER: 55
UCD-SNMP-MIB::dskPercentNode.1 = INTEGER: 0
UCD-SNMP-MIB::dskTotalLow.1 = Gauge32: 225661280
UCD-SNMP-MIB::dskTotalHigh.1 = Gauge32: 0
UCD-SNMP-MIB::dskAvailLow.1 = Gauge32: 102136208
UCD-SNMP-MIB::dskAvailHigh.1 = Gauge32: 0
UCD-SNMP-MIB::dskUsedLow.1 = Gauge32: 123525072
UCD-SNMP-MIB::dskUsedHigh.1 = Gauge32: 0
UCD-SNMP-MIB::dskErrorFlag.1 = INTEGER: noError(0)
UCD-SNMP-MIB::dskErrorMsg.1 = STRING:
*******************************************************************************************************
<6>網(wǎng)頁端配置
打開網(wǎng)頁http:172.25.254.10
在左邊選Device 然后點(diǎn)擊Add
這是創(chuàng)建好的
然后點(diǎn)擊右上方第一個(gè)
添加虛擬機(jī)監(jiān)控界面
Console -> Graph Trees -> (Edit) -> Graph Tree Items
2.Spine 多線程監(jiān)控
在虛擬主機(jī)server6上編譯cacti-spine:
<1>tar zxf cacti-spine-0.8.8h.tar.gz
<2>cd cacti-spine-0.8.8h
《1》yum install net-snmp-devel MySQL-devel openssl-devel -y ##解決依賴關(guān)系
《2》yum install dos2unix autoconf automake binutils libtool gcc cpp glibc-headers glibc-devel -y
《3》sh bootstrap
《4》./configure
《5》make && make install
<3>cd /usr/local/spine/etc
《1》cp spine.conf.dist /etc/spine.conf
《2》vim /etc/spine.conf ##做如下修改
33 DB_Host localhost
34 DB_Database cacti
35 DB_User cacti
36 DB_Pass redhat
37 DB_Port 3306
<4>su - cacti
《1》/usr/local/spine/bin/spine
**********************************************************************
[root@server10 etc]# su - cacti
-bash-4.1$ /usr/local/spine/bin/spine
SPINE: Using spine config file [/etc/spine.conf]
SPINE: Version 0.8.8h starting
SPINE: Time: 0.0821 s, Threads: 5, Hosts: 3
-bash-4.1$
**********************************************************************
網(wǎng)頁添加
Console -> Cacti Settings
The path to Spine binary. /usr/local/spine/bin/spine
**********************************************************************
<5>vim /etc/php.ini ##修改PHP的時(shí)間區(qū)
946 date.timezone = Asia/Shanghai
<6>/etc/init.d/httpd restart ##重啟apache服務(wù)
<7>cd /var/www/html/cacti/log
tail -f /var/www/html/cacti/log/cacti.log ##監(jiān)控日志,或者用cat cacti.log,只要出現(xiàn)如下類似消息即可:
*****************************************************************************************
09/29/2016 03:20:01 PM - SYSTEM STATS: Time:0.1069 Method:cmd.php Processes:1 Threads:N/A Hosts:3 HostsPerProcess:3 DataSources:18 RRDsProcessed:16 *****************************************************************************************
3.monitor監(jiān)控插件
(1)tar -zxf monitor-v1.3-1.tgz -C /var/www/html/cacti/plugins
(2)瀏覽器頁面操作:
搭建已經(jīng)完成,過一段時(shí)間可以清楚的看到服務(wù)器性能變化曲線