In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to install cacti. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
First, build the lamp architecture
1. Yum is as follows:
Yum groupinstall "Web Server"
Yum groupinstall "Mysql Database"
Yum-y install php-mysql
2. Compilation method: (note that the parameter-- enable-sockets should be added when compiling PHP)
Install net-snmp, snmpwalk and snmpget commands
Rpm-qa | grep net-snmp (check whether the required software is already installed in the system)
Yum net-snmp* install installs the above software
Modify the configuration file snmpd.conf to keep the following parts!
Com2sec notConfigUser 10.10.10.80 cheng # # Community name can be customized
Group notConfigGroup v1 notConfigUser
Group notConfigGroup v2c notConfigUser
View systemview included .1.3.6.1.2.1.1
View systemview included .1.3.6.1.2.1.25.1.1
Access notConfigGroup "" any noauth exact all none none
View all included. 1 80
Syslocation Unknown (edit / etc/snmp/snmpd.conf)
Syscontact Root (configure / etc/snmp/snmp.local.conf)
Pass .1.3.6.1.4.1.4413.4.1 / usr/bin/ucd5820stat
# Allow Systems Management Data Engine SNMP to connect to snmpd using SMUX
Smuxpeer .1.3.6.1.4.1.674.10892.1
Service snmpd start
Chkconfig-add snmpd
Chkconfig snmpd on
Finally, run netstat-ln to see if port 161 is open. Or lsof-iPUR 80
3. Install and configure cacti
Tar zxvf cacti-0.8.7g.tar.gz
Mv cacti-0.8.7g cacti # change the name
Mv cacti / data/www/ # moved to the corresponding website root directory
Modify permissions: chown-R cacti:cacti / data/www/cacti # installation process sometimes need to pay attention to permissions, set up the web directory where cacti is located on apache.
Then edit the database configuration file for cacti.
Vi / data/www/cacti/include/config.php
$database_type= "mysql"; # Database type
$database_default = "cacti"; # Database name
$database_hostname = "localhost"; # default is localhost
$database_username = "cactiuser"; # Database user name
$database_password = "cactiuser"; # password
Change user, password, etc., and save exit corresponding to the one given above.
Useadd cacti
# crontab-e (join automatic execution to add cron tasks for cacti users
Su-cacti
* / 5 * / data/php/bin/php / data/www/cacti/poller.php > / dev/null 2 > & 1
(where / data/php/bin/php is the installation directory of php)
Then wq saves and exits.
Configure the database environment:
Do some database operations accordingly:
Enter the database: mysql # I haven't set the password yet
Mysql > GRANT ALL ON cacti.* TO cactiuser@localhostIDENTIFIED BY 'cactiuser'
Mysql > flush privileges; (# refresh permissions)
Mysql > CREATE DATABASE cacti
Mysql > exit (exit database)
Cd / data/www/cacti/
Mysql-u cactiuser-p cacti
< cacti.sql 或者( mysql -u root -p cacti < cacti.sql ) (在 Mysql中创建一个新的库,并导入cacti 目录中cacti.sql 并设置好该表的用户权限) 五、rrdtool安装,(我弄了个脚本一键安装。)脚本如下: rrdtool_install.sh #!/bin/sh export BUILD_DIR=/tmp/rrd export INSTALL_DIR=/usr/local/rrdtool mkdir -p $BUILD_DIR cd $BUILD_DIR wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.5.tar.gz gunzip -c rrdtool-1.4.5.tar.gz | tar xf - cd rrdtool-1.4.5 ./configure --prefix=$INSTALL_DIR && make && make install export LDFLAGS="-Wl,--rpath -Wl,${INSTALL_DIR}/lib" export MAKE=make export PKG_CONFIG_PATH=${INSTALL_DIR}/lib/pkgconfig export PATH=$INSTALL_DIR/bin:$PATH export PKG_CONFIG=$INSTALL_DIR/bin/pkg-config ########################################################################## cd $BUILD_DIR wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz gunzip -c pkg-config-0.23.tar.gz | tar xf - cd pkg-config-0.23 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" $MAKE $MAKE install export PKG_CONFIG=$INSTALL_DIR/bin/pkg-config cd $BUILD_DIR wget http://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz gunzip -c zlib-1.2.3.tar.gz | tar xf - cd zlib-1.2.3 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --shared $MAKE $MAKE install cd $BUILD_DIR wget http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.18.tar.gz gunzip -c libpng-1.2.18.tar.gz | tar xf - cd libpng-1.2.18 env CFLAGS="-O3 -fPIC" ./configure --prefix=$INSTALL_DIR $MAKE $MAKE install cd $BUILD_DIR wget http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.3.5.tar.gz gunzip -c freetype-2.3.5.tar.gz | tar xf - cd freetype-2.3.5 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" $MAKE $MAKE install cd $BUILD_DIR wget http://oss.oetiker.ch/rrdtool/pub/libs/libxml2-2.6.32.tar.gz gunzip -c libxml2-2.6.32.tar.gz | tar xf - cd libxml2-2.6.32 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" $MAKE $MAKE install cd $BUILD_DIR wget http://oss.oetiker.ch/rrdtool/pub/libs/fontconfig-2.4.2.tar.gz gunzip -c fontconfig-2.4.2.tar.gz | tar xf - cd fontconfig-2.4.2 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --with-freetype-config=$INSTALL_DIR/bin/freetype-config $MAKE $MAKE install cd $BUILD_DIR wget http://oss.oetiker.ch/rrdtool/pub/libs/pixman-0.10.0.tar.gz gunzip -c pixman-0.10.0.tar.gz | tar xf - cd pixman-0.10.0 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" $MAKE $MAKE install cd $BUILD_DIR wget http://oss.oetiker.ch/rrdtool/pub/libs/cairo-1.6.4.tar.gz gunzip -c cairo-1.6.4.tar.gz | tar xf - cd cairo-1.6.4 ./configure --prefix=$INSTALL_DIR --enable-xlib=no --enable-xlib-render=no -enable-win32=no CFLAGS="-O3 -fPIC" $MAKE $MAKE install cd $BUILD_DIR wget http://oss.oetiker.ch/rrdtool/pub/libs/glib-2.15.4.tar.gz gunzip -c glib-2.15.4.tar.gz | tar xf - cd glib-2.15.4 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" $MAKE $MAKE install cd $BUILD_DIR wget http://oss.oetiker.ch/rrdtool/pub/libs/pango-1.21.1.tar.bz2 bunzip2 -c pango-1.21.1.tar.bz2 | tar xf - cd pango-1.21.1 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --without-x $MAKE $MAKE install ####Building rrdtool (second try) cd $BUILD_DIR/rrdtool-1.4.5 ./configure --prefix=$INSTALL_DIR --disable-tcl --disable-python $MAKE clean $MAKE $MAKE install ###########################至此安装 rrdtool安装完毕,安装时候可采用我的######## 六、安装cacti-spine tar -xzvf cacti-spine-0.8.7g.tar.gz cd cacti-spine-0.8.7g ./configure --prefix=/usr/local/spine --with-mysql=/data/mysql make && make install 修改: spine.conf vim /usr/local/spine/etc/spine.conf DB_Host localhost #允许本机 DB_Database cacti #所连接的库 DB_User cactiuser #数据库用户 DB_Pass cactiuser #数据库密码 DB_Port 3306 #连接数据库端口 七、登陆配置 进入 cacti 的初始设置页面 第一次默认登陆账号:admin 密码 admin 登陆后它就会让你立即修改新密码 在左边栏点击 settings 如图: 在右边有一排菜单栏,选择 Paths 如下图: 添入如下信息: snmpwalk Binary Path : /usr/bin/snmpwalk snmpget Binary Path: /usr/bin/snmpget snmpbulkwalk Binary Path: /usr/bin/snmpbulkwalk snmpgetnext Binary Path: /usr/bin/snmpgetnext RRDTool Binary Path: /usr/local/rrdtool/bin/rrdtool RRDTool Default Font Path : 不用写 PHP Binary Path: /usr/bin/php Cacti Log File Path: /data/www/cacti/log/cacti.log Spine Poller File Path /usr/local/spine/bin/spine 手动运行一次 /data/php/bin/php /data/www/cacti/poller.php (/data/php 为PHP安装路径) 勾选最后一项 切换到 poller项做以下调整: 在切换到Gerneral项: 配置结束! 八、以下为插件扩展安装 默认的 cacti不方便安装插件,如果要安装插件,需要打一个补丁。对于0.8.7g版本的cacti,应该从cactiusers.org网站上下载并打上这个补丁: cacti-plugin-0.8.7g-PA-v2.8.diff tar -zxvf cacti-plugin-0.8.7g-PA-v2.8.tar.gz cd cacti-plugin-arch/ cp cacti-plugin-0.8.7g-PA-v2.8.diff /data/www/cacti/ cp pa.sql /data/www/cacti/ cd /data/www/cacti patch -p1 -N < cacti-plugin-0.8.7g-PA-v2.8.diff (这个必须是在 cacti目录下执行) mysql -uroot -p cacti < pa.sql 打好补丁后,再用 cactiuser用户登录mysql,使用cacti数据库,导入补丁包中自带的pa.sql文件。 vi include/global.php /* Default database settings*/ $database_type = "mysql"; $database_default = "cacti"; $database_hostname = "localhost"; $database_username = "cactiuser"; $database_password = "cactiuser"; $database_port = "3306"; 经过以上操作, cacti-0.8.7g就具有安装插件的功能了。 九、插件安装 在安装其它插件之前,应该首先安装settings插件,这个插件给cacti增加了发email等功能。 如果不首先安装这个插件在安装完thold!会出现:You are missing a dependency for thold, please install the 'Settings将"settings"插件install-Enable后就可以了。' plugin. 安装具体的插件很简单: mkdir -p /data/www/cacti/plugins #赋予权限 chown -R cacti:cacti /data/www/cacti/plugins 解压各个插件,转移到 cacti的plugins文件夹中,然后登陆cacti网站: 1、 tar -xzvf settings-v0.7-1.tgz mv settings /data/www/cacti/plugins/settings 2、 tar -xzvf thold-latest.tgz mv thold-0.41 /data/www/cacti/plugins/thold cd /data/www/cacti/plugins/thold mysql -uroot -p cacti < thold.sql 3、 tar -xzvf monitor-v1.2-1.tgz mv monitor /data/www/monitor cd /data/www/cacti/plugins/monitor mysql -uroot -p cacti < monitor.sql 4、 tar -xzvf syslog-v1.05-1.tgz mv syslog /data/www/cacti/plugins mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9403 to server version: 5.1.50-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>Create database syslog
Query OK, 1 row affected (0.00 sec)
Mysql > grant all on syslog.* to cactiuser@localhost identified by 'cactiuser'
Query OK, 0 rows affected (0.00 sec)
Mysql-uroot syslog
< /data/www/cacti/plugins/syslog/syslog.sql 5、 tar -xzvf discovery-v1.1-1.tgz mv discovery /data/www/cacti/plugins 6、 rpm -ivh syslog-ng-3.0.4-1.rhel5.i386.rpm warning: syslog-ng-3.0.4-1.rhel5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 2aa28252 Preparing... ########################################### [100%] Shutting down kernel logger: [ OK ] Shutting down system logger: [ OK ] 1:syslog-ng ########################################### [100%] Starting syslog-ng: OK User Managerment->Admin, check the Plugin Managerment item
Configuration- > Plugin Managerment, all plug-ins for Install and Avtive
In this way, all plug-ins are installed and activated, and after the plug-in is installed, you can configure it in Configuration- > Settings, fill in the mail server address and other information, set throld alarm parameters, and so on.
Start the relevant plug-in service under plugin management
Thank you for reading! This is the end of the article on "how to install cacti". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 223
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.