ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Cacti安装配置

Cacti安装配置

Linux操作系统 作者:urgel_babay 时间:2016-05-11 16:57:57 0 删除 编辑
<div> <h3 style="line-height:normal;orphans:2;text-align:-webkit-auto;white-space:normal;margin:0px 0px 10px;padding:0px;border:0px;-webkit-font-smoothing:antialiased;font-size:18px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;"> Cacti介绍 </h3> <p style="orphans:2;text-align:-webkit-auto;white-space:normal;margin-top:10px;margin-bottom:15px;border:0px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;font-size:14px;line-height:22.3999996185303px;"> Cacti是用php语言实现的一个软件,它的主要功能是用snmp服务获取数据,然后用rrdtool储存和更新数据,当用户需要查看数据的时候用rrdtool生成图表呈现给用户。因此,snmp和rrdtool是cacti的关键。 </p> <p style="orphans:2;text-align:-webkit-auto;white-space:normal;margin-top:15px;margin-bottom:15px;border:0px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;font-size:14px;line-height:22.3999996185303px;"> Snmp关系着数据的收集,rrdtool关系着数据存储和图表的生成。snmp抓到数据不是存储在mysql中,而是存在rrdtool生成的rrd文件中(在cacti根目录的rra文件夹下,一般以rra为后缀名称)。 </p> <h3 style="line-height:normal;orphans:2;text-align:-webkit-auto;white-space:normal;margin:20px 0px 10px;padding:0px;border:0px;-webkit-font-smoothing:antialiased;font-size:18px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;"> 安装rrdtool采集工具 </h3> <pre style="orphans:2;text-align:-webkit-auto;margin-top:15px;margin-bottom:15px;padding:6px 10px;border:1px solid #CCCCCC;font-size:13px;font-family:Consolas, 'Liberation Mono', Courier, monospace;line-height:19px;overflow:auto;border-radius:3px;color:#333333;background-color:#F8F8F8;"><code style="margin:0px;padding:0px;border:none;font-size:12px;font-family:Consolas, 'Liberation Mono', Courier, monospace;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:transparent;">shell &gt; yum install cairo-devel libxml2-devel pango pango-devel libart_lgpl libart_lgpl-deve shell &gt; tar xzf rrdtool-1.4.5.tar.gz shell &gt; cd rrdtool-1.4.5 shell &gt; ./configure --prefix=/usr/local/rrdtool --disable-python --disable-tcl shell &gt; make &amp;&amp; make install shell &gt; ln -s /usr/local/rrdtool/bin/* /usr/local/bin/</code></pre> <h3 style="line-height:normal;orphans:2;text-align:-webkit-auto;white-space:normal;margin:20px 0px 10px;padding:0px;border:0px;-webkit-font-smoothing:antialiased;font-size:18px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;"> 安装SNMP服务 </h3> <pre style="orphans:2;text-align:-webkit-auto;margin-top:15px;margin-bottom:15px;padding:6px 10px;border:1px solid #CCCCCC;font-size:13px;font-family:Consolas, 'Liberation Mono', Courier, monospace;line-height:19px;overflow:auto;border-radius:3px;color:#333333;background-color:#F8F8F8;"><code style="margin:0px;padding:0px;border:none;font-size:12px;font-family:Consolas, 'Liberation Mono', Courier, monospace;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:transparent;">shell &gt; yum install net-snmp net-snmp-utils shell &gt; vim /etc/snmp/snmpd.conf ================================================================================ com2sec notConfigUser 127.0.0.1 public access notConfigGroup "" any noauth exact all none none view all included .1 80 ================================================================================ shell &gt; chkconfig snmpd on shell &gt; service snmpd start</code></pre> <h3 style="line-height:normal;orphans:2;text-align:-webkit-auto;white-space:normal;margin:20px 0px 10px;padding:0px;border:0px;-webkit-font-smoothing:antialiased;font-size:18px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;"> 安装cacti </h3> <pre style="orphans:2;text-align:-webkit-auto;margin-top:15px;margin-bottom:15px;padding:6px 10px;border:1px solid #CCCCCC;font-size:13px;font-family:Consolas, 'Liberation Mono', Courier, monospace;line-height:19px;overflow:auto;border-radius:3px;color:#333333;background-color:#F8F8F8;"><code style="margin:0px;padding:0px;border:none;font-size:12px;font-family:Consolas, 'Liberation Mono', Courier, monospace;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:transparent;">shell &gt; tar zxvf cacti-0.8.8c.tar.gz shell &gt; mv cacti-0.8.8c /usr/local/apache2/htdocs/cacti 创建cacti数据库并导入数据 mysql&gt; CREATE DATABASE cacti DEFAULT CHARACTER SET utf8; mysql&gt; grant all on cacti.* to cacti@'localhost' identified by "123@qwe"; mysql&gt; flush privileges; shell &gt; mysql -u cacti -p123@qwe cacti &lt; /usr/local/apache2/htdocs/cacti/cacti.sql shell &gt; chmod -R 777 /usr/local/apache2/htdocs/cacti/rra shell &gt; chmod -R 777 /usr/local/apache2/htdocs/cacti/log 修改/usr/local/apache2/htdocs/cacti/include/config.php数据库配置</code></pre> <h3 style="line-height:normal;orphans:2;text-align:-webkit-auto;white-space:normal;margin:20px 0px 10px;padding:0px;border:0px;-webkit-font-smoothing:antialiased;font-size:18px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;"> 安装spine </h3> <p style="orphans:2;text-align:-webkit-auto;white-space:normal;margin-top:10px;margin-bottom:15px;border:0px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;font-size:14px;line-height:22.3999996185303px;"> spine是一个基于C语言的,非常快速的轮询引擎。它是默认的cmd.php的可选替代,主要是为了加快SNMP轮训。 </p> <pre style="orphans:2;text-align:-webkit-auto;margin-top:15px;margin-bottom:15px;padding:6px 10px;border:1px solid #CCCCCC;font-size:13px;font-family:Consolas, 'Liberation Mono', Courier, monospace;line-height:19px;overflow:auto;border-radius:3px;color:#333333;background-color:#F8F8F8;"><code style="margin:0px;padding:0px;border:none;font-size:12px;font-family:Consolas, 'Liberation Mono', Courier, monospace;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:transparent;">shell &gt; yum install net-snmp-devel mysql-devel shell &gt; tar zxvf cacti-spine-0.8.8c.tar.gz shell &gt; cd cacti-spine-0.8.8c shell &gt; ./configure --prefix=/usr/local/spine shell &gt; make &amp;&amp; make install shell &gt; cp /usr/local/spine/etc/spine.conf.dist /usr/local/spine/etc/spine.conf 修改/usr/local/spine/etc/spine.conf数据库配置</code></pre> <h3 style="line-height:normal;orphans:2;text-align:-webkit-auto;white-space:normal;margin:20px 0px 10px;padding:0px;border:0px;-webkit-font-smoothing:antialiased;font-size:18px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;"> 添加Rrdtool抓图任务计划 </h3> <pre style="orphans:2;text-align:-webkit-auto;margin-top:15px;margin-bottom:15px;padding:6px 10px;border:1px solid #CCCCCC;font-size:13px;font-family:Consolas, 'Liberation Mono', Courier, monospace;line-height:19px;overflow:auto;border-radius:3px;color:#333333;background-color:#F8F8F8;"><code style="margin:0px;padding:0px;border:none;font-size:12px;font-family:Consolas, 'Liberation Mono', Courier, monospace;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:transparent;">shell &gt; crontab -l */5 * * * * /usr/bin/php /usr/local/apache2/htdocs/cacti/poller.php &gt; /dev/null 2&gt;&amp;1 shell &gt; service crond restart</code></pre> <h3 style="line-height:normal;orphans:2;text-align:-webkit-auto;white-space:normal;margin:20px 0px 10px;padding:0px;border:0px;-webkit-font-smoothing:antialiased;font-size:18px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;"> Cacti安装完毕,测试访问 </h3> <ol style="orphans:2;text-align:-webkit-auto;white-space:normal;margin:15px 0px;padding:0px 0px 0px 30px;border:0px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;font-size:14px;line-height:22.3999996185303px;"> <li style="margin:0px;padding:0px;border:0px;"> 访问http:///cacti --&gt; next </li> <li style="margin:0px;padding:0px;border:0px;"> new install --&gt; next </li> <li style="margin:0px;padding:0px;border:0px;"> 修改安装路径 --&gt; finish </li> <li style="margin:0px;padding:0px;border:0px;"> 登录默认用户密码admin/admin, 修改保存密码 </li> </ol> <p style="orphans:2;text-align:-webkit-auto;white-space:normal;margin-top:15px;margin-bottom:15px;border:0px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;font-size:14px;line-height:22.3999996185303px;"> 参考:<br /> <a href="http://os.51cto.com/art/201411/458006_all.htm" style="margin:0px;padding:0px;border:0px;color:#4183C4;text-decoration:none;">http://os.51cto.com/art/201411/458006_all.htm</a><br /> <a href="https://blog.linuxeye.com/314.html" style="margin:0px;padding:0px;border:0px;color:#4183C4;text-decoration:none;">https://blog.linuxeye.com/314.html</a><br /> <a href="http://blog.chinaunix.net/uid-17015055-id-3071761.html" style="margin:0px;padding:0px;border:0px;color:#4183C4;text-decoration:none;">http://blog.chinaunix.net/uid-17015055-id-3071761.html</a> </p> <h2 style="line-height:normal;orphans:2;text-align:-webkit-auto;white-space:normal;margin:20px 0px 10px;padding:0px;border-width:0px 0px 1px;border-bottom-style:solid;border-bottom-color:#CCCCCC;-webkit-font-smoothing:antialiased;font-size:24px;font-family:Helvetica, arial, freesans, clean, sans-serif;"> 整理自网络 </h2> <p style="orphans:2;text-align:-webkit-auto;white-space:normal;margin-top:10px;margin-bottom:0px;border:0px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;font-size:14px;line-height:22.3999996185303px;"> <strong style="margin:0px;padding:0px;border:0px;"><em style="margin:0px;padding:0px;border:0px;">Svoid</em></strong><br /> <strong style="margin:0px;padding:0px;border:0px;"><em style="margin:0px;padding:0px;border:0px;">2015-07-08</em></strong> </p> </div>

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30936525/viewspace-2097933/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2016-02-29

  • 博文量
    203
  • 访问量
    339113