In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article is about how to build a Cacti monitoring system under RHEL5. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
There are many tools for monitoring system performance in Linux system. Cacti is a common performance monitoring software in large networks, which can monitor all kinds of data information, such as CPU load, memory occupation, number of running processes, disk space, network card traffic and so on.
Cacti is a management suite based on PHP language, which needs to use Net-SNMP tools to collect monitoring data, record data and draw pictures combined with RRDtool (polling database tool), and then show them to administrator users in the form of Web pages. Next, we begin to build a Cacti monitoring system:
The Cacti and RRDtool tools can be downloaded from the following two sites:
Http://oss.oetiker.ch/rrdtool/
Http://www.cacti.net
one。 Configure the monitoring server (192.168.0.66):
The configuration of Cacti monitoring server requires the support of AMP (Apache, Mysql, PHP) platform, as well as the installation of gd, zlib and other software packages. The AMP platform can be built by compiling and installing the source package, or it can be built by RPM software package. In order to save time, this paper uses to install the RHEL5 system CD-ROM with RPM package to build the AMP platform.
1. Install the RPM packages needed to build the APM platform separately: (the installation process is brief)
Httpd-2.2.3-31.el5
Mysql-5.0.77-3.el5, mysql-connector-odbc-3.51.26r1127-1.el5, mysql-server-5.0.77-3.el5
Php-common-5.1.6-23.2.el5_3, php-pdo-5.1.6-23.2.el5_3, php-5.1.6-23.2.el5_3
Php-mysql-5.1.6-23.2.el5_3
Start each service after the installation is complete.
two。 Use the rpm-qa | grep gd, rpm-qa | grep zlib command to check whether the package is installed, and mount the RHEL5 CD if it is not installed.
3. Install the net-snmp-utils package:
Install lm_sensors, net-snmp and net-snmp-utils software packages respectively:
[root@linux5234 ~] # rpm-ivh lm_sensors
[root@linux5234 ~] # rpm-ivh net-snmp
[root@linux5234 ~] # rpm-ivh net-snmp-utils
4. Install the rrdtool package:
[root@linux5234 ~] # tar zxf rrdtool-1.2.27.tar.gz
[root@linux5234 ~] # cd rrdtool-1.2.27
[root@linux5234 ~] # .configure-- prefix=/usr/local
[root@linux5234] # make & & make install
5. Install and configure Cacti server suite: (use tar zxf / media/6/cacti-0.8.7b-cn-utf8.tar.gz
Chinese software package)
1 > install the Cacti software package: first mount the installation package, then extract it to the Web server web page directory, and add the user cacti for reading and writing monitoring data.
[root@linux5234 ~] # mount / dev/cdrom / media/
Mount: block device / dev/cdrom is write-protected, mounting read-only
[root@linux5234 ~] # cd / media/6/
[root@linux5234 6] # cd / var/www/html/
[root@linux5234 html] # tar zxf / media/6/cacti-0.8.7b-cn-utf8.tar.gz
[root@linux5234 html] # mv cacti-0.8.7b-cn-utf8 cacti
[root@linux5234 html] # useradd cacti
[root@linux5234 html] # chown-R cacti.cacti cacti/rra/ cacti/log/
2 > set up the monitoring database: establish the database and table to save the monitoring data, and set up the users and passwords authorized to access the database.
[root@linux5234 html] # mysql-u root
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 2
Server version: 5.0.77 Source distribution
Type 'help;' or'\ h' for help. Type'\ c'to clear the buffer.
Mysql > create database cactidb default character set utf8; / / create the database and set the default character set
Query OK, 1 row affected (0.00 sec)
Mysql > grant all on cactidb.* to cacti@localhost identified by 'pwd@123'
Query OK, 0 rows affected (0.00 sec)
Mysql > quit
Bye
[root@linux5234 html] # mysql-u cacti-p cactidb
< cacti/cacti.sql //导入数据表 Enter password: //输入密码后导入成功 3>Modify the Cacti configuration file:
[root@linux5234 html] # cd cacti/
[root@linux5234 cacti] # vi include/config. Php / / what needs to be modified is as follows
$database_type = "mysql"
$database_default = "cactidb"; / / name of the database to be accessed
$database_hostname = "localhost"; / / address of the database server
$database_username = "cacti"; / / users authorized to access the database
$database_password = pwd@123; / / authorization password
$database_port = "3306"; / / Port of mysql database service
$config ['url_path'] = "/"; / / specify the location of the Cacti directory relative to the root of the site
6. Modify the httpd.conf configuration file to support php web pages and use utf-8 as the default Chinese page character set:
[root@linux5234 cacti] # vi / etc/httpd/conf/httpd.conf
DocumentRoot "/ var/www/html/cacti" / / sets the web site file root directory
/ / set directory permissions
Options None
AllowOverride None
Order allow,deny
Allow from all
DirectoryIndex index. Php index.html / / sets the default index page
AddDefaultCharset UTF-8 / / sets the default character set for a web page
Restart the httpd service: service httpd restart
two。 Configure the monitored Linux server (192.168.0.77):
1. Install the net-snmp package:
[root@localhost ~] # mount / dev/cdrom / media/
Mount: block device / dev/cdrom is write-protected, mounting read-only
[root@localhost ~] # cd / media/Server/
[root@localhost Server] # rpm-ivh lm_sensors-2.10.7-4.el5.i386.rpm
[root@localhost Server] # rpm-ivh net-snmp-5.3.2.2-7.el5.i386.rpm
two。 Modify the snmpd service configuration file and start the service:
[root@localhost ~] # vi / etc/snmp/snmpd.conf
41 lines
Com2sec notConfigUser 192.168.0.66 public / / 192.168.0.66 is the IP address of the Cacti monitoring server
62 lines
Access notConfigGroup "" any noauth exact all none none / / modify SystemViem to all or read to provide access
85 lines
View all included. 180 / / remove the # before this line
Start the service and set the service to start itself:
[root@localhost ~] # service snmpd start
[root@localhost] # chkconfig-- level 35 snmpd on
three。 Initialize the Cacti system:
When you access the Cacti server (192.168.0.66) on the client side of the Web browser and visit the cacti interface for the first time, the page will jump to the initialization installation wizard interface of Cacti:
Click "next":
Select "New installation" and click "next".
Set the path of various tool commands, if not found, you need to modify it manually. At this point, it is important to note that if the AMP platform is compiled and installed, some paths need to be changed accordingly.
four。 Use the Cacti monitoring system:
1. Log in to the management platform, and after completing the Cacti initialization installation, go directly to the web login interface, as shown in the following figure, enter the default administrator username and password (admin/admin):
two。 Login for the first time is mandatory to change the password. After the change is completed, you can enter the management interface:
3. Set the version of the RRDtool tool and the path to the font: in the Cacti console interface, click "Settings" in the left sidebar, open the Cacti system Settings interface, and make sure that the "RRDtool Application version" in the "General" tab is set to "RRDtool1.2.x".
Locate the RRDtool default font path in the paths tab and set the font path to / usr/share/fonts/zh_TW/TrueType/bsmi00lp.ttf:
4. Add monitored devices or hosts: (in this lab, add a Linux ftp server as the monitoring object)
To connect to the host, in the Cacti console, click "Devices" under "Management" in the left column, and then click the "add" button above to go to the page of adding new devices:
The device added in this lab is "Linux Vsftp Server", the device IP address is "192.168.0.77", the device template selects "ucd/net SNMP device", the "SNMP version" selects "version 1", and then click "create" to complete the addition and connect for the first time:
Specify the monitoring project: after successfully connecting to the monitored host (192.168.0.77), you can see the message "saved successfully", and you can see the default monitoring project at the bottom of the page. In addition, you can add the required image template and data query name according to your actual needs:
Then save the settings:
5. Generate a monitoring image:
To create an image, click "New Image" in the left sidebar of the Cacti console, go to the image creation page, specify the host to draw the image at the "device" drop-down menu, check the monitoring project that needs to create the image, click "create" at the bottom right of the page, and click "create" button again in the page that appears.
Add an image to the monitoring tree:
Click "Image Tree" under "Management" in the left column of the Cacti console, click "default" on the right to manage the default monitoring tree, and click "add" on the right to add "branch" node items to the default monitoring tree. There are three types of "device", "image" and "header". In this experiment, a "device" node is added, and the last week is "create":
6. Perform the first initialization and add scheduled tasks on the Cacti monitoring server, and collect monitoring data regularly:
[root@linux5234 cacti] # su-cacti
[cacti@linux5234] $php / var/www/html/cacti/poller. Php / / the cacti user must be used to perform the first initialization. The following data indicates that the initialization is successful and the monitoring image can be viewed. If there is no following data, the normal monitoring image will not be seen.
OK u:0.00 s:0.14 r:2.82
OK u:0.00 s:0.14 r:2.83
OK u:0.00 s:0.14 r:2.83
OK u:0.00 s:0.14 r:2.83
OK u:0.00 s:0.15 r:2.85
OK u:0.00 s:0.15 r:2.85
OK u:0.00 s:0.18 r:2.89
OK u:0.00 s:0.18 r:2.89
OK u:0.00 s:0.18 r:4.85
OK u:0.00 s:0.18 r:4.85
OK u:0.00 s:0.18 r:5.93
OK u:0.00 s:0.18 r:5.93
OK u:0.00 s:0.18 r:5.94
OK u:0.00 s:0.18 r:5.94
OK u:0.00 s:0.18 r:5.99
OK u:0.00 s:0.18 r:5.99
OK u:0.00 s:0.18 r:5.99
OK u:0.00 s:0.18 r:5.99
OK u:0.00 s:0.18 r:6.00
OK u:0.00 s:0.18 r:6.00
OK u:0.00 s:0.18 r:6.00
OK u:0.00 s:0.18 r:6.00
OK u:0.00 s:0.18 r:6.00
OK u:0.00 s:0.18 r:6.00
OK u:0.00 s:0.18 r:6.00
OK u:0.00 s:0.18 r:6.00
OK u:0.00 s:0.18 r:6.00
OK u:0.00 s:0.18 r:6.00
OK u:0.00 s:0.18 r:7.04
OK u:0.00 s:0.19 r:7.04
OK u:0.00 s:0.19 r:7.04
OK u:0.00 s:0.19 r:7.04
OK u:0.00 s:0.19 r:7.04
OK u:0.00 s:0.19 r:7.05
11:42:31 AM-SYSTEM STATS: Time:9.2262 Method:cmd. Php Processes:1 Threads:N/A Hosts:3 HostsPerProcess:3 DataSources:25 RRDsProcessed:21
OK u:0.00 s:0.19 r:8.11
OK u:0.00 s:0.19 r:8.11
OK u:0.00 s:0.19 r:8.11
OK u:0.00 s:0.19 r:8.11
OK u:0.00 s:0.19 r:8.11
OK u:0.00 s:0.19 r:8.11
OK u:0.00 s:0.19 r:8.11
OK u:0.01 s:0.19 r:8.11
[cacti@linux5234 ~] $crontab-e / / add scheduled tasks
* / 5 * / usr/bin/ php / var/www/html/cacti/poller. Php & > / dev/null
[cacti@linux5234 ~] $exit
[root@linux5234 cacti] # service crond start
[root@linux5234 cacti] # chkconfig-- level 35 crond on
7. View the monitoring results: (monitoring image interface)
Click the "View Image" tab at the top of the Cacti console, then expand the "default" monitoring tree in the left sidebar, click the device you want to view ("Linux Vsftp Server"), and view the graphical list information of the monitoring project:
Cacti so far, the configuration has been completed, in addition, the use of Cacti, set up according to the actual needs, you can also add some plug-ins supported by Cacti, get some extended services.
The above is how to build the Cacti monitoring system under RHEL5. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
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.