• ADADADADAD

    CentOS 7 安装 cacti 1.1.x[ mysql数据库 ]

    mysql数据库 时间:2024-12-25 09:55:44

    作者:文/会员上传

    简介:

    由于cacti 1.1.x系列发布后,变化比较大,集成了很多插件,自带自动发现功能,所以记录下来,比较适合复制粘贴。环境:CentOS 7.4安装前提a、安装系统补丁yumupdate-yb、开启ntp,保证时

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。

    由于cacti 1.1.x系列发布后,变化比较大,集成了很多插件,自带自动发现功能,所以记录下来,比较适合复制粘贴。

    环境:CentOS 7.4

    安装前提

    a、安装系统补丁

    yumupdate-y

    b、开启ntp,保证时间正确

    yuminstallchrony-ysystemctlenablechronydsystemctlstartchronyd

    c、禁用selinux,重启生效

    sed-i's/SELINUX=.*/SELINUX=disabled/g'/etc/selinux/configreboot

    1、安装mariadb 10.1

    cacti 1.1.0 需要mysql >= 5.6 ,所以这里选择mariadb 10.1

    yuminstallcentos-release-openstack-ocata-yyuminstallmariadb-server-y

    2、mariadb参数调整(参考配置)

    [mysqld]......character-set-server=utf8mb4collation-server=utf8mb4_unicode_cimax_heap_table_size=128Mmax_allowed_packet=32Mtmp_table_size=64Mjoin_buffer_size=64Minnodb_buffer_pool_size=1024Minnodb_doublewrite=offinnodb_flush_log_at_timeout=3

    重启mariadb让配置生效

    systemctlenablemariadbsystemctlstartmariadb

    导入时区信息

    mysql_tzinfo_to_sql/usr/share/zoneinfo/|mysql-urootmysql

    3、安装lamp

    yuminstallhttpdphpphp-mysqlndphp-mbstringphp-ldapphp-processphp-gdphp-snmpphp-pecl-zendopcachephp-xmlwgetnet-snmp-utilsrrdtool-yecho"ServerTokensProd">>/etc/httpd/conf/httpd.confecho"ServerSignatureOff">>/etc/httpd/conf/httpd.confsed-i's/;date.timezone.*/date.timezone=PRC/g'/etc/php.inimkdir-p/var/lib/php/sessionchown-Rapache:apache/var/lib/php/sessionsystemctlenablehttpdsystemctlstarthttpd

    4、下载cacti

    cd/var/wwww/htmlwgethttp://www.cacti.net/downloads/cacti-1.1.0.tar.gztarzxvfcacti-1.1.0.tar.gzmvcacti-1.1.0cacticdcactichown-Rapache:apacheresourcescriptslogcache

    5、给cacti建库

    mysql-uroot-e"dropdatabaseifexistscacti"mysql-uroot-e"deletefrommysql.userwhereHost='localhost'andUser='cactiuser'"mysql-uroot-e"createdatabase`cacti`defaultcharactersetutf8mb4collateutf8mb4_unicode_ci"mysql-uroot-e"grantalloncacti.*to'cactiuser'@'localhost'identifiedby'cactiuser'"mysql-uroot-e"grantselectonmysql.time_zone_nameto'cactiuser'@'localhost'"mysql-uroot-e"flushprivileges"mysql-urootcacti</var/www/html/cacti/cacti.sql

    6、安装向导

    访问http://ip/cacti 进入安装向导

    7、修改密码

    默认用户密码admin/admin,首次登陆要求改密码,密码长度和复杂度都比较严格,点赞。

    8、定时任务

    设置定时任务,在/etc/crontab 文件中添加一行

    */5****root/usr/bin/php-q/var/www/html/cacti/poller.php>/dev/null

    9、配置自动发现(可选)

    功能有点类似zabbix

    a、定义snmp选项,比如snmpv2,community为abcb、定义扫描网段,比如192.168.0.0/24,定时扫描,发现snmp端口存活的机器自动添加到cacti,c、定义规则,将扫描到的机器,按照操作系统分类,放入不同的tree,划不同的图

    10、安装spine(可选)

    spine是一个c写的程序,性能比默认的poller.php要高很多。

    yuminstallgcclibtoolmakeautoconfmysql-develnet-snmp-develhelp2manwget-ywgettarzxvfcacti-spine-1.1.0.tar.gzcdcacti-spine-1.1.0./bootstrap./configure--with-mysqlmakecpspine/usr/local/bin/cpspine.conf.dist/etc/spine.conf

    /etc/spine.conf文件里记得根据需要修改。

    重装

    如果需要重装,简单的删除数据库,重新初始化即可(第5-7步)

    汉化

    cacti 1.1.x 支持中文,但是汉化不彻底,手痒的同学可以按照下面的办法汉化:

    1、安装

    yuminstallgettext-y

    2、反编译mo文件为po文件

    cd/var/www/html/cacti/locales/LC_MESSAGES/usr/bin/msgunfmtchinese_china_simplified.mo-ochinese_china_simplified.po

    3、用文本编辑器修改文件

    4、编译po文件为mo文件

    /usr/bin/msgfmtchinese_china_simplified.po-ochinese_china_simplified.mo

    CentOS 7 安装 cacti 1.1.x.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: Cacticentosce