In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Host environment redhat6.5 64-bit
Experimental environment server 1 ip 172.25.25.1
Server 2 ip 172.25.25.2
Install package cacti-0.8.8h.tar.gz
Php-snmp-5.3.3-26.el6.x86_64.rpm
Cacti-spine-0.8.8g.tar.gz
Firewall status: off
Selinux status: Disabled
1. Configure, install cacti and test
A) configure and install cacti
[root@sever1 Asia] # yum install rrdtool mysql-server php httpdphp-mysql php-xml net-snmp net-snmp-utils- y # packages to be installed before installing cacti
[root@sever1 Asia] # cd / mnt/
[root@sever1 mnt] # ls
Cacti-0.8.8h.tar.gz php-snmp-5.3.3-26.el6.x86_64.rpm
Cacti-spine-0.8.8g.tar.gz
[root@sever1 mnt] # rpm-vih php-snmp-5.3.3-26.el6.x86_64.rpm
[root@sever1 mnt] # vim / etc/php.ini
946 date.timezone = Asia/Shanghai
[root@sever1 mnt] # tar zxf cacti-0.8.8h.tar.gz-C/var/www/html/ # extract to / var/www/html/ directory
[root@sever1 mnt] # cd / var/www/html/
[root@sever1 html] # ls
Cacti-0.8.8h
[root@sever1 html] # ln-s cacti-0.8.8h/ cacti # as soft link
[root@sever1 html] # ls
Cacti cacti-0.8.8h
[root@sever1 include] # / etc/init.d/mysqld start # Open the database
[root@sever1 include] # mysql_secure_installation # initialize. There is no password by default. Here, the password is set to redhat.
[root@sever1 html] # cd cacti/
[root@sever1 cacti] # mysql-predhat-e "create databasecacti" # create a database named cacti
[root@sever1 cacti] # mysql-predhat cacti
< cacti.sql #将cacti.sql文件导入到cacti数据库中 [root@sever1 cacti]# mysql -predhat -e "grant all oncacti.* to cacti@localhost identified by 'redhat'" #创建本地cacti用户,并将cacti数据库的所有权限给cacti用户 [root@sever1 html]# cd include/ [root@sever1 include]# vim config.php #修改配置文件 29 $database_username ="cacti"; #刚创建的cacti数据库的用户名 30 $database_password ="redhat"; #用户cacti的密码 39 $url_path ="/cacti/"; 42 $cacti_session_name ="Cacti"; [root@sever1 cacti]# useradd -u 1000 cacti #在系统中创建cacti用户 [root@sever1 cacti]# ll total 1068 -rw-rw-r-- 1 cacti cacti 5860 Feb 8 2016 about.php -rw-rw-r-- 1 cacti cacti 5348 Feb 8 2016 auth_changepassword.php -rw-rw-r-- 1 cacti cacti 14690 Mar 7 2016 auth_login.php -rw-rw-r-- 1 cacti cacti 178349 Apr 10 2012 cacti.sql -rw-rw-r-- 1 cacti cacti 20257 Feb 8 2016 cdef.php [root@sever1 cacti]# su - cacti #切换到cacti用户 [cacti@sever1 ~]$ crontab -e #创建定时任务 */5 * * * * php /var/www/html/cacti/poller.php >/ dev/null2 > & 1
[cacti@sever1 ~] $logout
[root@sever1 ~] # / etc/init.d/httpd start # enable httpd
Stopping httpd: [OK]
Install cacti 172.25.25.1/cacti
Click next
Click next
Click next
Time has to be synchronized before testing
B) Test 172.25.25.1/cacti
Login user name: admin password: admin
The first time you log in, you will be prompted to change your password.
After logging in, as shown in the figure:
Click graphs, as shown below:
[root@sever1 cacti] # cd rra # where the collected data is stored
[root@sever1 rra] # ls
After waiting for five minutes
[root@sever1 rra] # ls # already has data
Localhost_load_1min_5.rrd localhost_mem_swap_4.rrd localhost_users_6.rrd
Localhost_mem_buffers_3.rrd localhost_proc_7.rrd
View the image as shown in the figure:
two。 Monitor the resources and testing of server 2
A) install net-snmp and configuration on server 2
[root@sever2 ~] # yum install net-snmp*-y # installation
[root@sever2 ~] # cd / etc/snmp/
[root@sever2 snmp] # vim snmpd.conf # enter the configuration file
40 # sec.name source community
41 # com2secnotConfigUser default public
42 com2sec local localhost wen # add local resources with any name (wen)
43 com2sec mynetwork172.25.25.0/24 wen # allows monitoring of 25 network segments
49 # group notConfigGroup v1 notConfigUser
50 # group notConfigGroup v2c notConfigUser
51 group MyRWGroupv1 local
52 group MyRWGroupv2c local
53 group MyRWGroupusm local
54 group MyROGroupv1 mynetwork
55 group MyROGroupv2c mynetwork
56 group MyROGroupusm mynetwork
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
69 # access notConfigGroup "" any noauth exact systemview none none
70 access MyROGroup "" any noauth exact all none none
71 access MyRWGroup "" any noauth exact all all none
170 syslocation RHEL6.5 # type
171 syscontact Root # address to send mail when there is a problem
331 disk / 10000 # allow monitoring of disks
[root@sever2 snmp] # / etc/init.d/snmpd start # enable
Starting snmpd: [OK]
[root@sever2 snmp] # snmpwalk-v 1-c wen localhostIP-MIB::ipAdEntIfIndex # test data, normal
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.172.25.25.2 = INTEGER: 2
Test on server 1, normal
[root@sever1] $snmpwalk-v 1-c wen 172.25.25.2IP-MIB::ipAdEntIfIndex
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.172.25.25.2 = INTEGER: 2
[root@sever1] $snmpwalk-v 1-c wen 172.25.25.2.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/VolGroup-lv_root
UCD-SNMP-MIB::dskMinimum.1 = INTEGER: 10000
UCD-SNMP-MIB::dskMinPercent.1 = INTEGER:-1
UCD-SNMP-MIB::dskTotal.1 = INTEGER: 7853764
UCD-SNMP-MIB::dskAvail.1 = INTEGER: 6464416
UCD-SNMP-MIB::dskUsed.1 = INTEGER: 990400
UCD-SNMP-MIB::dskPercent.1 = INTEGER: 13
UCD-SNMP-MIB::dskPercentNode.1 = INTEGER: 6
UCD-SNMP-MIB::dskTotalLow.1 = Gauge32: 7853764
UCD-SNMP-MIB::dskTotalHigh.1 = Gauge32: 0
UCD-SNMP-MIB::dskAvailLow.1 = Gauge32: 6464416
UCD-SNMP-MIB::dskAvailHigh.1 = Gauge32: 0
UCD-SNMP-MIB::dskUsedLow.1 = Gauge32: 990400
UCD-SNMP-MIB::dskUsedHigh.1 = Gauge32: 0
UCD-SNMP-MIB::dskErrorFlag.1 = INTEGER: noError (0)
UCD-SNMP-MIB::dskErrorMsg.1 = STRING:
B) add equipment and testing to the graphical interface
Select add to add device
Fill in the device name, ip, and type in turn; rewrite the default public to the name added in the file (wen) and select create
After selecting create, click Create Graphs for this Host as shown in the following figure
Select the following figure and click create to add the device successfully.
After clicking Graph Trees, click Default Trees as shown in the figure.
Click Add as shown in the figure.
Select Host Host in Tree ltem Type, select server2 Round Robin Archive, select 5 Minute, and click create
C) Test Click graphs
Wait for 5 minutes to refresh, as shown in the figure:
3.cacti supports multithreaded configuration
A) install and configure cacti-spine
[root@sever1 mnt] # yum install-y net-snmp-devel mysql-developenssl-devel dos2unix autoconf binutils libtool gcc cpp glibc-headerskernel-headers gilbc-devel # packages required before installing cacti-spine
[root@sever1 mnt] # ls
Cacti-0.8.8h.tar.gz cacti-spine-0.8.8h.tar.gz
Php-snmp-5.3.3-26.el6.x86_64.rpm
[root@sever1 mnt] # tar zxf cacti-spine-0.8.8h.tar.gz
[root@sever1 mnt] # cd cacti-spine-0.8.8h
[root@sever1 cacti-spine-0.8.8h] # sh bootstrap # check the compilation environment
[root@sever1 cacti-spine-0.8.8h] #. / configure
[root@sever1 cacti-spine-0.8.8h] # make
[root@sever1 cacti-spine-0.8.8h] # make install
[root@sever1 cacti-spine-0.8.8h] # cd / usr/local/spine/
[root@sever1 spine] # ls
Bin etc
[root@sever1 spine] # cd etc/
[root@sever1 etc] # cp spine.conf.dist / etc/spine.conf # configuration file
[root@sever1 bin] # vim / etc/spine.conf
33 DB_Host localhost # Local Database
34 DB_Database cacti # name of the database
35 DB_User cacti # users of the database
36 DB_Pass redhat # password
37 DB_Port 3306 # port
[root@sever1 etc] # cd..
[root@sever1 spine] # cd bin/
[root@sever1 bin] # ls # startup script
Spine
[root@sever1 bin] # pwd
/ usr/local/spine/bin
[root@sever1 bin] # su-cacti
[cacti@sever1 ~] $/ usr/local/spine/bin/spine # test script, normal
SPINE: Using spine config file [/ etc/spine.conf]
SPINE: Version 0.8.8h starting
SPINE: Time: 0.0820 s, Threads: 5, Hosts: 3
B) add script paths and change the type of poller in the graphical interface
Click Paths in Setting to add the path to start the sping script
Multithreading can be supported by replacing cmd.php with spine. (thread is set to Host Template in Devices)
4. Set up monitoring and testing with the command line
A) set up monitoring with the command line
[root@sever1 mnt] # uptime | awk'{print$1,$ (NF-2), $(NF-1), $(NF)}'| sed's Universe g'
15:16:15 0.00 0.00 0.00
[root@sever1 mnt] # uptime | awk'{print$1,$ (NF-2), $(NF-1), $(NF)}'| sed's Universe Gclass2'> / tmp/uptime
[root@sever1 mnt] # cat / tmp/uptime
15:16:59 0.00 0.00 0.00
[root@sever1 mnt] # vim / mnt/uptime.sh # script
#! / bin/bash # create by 2016 uptime | awk'{print $1tmp/uptime $(NF-2), $(NF-1), $(NF)}'| sed's tmp/uptime
[root@sever1 mnt] # chmod + x / mnt/uptime.sh # give execution permission
[root@sever1 mnt] # crontab-e # create scheduled tasks (execute / mnt/uptime.sh script every 10 seconds)
* / mnt/uptime.sh
* sleep 10 inception MNT Universe uptime.sh
* sleep 20ternal MNT. Sh
* sleep 30 * * *
* sleep 40 inception MNT hand uptime.sh
* sleep 50 * * *
[root@sever1 mnt] # dd if=/dev/zero of=/dev/null & # load, peak production
[1] 7811
[root@sever1 mnt] # cat / tmp/uptime # View, adding
15:16:59 0.00 0.00 0.00
15:21:01 0.00 0.00 0.00
15:21:11 0.00 0.00 0.00
15:21:21 0.00 0.00 0.00
15:21:31 0.15 0.03 0.01
15:21:41 0.28 0.06 0.02
15:21:51 0.39 0.09 0.03
15:22:01 0.49 0.12 0.04
15:22:11 0.56 0.15 0.05
15:22:21 0.63 0.18 0.06
15:22:31 0.69 0.21 0.07
15:22:41 0.73 0.23 0.08
[root@sever1 mnt] # kill-9 dd # unload
[root@sever1 bin] # yum install-y gnuplot # install drawing tool
[root@sever1 html] # vim / mnt/uptime.sh # continue editing the script
#! / bin/bash # create by 2016 uptime | awk'{print $1tmp/uptime gnuplot $(NF-2), $(NF-1), $(NF)}'| sed's tmp/uptime gnuplot
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.