您好,登錄后才能下訂單哦!
本次實驗接著上次實驗的環境。實戰Cacti網絡監控(1)——基礎安裝配置
實驗內容:
1.監控物理主機
2.Spine 多線程監控
3.monitor監控插件
1.監控物理主機
在物理主機上配置如下:
<1>yum install net-snmp.x86_64 -y ##安裝snmp服務
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 <root@willis.example.com>
331 disk / 10000
<3>systemctl start snmpd
<4>snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex ##-v指版本,-c指密鑰,即客戶端snmp.conf里面所設置的,公認的密鑰組為public(這也是snmp眾所都知的bug之一,不安全!,當然也可以自己改個密碼),IP——MIB指獲取系統(物理機)的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 ##查看系統信息管理塊
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>網頁端配置
打開網頁http:172.25.254.10
在左邊選Device 然后點擊Add
這是創建好的
然后點擊右上方第一個
添加虛擬機監控界面
Console -> Graph Trees -> (Edit) -> Graph Tree Items
2.Spine 多線程監控
在虛擬主機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 ##解決依賴關系
《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$
**********************************************************************
網頁添加
Console -> Cacti Settings
The path to Spine binary. /usr/local/spine/bin/spine
**********************************************************************
<5>vim /etc/php.ini ##修改PHP的時間區
946 date.timezone = Asia/Shanghai
<6>/etc/init.d/httpd restart ##重啟apache服務
<7>cd /var/www/html/cacti/log
tail -f /var/www/html/cacti/log/cacti.log ##監控日志,或者用cat cacti.log,只要出現如下類似消息即可:
*****************************************************************************************
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監控插件
(1)tar -zxf monitor-v1.3-1.tgz -C /var/www/html/cacti/plugins
(2)瀏覽器頁面操作:
搭建已經完成,過一段時間可以清楚的看到服務器性能變化曲線
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。