cacti 0.8.8h 一键安装包
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cacti 0.8.8h 一键安装包相关的知识,希望对你有一定的参考价值。
cacti 0.8.8h 一键安装脚本
此脚本集成所有最新cacti版本及最新常用插件
包含有thold settings syslog clog monitor等最新插件
rrdtool支持中文字体及中文标题
默认安装为rrdtool1.3版本
脚本中通过yum本地安装了编译了水印的rrdtool的rpm文件。可根据需求增删
注意:此教程中thold的模版目前无法正常引用,正在寻求解决办法
# cacti 0.8.8h 一键安装脚本 # Make by Fenei # E-Mail : [email protected] # Date : 13-Sep-2016 # URL:http://babyfenei.blog.51cto.com/443861/1852324 # 需要中文字体的,请修改settings-Paths-RRDTool Default Font为字体实际位置(/usr/share/fonts/simsun.ttc) # 启用realtime功能的 需要修改 settings-Misc-Cache Directory 为 /var/www/html/cache/ # 启用Spine查询功能的 需要修改 settings-Paths-Spine Poller File Path 为 /usr/local/spine/bin/spine #!/bin/bash chkconfig iptables off service iptables stop sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g‘ /etc/selinux/config /usr/sbin/setenforce 0 yum install -y wget mkdir -p /usr/src/cacti \cp -fr -R * /usr/src/cacti/ cd /usr/src/cacti/ # 安装apache yum install -y httpd chkconfig httpd on service httpd start # 安装mysql yum install -y mysql-server mysql mysql-devel chkconfig mysqld on service mysqld start # 创建数据库用户名密码 mysqladmin -u root password [email protected]@123! yum install -y php php-gd rrdtool php-mysql php-cli php-ldap php-snmp php-mbstring php-mcrypt rsyslog-mysql ntpdate openssh-clients gcc gcc-c++ make automake patch libtool net-snmp-devel openssl-devel gettext ruby mkfontscale fontconfig service httpd restart # 安装字体 cp simsun.ttc /usr/share/fonts/ mkfontscale fc-cache -f -v # 更新rrdtool,此步可以跳过 cd rrdtool/ yum localinstall -y * cd /usr/src/cacti/ # 安装snmp yum install -y net-snmp-utils yum install -y tftp-server chkconfig xinetd on service xinetd start chkconfig snmpd on service snmpd restart # 安装cacti cd /usr/src/cacti/cacti/ tar zxvf cacti*.tar.gz mv -f cacti*/* /var/www/html/ # 创建realtime cache文件夹 cd /usr/src/cacti/ mkdir /var/www/html/cache/ chown -R apache:apache /var/www/html/ # 添加cacti中文标题字体支持 sed -i ‘$i setlocale(LC_CTYPE,"zh_CN.UTF-8");‘ /var/www/html/lib/functions.php # 修改config.php文件中指定cacti网站的后缀名为/ sed -i ‘s/^.*url_path.*$/$url_path = "\/";/‘ /var/www/html/include/config.php sed -i ‘s/^.*date.timezone.*$/date.timezone = "Asia\/Shanghai";/‘ /etc/php.ini service httpd restart # 设置数据库 mysql -u root [email protected]@123! -e ‘CREATE DATABASE `cacti` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;‘ mysql -u root [email protected]@123! -e "CREATE USER ‘cactiuser‘@‘localhost‘ IDENTIFIED BY ‘cactiuser‘;" mysql -u root [email protected]@123! -e ‘GRANT ALL PRIVILEGES ON `cacti` . * TO ‘cactiuser‘@‘localhost‘;‘ mysql -u root [email protected]@123! -e ‘flush privileges;‘ mysql -u cactiuser -pcactiuser cacti --default-character-set=utf8 < /var/www/html/cacti.sql echo "*/5 * * * * root /usr/bin/php /var/www/html/poller.php > /dev/null 2>&1" > /etc/cron.d/cacti # 同步时间命令 \cp -fr /usr/share/zoneinfo/Asia/Shanghai /etc/localtime echo "*/5 * * * * root /usr/sbin/ntpdate time.windows.com > /dev/null 2>&1" > /etc/cron.d/ntp service crond restart # 安装spine cd /usr/src/cacti/spine/ tar zxvf cacti-spine*.tar.gz cd cacti-spine* ./configure make && make install cp /usr/local/spine/etc/spine.conf.dist /usr/local/spine/etc/spine.conf # 如果出现不出图的情况,并运行/usr/local/spine/bin/spine 出错,拷贝spine配置文件到/etc目录 cp /usr/local/spine/etc/spine.conf /etc/ /usr/local/spine/bin/spine cd /usr/src/cacti/ # 安装插件 mkdir /var/www/html/plugins/settings/ tar zxvf settings*.tgz mv settings*/* /var/www/html/plugins/settings/ chown -R apache:apache /var/www/html/plugins/settings/ mkdir /var/www/html/plugins/aggregate/ tar zxvf aggregate*.tgz mv aggregate*/* /var/www/html/plugins/aggregate/ chown -R apache:apache /var/www/html/plugins/aggregate/ mkdir /var/www/html/plugins/syslog/ tar zxvf syslog*.tgz mv syslog*/* /var/www/html/plugins/syslog/ chown -R apache:apache /var/www/html/plugins/syslog/ mkdir /var/www/html/plugins/clog/ tar zxvf clog*.tgz mv clog*/* /var/www/html/plugins/clog/ chown -R apache:apache /var/www/html/plugins/clog/ mkdir /var/www/html/plugins/thold/ tar zxvf thold*.tgz mv thold*/* /var/www/html/plugins/thold/ chown -R apache:apache /var/www/html/plugins/thold/ mkdir /var/www/html/plugins/monitor/ tar zxvf monitor*.tgz mv monitor*/* /var/www/html/plugins/monitor/ chown -R apache:apache /var/www/html/plugins/monitor/ mkdir /var/www/html/plugins/realtime/ tar zxvf realtime*.tgz mv realtime*/* /var/www/html/plugins/realtime/ mkdir -p /var/www/html/plugins/realtime/cache chown -R apache:apache /var/www/html/plugins/realtime/ service httpd restart # 安装syslog支持 yum install -y rsyslog-mysql # 新建syslog数据库并赋予权限 mysql -uroot [email protected]@123! -e ‘create database syslog;‘ mysql -uroot [email protected]@123! -e "GRANT ALL ON syslog.* TO [email protected] IDENTIFIED BY ‘cactiuser‘;" mysql -uroot [email protected]@123! -e ‘flush privileges;‘ mysql -uroot [email protected]@123! syslog --default-character-set=utf8 < /var/www/html/plugins/syslog/syslog.sql # 更改syslog配置,使用单独数据库 sed -i ‘s/$use_cacti_db = true;/$use_cacti_db = false;/‘ /var/www/html/plugins/syslog/config.php # 启用syslog前修改rsyslog部分参数 echo ‘*.* @@localhost:514‘ >> /etc/rsyslog.conf echo ‘$ModLoad imudp‘ >> /etc/rsyslog.conf echo ‘$ModLoad imklog‘ >> /etc/rsyslog.conf echo ‘$ModLoad imuxsock‘ >> /etc/rsyslog.conf echo ‘$ModLoad immark‘ >> /etc/rsyslog.conf echo ‘$ModLoad imtcp‘ >> /etc/rsyslog.conf echo ‘$UDPServerRun 514‘ >> /etc/rsyslog.conf echo ‘$ModLoad ommysql‘ >> /etc/rsyslog.conf echo ‘$template cacti_syslog,"INSERT INTO syslog_incoming(facility, priority, date, time, host, message) values (%syslogfacility%, %syslogpriority%, ‘"‘"‘%timereported:::date-mysql%‘"‘"‘, ‘"‘"‘%timereported:::date-mysql%‘"‘"‘, ‘"‘"‘%HOSTNAME%‘"‘"‘, ‘"‘"‘%msg%‘"‘"‘)", SQL‘ >> /etc/rsyslog.conf echo ‘*.* >localhost,syslog,cactiuser,cactiuser;cacti_syslog‘ >> /etc/rsyslog.conf echo ‘*.* /var/log/file.log‘ >> /etc/rsyslog.conf chkconfig rsyslog on service rsyslog restart # 安装完成,按需修改一下内容 echo "需要中文字体的,请修改settings-Paths-RRDTool Default Font为字体实际位置(/usr/share/fonts/simsun.ttc)" echo "启用realtime功能的 需要修改 settings-Misc-Cache Directory 为 /var/www/html/cache/" echo "启用Spine查询功能的 需要修改 settings-Paths-Spine Poller File Path 为 /usr/local/spine/bin/spine"
附:一键安装包下载地址
本文出自 “www.fenei.com” 博客,请务必保留此出处http://babyfenei.blog.51cto.com/443861/1852324
以上是关于cacti 0.8.8h 一键安装包的主要内容,如果未能解决你的问题,请参考以下文章