开源监控解决方案:Cacti部署实录
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了开源监控解决方案:Cacti部署实录相关的知识,希望对你有一定的参考价值。
[[email protected] ~]# rpm -ivh epel-release-6-8.noarch.rpm [[email protected] ~]# rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm [[email protected] ~]# yum install -y httpd php php-mysql php-gd libjpeg libjpeg-devel libpng libpng-devel [[email protected] ~]# yum install -y net-snmp net-snmp-utils net-snmp-devel help2man rrdtool cacti
[[email protected] ~]# rpm -ivh http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm [[email protected] ~]# yum install -y mysql-community-server [[email protected] ~]# vi /etc/my.cnf [mysqld] port = 3306 user = mysql character-set-server=utf8 explicit_defaults_for_timestamp sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES open-files-limit = 65535 max_connections = 500 max_connect_errors = 10000 key_buffer_size = 256M max_allowed_packet = 16M read_buffer_size = 1M read_rnd_buffer_size = 1M sort_buffer_size = 1M join_buffer_size = 1M tmp_table_size = 256M max_heap_table_size = 256M table_open_cache = 512 thread_cache_size = 64 slow_query_log = 1 long_query_time = 5 log-queries-not-using-indexes log_bin = mysql-bin binlog_format = row sync_binlog = 1 binlog_cache_size = 16M max_binlog_cache_size = 32M max_binlog_size = 512M expire_logs_days = 7 relay_log = relay-bin relay_log_recovery = 1 master_info_repository = table relay_log_info_repository = table innodb_buffer_pool_size = 2G innodb_buffer_pool_instances = 2 innodb_log_file_size = 128M innodb_log_files_in_group = 3 innodb_log_buffer_size = 16M innodb_undo_logs= 128 innodb_undo_tablespaces = 3 innodb_file_format = Barracuda innodb_strict_mode = 1 innodb_data_file_path = ibdata1:1024M:autoextend [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash default-character-set = utf8 [client] default-character-set = utf8 [[email protected] ~]# service mysqld start [[email protected] ~]# mysql_secure_installation
[[email protected] ~]# vim /etc/httpd/conf/httpd.conf ServerName 192.168.1.201:80 [[email protected] ~]# vim /etc/php.ini date.timezone = Asia/Shanghai
[[email protected] ~]# vim /etc/httpd/conf.d/cacti.conf Alias /cacti /usr/share/cacti <Directory /usr/share/cacti/> <IfModule mod_authz_core.c> # httpd 2.4 Require host localhost </IfModule> <IfModule !mod_authz_core.c> # httpd 2.2 Order deny,allow Deny from all Allow from all </IfModule> </Directory> [[email protected] ~]# /etc/init.d/httpd start Starting httpd: [ OK ]
[[email protected] ~]# mysql -uroot -pabcd.1234 mysql> create database cacti default character set utf8; Query OK, 1 row affected (0.26 sec) mysql> grant all on cacti.* to 'cacti'@'localhost' identified by 'cacti'; Query OK, 0 rows affected (0.09 sec) mysql> grant select on mysql.time_zone_name to 'cacti'@'localhost'; Query OK, 0 rows affected (0.09 sec) [[email protected] ~]# mysql -uroot -p cacti < /usr/share/doc/cacti-1.1.19/cacti.sql [[email protected] ~]# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
[[email protected] ~]# vi /usr/share/cacti/include/config.php $database_type = 'mysql'; $database_default = 'cacti'; $database_hostname = 'localhost'; $database_username = 'cacti'; $database_password = 'cacti'; $database_port = '3306'; $database_ssl = false;
[[email protected] ~]# tar zxvf cacti-spine-1.1.19.tar.gz [[email protected] ~]# cd cacti-spine-1.1.19 [[email protected] cacti-spine-1.1.19]# ./configure [[email protected] cacti-spine-1.1.19]# make & make instal
[[email protected] ~]# cd /usr/local/spine/etc [[email protected] etc]# mv spine.conf.dist spine.conf [[email protected] etc]# vim spine.conf DB_Host localhost DB_Database cacti DB_User cacti DB_Pass cacti DB_Port 3306 RDB_Host localhost RDB_Database cacti RDB_User cacti RDB_Pass cacti RDB_Port 3306
[[email protected] ~]# crontab -e */5 * * * * /usr/bin/php /usr/share/cacti/poller.php
以上是关于开源监控解决方案:Cacti部署实录的主要内容,如果未能解决你的问题,请参考以下文章
开源监控解决方案Nagios+Cacti+PNP4Nagios+NConf+NDOUtils+Nagvis介绍
开源监控解决方案Nagios+Cacti+PNP4Nagios+NConf+NDOUtils+Nagvisnagios+cacti整合