CentOS Linux Monitor the installation C Acti
1 ,Cacti Monitoring Introduction
Cacti is a graphical analysis tool for network traffic monitoring based on PHP,MySQL,SNMP and RRDTool development.
Cacti is a PHP language implementation of a software, its main function is to use the SNMP service to obtain data, and then use RRDtool to store and update data, when users need to view the data The RRDTool generates a chart to be presented to the user. Therefore,SNMP and RRDTool are the key to Cacti. Snmpsnmp is related to the collection of data,and RRDTool is related to the generation of data storage and graphs.
SNMP(Simple Network Management Protocol) collects data that occurs within a device, such as load, disk status, bandwidth, and so on. Network monitoring tools such as CACTI Use this data to generate icons for monitoring purposes.
in a typical Cacti and SNMP deployments, there will be one or more SNMP -enabled devices, and a separate monitoring server to collect SNMP feedback from those devices , so the devices that need to be monitored must be enabled SNMP.
MySQL works with PHP programs to store variable data and make calls to variable data, such as host name, host IP,SNMP community Name, port number, template information, and so on.
The SNMP catch data is not stored in MySQL , but exists in the RRDTool generated RRD file ( under the Rra folder in the cacti root directory ). RRDTool Data Update and storage is the RRD file processing,the RRD file is a fixed size file (roundrobin Archive), The number of data pens it can store is defined when it is created.
2 , deploy Cacti Monitoring Services
Pre-installation preparations:
1), add firewall rules
Vim/etc/sysconfig/iptables
-A input-m state--state new-m tcp-p tcp--dport 80-j ACCEPT
-A input-m state--state new-m tcp-p tcp--dport 3306-j ACCEPT
-A input-m state--state new-m udp-p udp--dport 161-j ACCEPT
: Wq # Save Exit
/etc/init.d/iptables Restart # finally reboot the firewall for configuration to take effect
2), close SELinux
Vim/etc/selinux/config
#SELINUX =enforcing # Comment out
#SELINUXTYPE =targeted # Comment out
selinux=disabled # Increase
: wq! # Save Exit
Setenforce 0 # make the configuration take effect immediately, reboot the system to take effect permanently
3), Monitoring environment Description:
type Operating System IP Address
Monitoring Service Side CentOS6.7 x86_64 192.168.17.10
Monitoring Client CentOS6.7 x86_64 192.168.17.20
Monitoring Client Windows7 192.168.17.1
There are two hosts in the LAN, one Linux, one Windows, you now need to configure a Cacti monitoring Server to monitor the two hosts.
The following are operations on the monitored server (192.168.17.10).
1), because the use of Yum installation, the need to use the Epel extension source
Yum Install-y epel-release
2), install LAMP environment, use Yum installation (according to the actual environment deployment, we recommend the use of source installation)
Yum install-y httpd php php-mysql mysql mysql-servermysql-devel php-gd libjpeg libjpeg-devellibpng libpng-devel
3), install cacti,net-snmprrdtool
Yum install-y cacti Net-snmp net-snmp-utils rrdtool
4), start MySQL,Apache,SNMP service separately
/etc/init.d/mysqld start
/ETC/INIT.D/HTTPD start
/ETC/INIT.D/SNMPD start
5), modify the Apache configuration file http.conf(/etc/httpd/conf/httpd.conf) and cacti.conf( /etc/httpd/conf.d/cacti.conf)
Vim/etc/httpd/conf/httpd.conf
"# ServerName www.example.com:80" to remove the # number, instead of "servernamewww.example.com:80"
Vim/etc/httpd/conf.d/cacti.conf
change "Deny from all" to "Allow from all"
/ETC/INIT.D/HTTPD restart
6), create cacti database and cacti user
MYSQL-UROOT-E "CREATE Database Cacti" # creating Databases
MYSQL-UROOT-E "Grant all on cacti.*to ' cacti ' @ ' 127.0.0.1 ' identified by ' cacti ';"
# Create cacti user
Mysql-uroot Cacti </usr/share/doc/cacti-0.8.8b/cacti.sql
# Import A cacti database template file
7), modify the cacti configuration file used to connect to the database
vim/usr/share/cacti/include/config.php changes as follows:
$database _type = "MySQL"; # Database Type
$database _default = "cacti"; # default Database
$database _hostname = "127.0.0.1"; # Database Address
$database _username = "cacti"; # Database user name
$database _password = "cacti"; # Database Password
$database _port = "3306"; # Database port number
$database _ssl = false;
8. Access cacti and install via web browsing
Http://ip/cacti #ip refers to the installation of cacti server IP, this is 192.168.17.10
Click "Next" and"Finish" at two.
Enter Admin admin login, reset new password
9), execute the poller.php program, generate the graph, and add it to the task plan
/usr/bin/php/usr/share/cacti/poller.php # Executing program generating graphics
CRONTAB-E # added:
*/5 * * * */usr/bin/php/usr/share/cacti/poller.php &>/dev/null
at this point, The CACTI monitoring server is already installed.
3 , configuring the monitored host (monitoring client)
1) Configure the Linux client
Linux clients need to install NET-SNMP and Other related packages, and also need to open the firewall UDP161 port.
(1), open the firewall UDP 161 Port
Vim/etc/sysconfig/iptables # Edit firewall configuration
-A input-m state--state new-m udp-p udp--dport 161-j ACCEPT
/etc/init.d/iptables Restart # Restart The firewall for configuration to take effect
(2), install net-snmp, lm_sensors(Linux hardware monitoring software)
Yum install-y net-snmp lm_sensors
(3), configure snmpd.conf(/etc/snmp/snmpd.conf) and start the SNMP service
Modify syslocation and syscontact, where syslocation can write a machine IP, Syscontact Write admin mailbox
Syslocation 192.168.17.20
Syscontact Root [email protected]
At the same time in the configuration file by the following changes, if not modified will result in the addition of network card detection will not find the network card option;
View SystemView included. 1.3.6.1.2.1.1
modified to :
View SystemView included. 1.3.6.1.2.1
: Wq # Save Exit
/ETC/INIT.D/SNMPD Start # starts the SNMP service
2), configure the Windows client
This is Windows 7, which may not be the same as the 2003 system, but the basic idea is the same.
(1), start à Control Panel à Uninstall program à turn Windows features on or off
find the Simple Network Management Protocol ( SNMP) "Check in front and press OK."
(2), start - run, enter "services.msc" OK, open service Management
Find the " SNMP Service", double-click to open the dialog box will pop up;
in the "security" "Accepted community Name" click "Add" à" community name " fill in "public"
accept from the following hosts in the "Security" SNMP Packet " click" To add "à" 192.168.17.10 "
Finally click "OK"
Then click "Restart" this service in the upper left corner.
at this point, the monitored Windows Host Setup Complete
4 , set Cacti Monitoring Server for Windows and Linux Host for monitoring
1), add monitoring of the Linux host
login to cacti management background,Click "Console"-"Device", in the upper right corner, click "Add"
Description Write Machine IP or you customize a name (webserver)
Hostname Machine IP(192.168.17.20)
Host Template Select ucd/net SNMP Host
Version 2 of SNMP version selected
point in the lower right corner of the Create
In the top right corner, click "Create Graphs for this Host"
Graph Types: Select snmp-interfacestatistics
Select the network card you want to monitor in the box below, for example, I choose eth0, tick the right small square, then click Create in the lower right corner.
point to the left of Graph Trees
Select the Default Tree"
point in the upper right corner of the Add
Tree Item Type Select "Host"
Host Select the machine IP that we just added
Click Create in the lower right corner
point in the upper left corner of the Graphs
On the left you can see
The Defaut Tree below has added the host we just added, the graphics will not come out so quickly at first, it will be a little while.
2), add monitoring of Windows host
in the cacti management background, click"Console"-"Device", in the upper right corner, click "Add"
Description Write Machine IP or you customize a name (Windows 7)
Hostname Machine IP(192.168.17.1)
Host Template Select Windows 2000/xp Host
Version 2 of SNMP version selected
point in the lower right corner of the Create
In the top right corner, click "Create Graphs for this Host"
Graph Types: Select snmp-interfacestatistics
In the box below select the network card to monitor, the disk, tick the corresponding place, then click on the lower right corner of the Create
point to the left of Graph Trees
Select the Default Tree"
point in the upper right corner of the Add
Tree Item Type Select "Host"
Host Select the machine IP that we just added
Click Create in the lower right corner
point in the upper left corner of the Graphs
On the left you can see
The Defaut Tree below has added the host we just added, the graphics will not come out so quickly at first, it will be a little while.
This completes the settings for the monitoring host.
This article is from the "Balich" blog, make sure to keep this source http://balich.blog.51cto.com/6641781/1716539
Cacti of CentOS Linux monitoring installation