Centos7 安装 Cacti 1.2

1. 安装web server(略)

注意系统时间/时区

ntp server是否定时同步

2. 安装 mysql 5.7 (略)

安装成功后

2.1 编辑 my.ini 文件在 [mysqld] 下面添加以下内容

[mysqld]

collation_server = utf8mb4_unicode_ci
character_set_server = utf8mb4

max_allowed_packet = 16777216
max_heap_table_size = 62M
tmp_table_size = 62M
join_buffer_size = 132M
innodb_buffer_pool_size = 964M
innodb_flush_log_at_timeout = 3
innodb_read_io_threads = 32
innodb_write_io_threads = 16
innodb_buffer_pool_size= 1G
innodb_buffer_pool_instances = 9
innodb_io_capacity = 5000
innodb_io_capacity_max = 10000

2.2 运行

# mysql_tzinfo_to_sql /usr/share/zoneinfo/Asia/Shanghai Shanghai | mysql -u root -p mysql

扫描二维码关注公众号,回复: 11358550 查看本文章

否则web检查会报错

ERROR: Your MySQL TimeZone database is not populated. Please populate this database before proceeding.

重启 mysqld 服务

3. 安装 php 5.6 (略)

安装完应该支持以下模块

[PHP Modules]
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
json
ldap
libxml
mbstring
mhash
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
snmp
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zip
zlib

[Zend Modules]
PHP Modules

编辑 php.ini 文件
需要修改或确认的内容:

1: date.timezone = Asia/Shanghai
2: max_execution_time = 90
3: memory_limit = 800M

重启web服务

4 .安装其他软件包

net-snmp-utils
rrdtool
patch

5. 安装cacti准备工作

官方参考URL:https://docs.cacti.net/manual:088:1_installation.1_install_unix

# wget https://www.cacti.net/downloads/cacti-1.2.12.zip

5.1 下载解压 cacti 

# wget https://www.cacti.net/downloads/cacti-1.2.12.zip

解压改名后放在网站跟目录后面

测试默认安装路径:/var/www/html/cacti

5.2 编辑 include/config.php 文件

填入连接 mysql  用户名/密码

5.3  新建cacti用数据库/用户/授权/导入SQL

mysqladmin -uroot -p create cacti
mysql -uroot -p -e "grant all on cacti.* to 'someuser'@'localhost' identified by 'somepassword'"
mysql -uroot -p -e "grant select on mysql.time_zone_name to 'someuser'@'localhost' identified by 'somepassword'"
mysql -uroot -p cacti < /var/www/html/cacti/cacti.sql
注意:数据库配置不当的情况下导入会出错

5.4 确认可写目录权限

chown -R apache.apache /var/www/html/cacti/resource/snmp_queries/
chown -R apache.apache /var/www/html/cacti/resource/script_server/
chown -R apache.apache /var/www/html/cacti/resource/script_queries/
chown -R apache.apache /var/www/html/cacti/scripts/
chown -R apache.apache /var/www/html/cacti/cache/boost/
chown -R apache.apache /var/www/html/cacti/cache/mibcache/
chown -R apache.apache /var/www/html/cacti/cache/realtime/
chown -R apache.apache /var/www/html/cacti/cache/spikekill/

6. web安装向导

6.1 环境检查

http://xxx.xxx.xx.xxx/cacti

应该全部OK ,如有问题需个别处理,安装目录权限稍后另行处理。

注意: 如果数据库 charset 不准确按照过程中可能会进行转换

7. 安装后的确认

登陆URL:http://xxx.xxx.xx.xxx/cacti

7.1 默认用户名密码 

admin/admin

7.2 添加 cron 任务

crontab -e 或 /etc/crontab

*/5 * * * * user /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1

7.3 查看cacti 服务器默认图形

如果没有可以手动先运行一次

 /usr/bin/php /var/www/html/cacti/poller.php

7.4 图形数据采集确认

注意查看rra目录下的文件权限
/var/www/html/cacti/rra/*

# cd /var/www/html/cacti/rra/
# rrdtool fetch ./local_linux_machine_mem_buffers_4.rrd AVERAGE mem_buffers

1592465100: -nan
1592465400: -nan
1592465700: -nan
1592466000: -nan
1592466300: 2.8767520000e+06
1592466600: 2.8754762667e+06
1592466900: 2.8742958933e+06
1592467200: -nan

默认5分钟采集一次,如果都是 -nan 说明数据没有采集到,需要确认权限或定时任务 

猜你喜欢

转载自www.cnblogs.com/tamatama/p/13187902.html