CentOS 7.4源码安装Cacti 1.1.26监控Linux主机图文详解(2)

vi /etc/my.cnf.d/server.cnf //配置cacti网页安装的参数
//[mysqld]下配置以下内容
character_set_server = utf8mb4
collation_server = utf8mb4_unicode_ci
character_set_client = utf8mb4
max_connections = 100
max_heap_table_size = 256M
max_allowed_packet = 16777216
join_buffer_size = 64M
tmp_table_size = 64M
innodb_file_per_table = ON
innodb_buffer_pool_size = 1024M
innodb_doublewrite = OFF
innodb_lock_wait_timeout = 50
innodb_flush_log_at_timeout = 3
innodb_read_io_threads = 32
innodb_write_io_threads = 16

CentOS 7.4源码安装Cacti 1.1.26图文详解


mysql -u root -p //登入数据库

CentOS 7.4源码安装Cacti 1.1.26图文详解


CREATE DATABASE cacti character set utf8 collate utf8_bin;
GRANT all ON cacti. TO 'cacti'@'%' IDENTIFIED BY 'admin123';
GRANT all ON cacti. TO 'cacti'@'localhost' IDENTIFIED BY 'admin123';
flush privileges;

CentOS 7.4源码安装Cacti 1.1.26图文详解

vi /var/www/html/index.php
<?php
$link=mysqli_connect('192.168.80.100','cacti','admin123');
if($link) echo "<h1>Success!!</h1>";
else echo "Fail!!";
?>

CentOS 7.4源码安装Cacti 1.1.26图文详解

测试检测mysql 与php是否协同工作,在浏览器中输入192.168.80.100

CentOS 7.4源码安装Cacti 1.1.26图文详解


如上图所示,表示mysql 与php正协同工作

安装cacti
tar xf cacti-1.1.26.tar.gz
mv cacti-1.1.26 /var/www/html/cacti
mysql -ucacti -p cacti < /var/www/html/cacti/cacti.sql
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot mysql -p


mysql -u root -p

grant select on mysql.time_zone_name to 'cacti'@'%' IDENTIFIED BY 'admin123';
//在数据库中为时区文件授权
flush privileges;

vi /var/www/html/cacti/include/config.php
$database_username = 'cacti';
$database_password = 'admin123';

CentOS 7.4源码安装Cacti 1.1.26图文详解

配置SNMP
vi /etc/snmp/snmpd.conf

com2sec notConfigUser 127.0.0.1 public //改成环回口地址 41

access notConfigGroup "" any noauth exact all none none //把systemview改成all 62

view all included .1 80 // 去掉#号 85

systemctl restart snmpd.service
systemctl enable snmpd.service

useradd -r -M cacti
chown -R cacti /var/www/html/cacti/rra/
chown -R cacti /var/www/html/cacti/log/
chown -R apache.apache /var/www/html/cacti/resource/
chown -R apache.apache /var/www/html/cacti/cache
chown -R apache.apache /var/www/html/cacti/scripts

crontab -e
/5 * /usr/bin/php /var/www/html/cacti/poller.php >> /tmp/cacti_rrdtool.log


安装cacti-spine优化数据轮询速度
ln -s /usr/lib64/libmysqlclient.so.18.0.0 /usr/lib64/libmysqlclient.so

tar xf cacti-spine-1.1.26.tar.gz
cd cacti-spine-1.1.26
./configure && make && make install

cp /usr/local/spine/etc/spine.conf.dist /usr/local/spine/etc/spine.conf

vi /usr/local/spine/etc/spine.conf //修改相关参数

DB_Host localhost
DB_Database cacti
DB_User cacti
DB_Pass admin123
DB_Port 3306

RDB_Host localhost
RDB_Database cacti
RDB_User cacti
RDB_Pass admin123
RDB_Port 3306

CentOS 7.4源码安装Cacti 1.1.26图文详解

systemctl restart httpd
systemctl restart mariadb

-----------登录到页面-----------
192.168.80.181/cacti/
……
安装步骤:

CentOS 7.4源码安装Cacti 1.1.26图文详解

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/fdf4d84337be3caf5281f856c0aaa22a.html