cacti安装过程.doc_第1页
cacti安装过程.doc_第2页
cacti安装过程.doc_第3页
cacti安装过程.doc_第4页
cacti安装过程.doc_第5页
已阅读5页,还剩24页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

服务器监控2009年11月20日16:08大体安装过程:先装 rrd tools 再配置 cacti 在配置cacti的时候,就要开始配置 snmp客户端然后配置apache插件 http:/xok.la/2009/05/cacti_apache_templates.html再安装mysql插件 /mysqlUtils/teMySQLcacti-20060810.tar.gz再安装/downloads/plugins/cacti-plugin-0.8.7e-PA-v2.6.zip 这里安装不成功 是安装成功了,页面却乱了无法访问了安装了monitor模块 /downloads/monitor.gzip接下来主要就是扩展了非标准化安装 CACTI把网页源码包放入apache 网页根目录配置include/config.php文件 3导入数据库文件 4配置crontab自动运行的那个程序*/1 * * * * /var/www/html/cacti-0.8.7e/poller.php /dev/null2&1把网页源码权限改成777Cacti 插件/模块/自定义/优化2009年11月24日14:45=安装cacti模板= 所有模板都在/about15067.html -这里的东西完完整.详细1) 安装mysql模板 下载模板wget /mysqlUtils/teMySQLcacti-20060810.tar.gz tar xzfv teMySQLcacti-20060810.tar.gz 解出来后里面有几个xml文件,php文件,sh文件以及readme。 先把XML文件导入web页面的模板里面。(需要全部导入) 再把两个PHP文件即mysql_stats.php,dumpMemcachedStats.php文件复制到cacti目录下的scripts里面。 这个时候可以在添加设备的时候加入mysql模块了。 注:如果是要监控远端数据库,需要有访问远端数据库的权限。 在被监控机器上vi /etc/sysconfig/iptables 加入 -A RH-Firewall-1-INPUT -s yourip -m udp -p udp -dport 161 -j ACCEPT -A RH-Firewall-1-INPUT -s yourip -m tcp -p tcp -dport 3306 -j ACCEPT 然后进入数据库 GRANT PROCESS ON * TO cacticactimachine IDENTIFIED by cactipasswd; GRANT SUPER ON * TO cacti%cactimachine IDENTIFIED BY cactipasswd; mysql -uroot -p GRANT ALL PRIVILEGES ON *.* TO rootyourip IDENTIFIED BY yourpassword WITH GRANT OPTION; 再在监控机上测试mysql -h ip -uroot -pyourpasswor 如果可以连的上就说明配置成功,就可以在添加设备的时候添加监控mysql模块了。否则poller.php执行不过去会导致不画图。总结:1.在mysql服务器上添加cacti服务器mysql访问权限 GRANT PROCESS ON * TO cacticactimachine IDENTIFIED by cactipasswd;GRANT PROCESS ON * TO cacti8 IDENTIFIED by cactianlai; GRANT SUPER ON * TO cacti%cactimachine IDENTIFIED BY cactipasswd;GRANT SUPER ON * TO cacti8 IDENTIFIED by cactianlai;2./mysqlUtils/teMySQLcacti-20060810.tar.gz上下载源码3.把源码当中的php文件放入cacti/scripts/目录4.在cacti界面当中import templates5.创建图表,成功2)安装apache模板 下载后得到apachestats-0.4.zip 解开后里面有三个文件夹docs,xml,scripts 与上面一样,把XML文件导入模板,scripts里面的文件复制到cacti目录里面的scripts。 现在就可以在添加设备里面添加监控apache了。cacti添加apache监控模板 以下网站有详细方法http:/xok.la/2009/05/cacti_apache_templates.html总结:1.在apache服务器上开始server-status功能2.在服务器上下载源码3.把源码当中的php文件放入cacti/scripts/目录4.在cacti界面当中import templates5.创建图表,成功3) 其他模板都是与同样的方式安装,基本常用的模板在上面说的网站中都可以找到=安装cacti插件= 插件可以在 /downloads/1)安装Plugin Architecture 这个是安装所有插件所必须装的 wget /downloads/plugins/cacti-plugin-0.8.7e-PA-v2.6.zip 解开以后里面有file-08.6x,对应你所安装的cacti版本, cd file-0.8.6i 把里面的所有文件复制到cacti 目录里面, cp * /usr/local/apache/htdocs/cacti/2) 安装monitor插件 下载monitor插件 wget /downloads/plugins/monitor-0.7.tar.gz tar zvxf monitor-0.7.tar.gz 把该目录复制到plugins里 cp -r monitor /usr/local/apache/htdocs/cacti/plugins/ 然后修改include里的config.php文件 vi /usr/local/apache/htdocs/cacti/include/config.php 加上$plugins = monitor; 保存修改3)安装thold插件 方式与安装monitor插件一样。源文档 自定义步骤:Cacti进阶应用二:使用cacti获取snmp发送的自定义信息后作图我的步骤:1.在被监控端服务器上添加获取并发的脚本,在/etc/snmp/snmpd.conf添加以下语句,然后重启snmpdexec ..4.1.2021.51 channels /usr/bin/php -q /var/lib/asterisk/agi-bin/ChannelsMonitor.php ;注意修改以下代码当中连接服务器的manager账号2.在cacti监控端执行snmpwalk -v 1 xxx.xxx.xx.xx -c public ..4.1.2021.51snmpwalk -v 1 xxx.xxx.xx.xx -c public ..4.1.20snmpwalk -v 1 xxx.xxx.xx.xx -c public ..4.1.20看看是否有数据获取到,如果能够得到,那就成功了,然后就根据下面的步骤,先创建Data tempalte -graph template,在Devices对需要执行此监控的服务器添加此监控模板,然后在创建此监控报表,此至完成总结:对于asterisk channels的监控有两种做法a. 在cacti服务器,使用AMI远程登录asterisk服务器,获取通道信息, 问题在于snmp是否要创建多个exec呢?那这样就需要创建多个模板,然后就是在本地服务器上创建监控报表,感觉这种方案虽对AMI的维护方便,但数据的创建及区别比较麻烦。b. 在cacti服务器使用snmp与其他各服务器asterisk通信,其他asterisk服务器获取数据后,使用snmp传送到总服务器。此方针对客户端服务器只需要监控总的并发,比较方便,只需要创建一种模板,但如果客户端要分别监控单条E1的时候,这也不省力了。源文档 snmp提供了发送自定义信息的功能。查看snmpd.conf会看到有一个小节是关于外部脚本的,Executables/scripts。这个小节里面也举了例子,告诉你怎么通过snmp发送信息。在snmpd.conf任意位置添加一行:exec ..4.1.2021.18 tcpCurrEstab /etc/tcpconn.sh其中tcpCurrEstab是命令的名称,后面是命令以及参数。命令的名称可以随便起。脚本执行的结果类似下面:# /etc/tcpconn.sh80脚本内容如下: 1. $ cat tcpconn.sh2. #!/bin/sh3. conn=netstat -s -t | grep connections established |awk print $14. echo $conn复制代码重启snmpd,然后远程通过snmpwalk接收一下数据看看: 5. # snmpwalk -c public -v 2c ..4.1.2021.18 6. UCD-SNMP-MIB:ucdavis.18.1.1 = INTEGER: 17. UCD-SNMP-MIB:ucdavis.18.2.1 = STRING: tcpCurrEstab8. UCD-SNMP-MIB:ucdavis.18.3.1 = STRING: /etc/tcpconn_total.sh9. UCD-SNMP-MIB:ucdavis.18.100.1 = INTEGER: 010. UCD-SNMP-MIB:ucdavis.18.101.1 = STRING: 48811. UCD-SNMP-MIB:ucdavis.18.102.1 = INTEGER: 012. UCD-SNMP-MIB:ucdavis.18.103.1 = 复制代码其中我们需要的是UCD-SNMP-MIB:ucdavis.18.101.1 = STRING: “488这一行: 13. # snmpwalk -v 1 01 -c public ..4.1.2014. UCD-SNMP-MIB:ucdavis.18.101.1 = STRING: 488复制代码能采集到数据之后,就可以配置cacti来接收了。在cacti界面中console-Templates-Data Templates,然后点击右上角的Add,Data Templates中的name是给这个数据模板的命名,Data Source中的name将来显示在Data Sources中,我这里添加“|host_description| - Tcp Conn. - ESTBLISHED”,选get snmp data,Internal Data Source Name也可以随便添,这个用来给rrd文件命名。设置完后就可以save了,save之后会发现下面多了一些选项,在最下面那个添上我们需要的数据的 OID“..4.1.20”,可以保存了。此后需要创建一个Graph Templates,好让cacti生成图片。在cacti界面中console-Templates-Graph Templates,然后点击右上角的Add,Templates中的name是给这个数据模板的命名,Graph Template中的name是将来显示在图片上面中间的内容,我这里添加“|host_description| - Tcp Conn. - ESTBLISHED”,其他保持默认,保存之后上面会出来一些选项。在Graph Template Items中添加一个item,Data Source选之前添加的,color选择一个图片的颜色,Graph Item Type选AREA,也就是区域,也可以选其他的线条,Text Format设置说明。然后再添加一个,Graph Item Type选GPRINT,Consolidation Function选LAST,也就是当前的值,Text Format输入current。你还可以添加一些Graph Item Type为COMMENT的注释说明等。现在只要为host添加这个画图模板就可以看到画出来的图了。源文档 cacti设置一分钟刷新Submitted by 林刚 on 2009, September 16, 10:47 AM. 系统运维与监控cacti默认是5分钟采集下数据库,总是感觉反应太慢,对一些变化比较大的数据明显不准确,就一直考虑将采集时间修改为1分钟,因为需要监控的服务器很少,对系统负荷影响不大1. 将crontab从5分钟一次更改为1分钟一次2. Poller Interval和Cron Interval修改为每分钟3.Data Sources 的step(采样时间)修改为60,heartbeat(超时)修改为120,也可以简单用SQL命令修改下UPDATE data_template_data SET rrd_step=60 WHERE rrd_step=300;UPDATE data_template_rrd SET rrd_heartbeat=120 WHERE rrd_heartbeat=600; UPDATE poller_item SET rrd_step = 60 WHERE rrd_step = 300;4. 修改RRAs,将显示时间修改为1分钟,画图时间还是保留5分钟将RRAS的年月日的steps缩小五倍,Rows增加五倍,也可以用SQL语句DELETE FROM rra; 4 rows affectedINSERT INTO rra VALUES (1,c21df5178e5c955013591239eb0afd46,Daily (1Minute Average),0.5,1,8000,86400);INSERT INTO rra VALUES (2,0d9c0af8b8acdc7807943937b3208e29,Weekly (30Minute Average),0.5,30,1600,604800);INSERT INTO rra VALUES (3,6fc2d038fb42950138b0ce3e9874cc60,Monthly (2Hour Average),0.5,120,1600,2678400);INSERT INTO rra VALUES (4,e36f3adb9f152adfa5dc50fd2b23337e,Yearly (1 DayAverage),0.5,1440,1600,33053184);5、就是放弃原来以每5分钟取得的数据,把rra目录下的文件都删除了源文档 RRD tools2009年11月20日16:08RRDBUILD(1) rrdtool RRDBUILD(1)RRD TOOLs安装步骤:NAME rrdbuild - Instructions for building RRDtoolOVERVIEW If you downloaded the source of RRDtool you have to compile it. This document will give some information on how this is done. RRDtool relies on services of third part libraries. Some of these libraries may already be installed on your system. You have to compile copies of the other ones before you can build RRDtool. This document will tell you about all the necessary steps to get going. These instructions assume you are using a bash shell. If you use csh/tcsh, then you can either type bash to switch to bash for the compilation or if you know what you are doing just replace the export bits with setenv. We further assume that your copies of tar and make are actually GNU tar and GNU make respectively. It could be that they are installed as gtar and gmake on your system.OPTIMISTIC BUILD Before you start to build RRDtool, you have to decide two things: 1. In which directory you want to build the software. 2. Where you want to install the software. Once you have decided. Save the two locations into environment variables.注意:不建议使用rrdtools 1.4版本,会导致自定义snmp数据无法显示,这是因为当前cacti 0.8.7a只支持到rrdtoolss 1.3.X,对1.4版本支持不好。建议使用rrdtools 1.2.30所有的源码包在下载rrdtools的地方就会有,http:/oss.oetiker.ch/rrdtool/pub/http:/oss.oetiker.ch/rrdtool/pub/libs/ BUILD_DIR=/tmp/rrdbuild INSTALL_DIR=/usr/local/rrdtool-1.4.2Export BUILD_DIRExport INSTALL_DIR If your /tmp is mounted with the option noexec (RHEL seems todo that) you have to choose a different directory! Now make sure the BUILD_DIR exists and go there: mkdir -p $BUILD_DIR cd $BUILD_DIR Lets first assume you already have all the necessary libraries pre- installed. wget http:/oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.2.tar.gz gunzip -c rrdtool-1.4.2.tar.gz | tar xf - cd rrdtool-1.4.2 ./configure -prefix=$INSTALL_DIR & make & make install Ok, this was very optimistic. This try will probably have ended with configure complaining about several missing libraries.INSTALLING DEPENDENCIES If your OS lets you install additional packages from a software repository, you may get away with installing the missing packages. When the packages are installed, run configure again and try to compile again. Below you find some hints on getting your OS ready for compiling RRDtool. Additions to this list are welcome. In general RRDtool should work with the latest versions of the libraries. The versions listed here are just what was current when I tested this. Debian / Ubuntu Use apt-get to make sure you have all that is required. A number of packages will get added through dependencies. apt-get install libpango1.0-dev libxml2-dev Gentoo In Gentoo installing RRDtool is really simple you just need to emerge rrdtool. All dependencies will be handled automatically by the portage system. The only thing you should care about are USE flags, which allow you fine tune features RRDtool will be built with. Currently the following USE flags are available: doc - install .html and .txt documentation into /usr/share/doc/rrdtool-1.x.xx/ perl - build and install perl language bindings python - build and install python language bindings ruby - build and install ruby language bindings tcl - build and install tcl language bindings rrdcgi - build and install rrdcgi After youve decided which USE flags you need, set them either in make.conf or /etc/portage/package.use and finally run: # emerge -va rrdtool Take a look at Gentoo handbook for further details on how to manage USE flags: /doc/en/handbook/handbook-x86.xml?part=2BUILDING DEPENDENCIES But again this may have been too optimistic still, and you actually have to compile your own copies of some of the required libraries. Things like libpng and zlib are pretty standard so you will probably have them on your system anyway. Freetype, Fontinst, Cairo, Pango may be installed, but it is possible that they are pretty old and thus dont live up to our expectations, so you may want to compile their latest versions. General build tips for AIX If you are working with AIX, you may find the -disable-shared option will cause things to break for you. In that case you may have to install the shared libraries into the RRDtool PREFIX and work with -disable-static instead. Another hint to get RRDtool working on AIX is to use the IBM XL C Compiler: export CC=/usr/vac/bin/cc export PERLCC=$CC (Better instructions for AIX welcome!) Build Instructions Some libraries want to know where other libraries are. For this to work, set the following environment variable export PKG_CONFIG_PATH=$INSTALL_DIR/lib/pkgconfig export PATH=$INSTALL_DIR/bin:$PATH The above relies on the presence of the pkgconfig program. Below you find instructions on how to compile pkgconfig. Since we are compiling libraries dynamically, they must know where to find each other. This is done by setting an appropriate LDFLAGS. Unfortunately, the syntax again differs from system to system: Solaris export LDFLAGS=-R$INSTALL_DIR/lib if you are using the Sun Studio/Forte compiler, you may also want to set CFLAGS=-xO3 -xcode=pic13 (SPARC) CFLAGS=-xO3 -Kpic (x86) Linux export LDFLAGS=-Wl,-rpath -Wl,$INSTALL_DIR/lib yum install cairo-devel pango-devel HPUX export LDFLAGS=+b$INSTALL_DIR/lib AIX export LDFLAGS=-Wl,-blibpath:$INSTALL_DIR/lib If you have GNU make installed and it is not called make, then do export MAKE=gmake export GNUMAKE=gmake otherwise just do export MAKE=make Building pkgconfig As mentioned above, without pkgconfig the whole build process will be lots of pain and suffering, so make sure you have a copy on your system. If it is not available natively, here is how to compile it. wget /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 After installing pkgconfig in a custom directory, setting up the corresponding environment variable will be helpful. export PKG_CONFIG=$INSTALL_DIR/bin/pkg-config Building zlib Chances are very high that you already have that on your system .这里的zlib可以使用yum install 的方法来安装 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 Building libpng Libpng itself requires zlib to build, so we need to help a bit. If you already have a copy of zlib on your system (which is very likely) you can drop the settings of LDFLAGS and CPPFLAGS. Note that the backslash () at the end of line 4 means that line 4 and line 5 are on one line. 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.10 env CFLAGS=-O3 -fPIC ./configure -prefix=$INSTALL_DIR $MAKE $MAKE install Building freetype 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 If you run into problems building freetype on Solaris, you may want to try to add the following at the start the configure line: env EGREP=egrep Building LibXML2 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 Building fontconfig Note that fontconfig has a run time configuration file in INSTALL_DIR/etc you may want to adjust that so that fontconfig finds the fonts on your system. Run the fc-cache program to build the fontconfig cache after changing the config file. 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 Building Pixman 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 installLibraries have been installed in: /usr/local/rrdtool-1.4.2/libIf you ever happen to want to link against installed librariesin a given directory, LIBDIR, you must either use libtool, andspecify the full pathname of the lib

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论