cati监控系统
主要监控流量和性能
cati配置安装
1.搭建好LAMP或者LNMP架构的网络服务器架构
安装httpd和php
yum -y install httpd php php-mysql php-snmp php-xml php-ldap php-gd php-mbstring php-posix
systemctl start httpd && systemctl enable httpd
安装Mariadb10.3版本
vim /etc/yum.repos.d/mariadb10.3.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
yum install -y MariaDB-server MariaDB-client MariaDB-devel
systemctl start mariadb && systemctl enable mariadb
数据库创建用户初始化
mysqladmin -u root password '123456'
添加参数
vim /etc/my.cnf.d/server.cnf
[server]
character_set_server = utf8mb4
collation-server = utf8mb4_unicode_ci
max_heap_table_size = 256M
max_allowed_packet = 16777216
tmp_table_size = 64M
join_buffer_size = 64M
innodb_file_per_table = ON
innodb_buffer_pool_size = 1024M
innodb_doublewrite = OFF
innodb_flush_log_at_timeout = 3
innodb_read_io_threads = 32
innodb_write_io_threads =16
innodb_file_format = Barracuda
innodb_large_prefix = 1
测试LAMP
<?php
$a=mysql_connect("localhost","root","123456");
if($a){echo "数据库连接成功!!!";}else{echo "数据库连接失败!!!";}
?>
<?php
phpinfo();
?>
如下图环境搭建成功:
2.安装net-snmp-utils并启动snmp服务
yum –y install net-snmp net-snmp-libs net-snmp-utils net-snmp-devel net-snmp-perl
systemctl start snmpd && systemctl enable snmpd
3.安装rrdtool软件包
安装相关依赖包
yum -y install cairo-devel zlib libxml2 libxml2-devel glib2 glib2-devel libpng libpng-devel freetype freetype_devel libart_lgpl pango pango_devel pear pear_devel perl-CPAN perl-YAML
安装rddtool
yum install -y rrdtool perl-rrdtool rrdtool-devel rrdtool-php
4.安装部署cacti
tar zxf cacti-1.2.12.tar.gz
mv cacti-1.2.12 /var/www/html/cacti
useradd cacti
chown -R apache.apache /var/www/html/cacti/
5.建立数据库,表结构
在建立数据库之前修改该网站的include目录下的config.php文件修改登录数据库用户和登录密码等信息
vim /var/www/html/cacti/include/config.php
$database_type = 'mysql';
$database_default = 'cacti';
$database_hostname = 'localhost';
$database_username = 'cacti'; #这里的用户名和后面数据库授权有关
$database_password = 'cacti'; #这里的密码也和后面的数据库授权有关
$database_port = '3306';
$database_retries = 5;
$database_ssl = false;
$database_ssl_key = '';
$database_ssl_cert = '';
$database_ssl_ca = '';
$url_path = '/cacti/';
登录数据创建表授权
mysql -uroot -p123456
MariaDB [(none)]> create database cacti;
MariaDB [(none)]> grant all on cacti.* to cacti@localhost identified by "cacti";
MariaDB [(none)]> GRANT SELECT ON mysql.time_zone_name TO 'cacti'@'localhost' IDENTIFIED BY 'cacti';
MariaDB [(none)]> quit
导入该网站的数据库
mysql -uroot -p123456 cacti < /var/www/html/cacti/cacti.sql
6.修改时区
mysql_tzinfo_to_sql /usr/share/zoneinfo/ | mysql -uroot -p123456 mysql
vim /etc/php.ini
date.timezone = "Asia/Shanghai"
6.访问网站http://192.168.11.25/cacti/
会自动跳转到安装界面进行安装
安装完成之后