感谢支持
我们一直在努力

在Red Hat Enterprise Linux 5.3安装RRDTool

关于RRDTool的简单介绍:


RRDTool是由Tobias Oetiker开发的自由软件,它使用RRD(Round Robin Database)作为存储格式,Round robin是一种处理定量数据、以及当前元素指针的技术。RRDTool主要用来跟踪对象的变化情况,生成这些变化的走势图。


其实它和mrtg 是同一家族, 主要都是在产生time-series 的图档(如流量,负载,温度,人数…..),不过因为mrtg 当初的考量是画两种资料在图上(或四个值),后来原作者觉得不足,所以另外又开发了rrdtool, rrdtool 本身可和mrtg 结合,但其结合基本上仅在于将mrtg 的文字档的log 转成rrd 储存格式,通常user 尚需要mrtg-rrd/rrdcgi 去转换,不过总觉得美中不足,因为最终其实你用到的还是rrdtool,虽然还有像my14all (http://my14all.sourceforge.net/) 这类的tools可以转换并画图,但其追根究底还是以rrdtool 为base, 所以rrdtool 变成了最终也是最好的选择。


平心而论rrdtool 的学习远比mrtg 来得困难,且相关文件资料也没有mrtg多,其中中文的参考又几乎没有,如果没有较深厚的Linux 基础(尤其是Shell Script) 或了解SNMP,懂得英文及好学的心,否则是不建议学习rrdtool 的.因为你可能很难去控制或获得你所要的资料,亦可能难于表现图档。


当然,每个人看法不见得相同,完全看个人需要而定,就像用mrtg 画CPU Load, Memory Usage,HTTP Client, Process…., 纯使用mrtg 是较简单且好用的,但是你要做很多图,每张图之间的关联生基本上可能需要你用眼睛去判断.但如果使用rrdtool 可以让你四张叠成一张,如此也较好比较出其中的因果关系,不过此时你得懂得控制图的表现方式来达到显示上最好的结果.基本上学rrdtool 完全不需要有mrtg 的经验. 但最好对系统资讯获得的方法(cmd/ snmp/Shell Script )熟一点会较好处理.
 
RRDTool的优点:灵活,开放:
 
RRDTool的典型应用:
Cacti
NTOP
Nagios
SmokePing
RRDWeather 等等:(我下面就会有一篇博客来写关于NTOP的配置)
 
 
好了,下面开始安装我们的RRDTool:
 
安装RRDTool的时候经常出现一下问题:
如:我已经下载包所谓的rrdtool的rrdtool – 1.3.1.tar.gz包了。但是./ configure命令发放大量的错误提示信息。我要如何的在Red Hat Enterprise Linux 5.x – 64 安装RRDtool呢?
因为:RRD是Round Robin Database的缩写。RRD是一个系统用来存储和显示的时间序列数据(即网络带宽,机房温度,服务器的平均负载)。它存储数据在一个非常紧凑的方式,将不随时间变化的数据扩大,并提出了处理数据,以执行某种有用的数据密度图。它可以使用,也可以通过简单的包装脚本(shell或perl)或通过前端设备的调查网络,提供友好的用户界面。
 
 
 下面介绍在RHEL上安装RRDTool。
为了在Red Hat Enterprise Linux 上安装RRTool,您需要安装一些开发工具和库。
 
步骤1:安装需要依赖的包:
以root用户登录,然后输入一下命令:
#yum install cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel libart_lgpl-devel
输入此命令后出出现以下信息:
Loaded plugins: rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Package pango-1.14.9-6.el5.i386 already installed and latest version
Package freetype-2.2.1-21.el5_3.i386 already installed and latest version
Resolving Dependencies
–> Running transaction check
—> Package cairo-devel.i386 0:1.2.4-5.el5 set to be updated
–> Processing Dependency: fontconfig-devel >= 2.0 for package: cairo-devel
–> Processing Dependency: libXrender-devel for package: cairo-devel
—> Package freetype-devel.i386 0:2.2.1-21.el5_3 set to be updated
–> Processing Dependency: zlib-devel for package: freetype-devel
—> Package libart_lgpl-devel.i386 0:2.3.17-4 set to be updated
—> Package libpng-devel.i386 2:1.2.10-7.1.el5_3.2 set to be updated
—> Package libxml2-devel.i386 0:2.6.26-2.1.2.8 set to be updated
—> Package pango-devel.i386 0:1.14.9-6.el5 set to be updated
–> Processing Dependency: glib2-devel >= 2.12.0-1 for package: pango-devel
–> Processing Dependency: libX11-devel for package: pango-devel
–> Processing Dependency: libXft-devel for package: pango-devel
–> Processing Dependency: libXext-devel for package: pango-devel
–> Running transaction check
—> Package fontconfig-devel.i386 0:2.4.1-7.el5 set to be updated
—> Package glib2-devel.i386 0:2.12.3-4.el5_3.1 set to be updated
—> Package libX11-devel.i386 0:1.0.3-11.el5 set to be updated
–> Processing Dependency: xorg-x11-proto-devel >= 7.1-2 for package: libX11-devel
–> Processing Dependency: libXau-devel for package: libX11-devel
–> Processing Dependency: libXdmcp-devel for package: libX11-devel
—> Package libXext-devel.i386 0:1.0.1-2.1 set to be updated
—> Package libXft-devel.i386 0:2.1.10-1.1 set to be updated
—> Package libXrender-devel.i386 0:0.9.1-3.1 set to be updated
—> Package zlib-devel.i386 0:1.2.3-3 set to be updated
–> Running transaction check
—> Package libXau-devel.i386 0:1.0.1-3.1 set to be updated
—> Package libXdmcp-devel.i386 0:1.0.1-2.1 set to be updated
—> Package xorg-x11-proto-devel.i386 0:7.1-13.el5 set to be updated
–> Processing Dependency: mesa-libGL-devel for package: xorg-x11-proto-devel
–> Running transaction check
—> Package mesa-libGL-devel.i386 0:6.5.1-7.7.el5 set to be updated
–> Finished Dependency Resolution
 
Dependencies Resolved
 
================================================================================
 Package                   Arch      Version                    Repository
                                                                           Size
================================================================================
Installing:
 cairo-devel               i386      1.2.4-5.el5                base      130 k
 freetype-devel            i386      2.2.1-21.el5_3             base      146 k
 libart_lgpl-devel         i386      2.3.17-4                   base       21 k
 libpng-devel              i386      2:1.2.10-7.1.el5_3.2       base      181 k
 libxml2-devel             i386      2.6.26-2.1.2.8             base      2.1 M
 pango-devel               i386      1.14.9-6.el5               base      274 k
Installing for dependencies:
 fontconfig-devel          i386      2.4.1-7.el5                base      168 k
 glib2-devel               i386      2.12.3-4.el5_3.1           base      1.2 M
 libX11-devel              i386      1.0.3-11.el5               base      661 k
 libXau-devel              i386      1.0.1-3.1                  base       11 k
 libXdmcp-devel            i386      1.0.1-2.1                  base      7.6 k
 libXext-devel             i386      1.0.1-2.1                  base       57 k
 libXft-devel              i386      2.1.10-1.1                 base       16 k
 libXrender-devel          i386      0.9.1-3.1                  base      8.9 k
 mesa-libGL-devel          i386      6.5.1-7.7.el5              base      465 k
 xorg-x11-proto-devel      i386      7.1-13.el5                 base      247 k
 zlib-devel                i386      1.2.3-3                    base      100 k
 
Transaction Summary
================================================================================
Install     17 Package(s)        
Update       0 Package(s)        
Remove       0 Package(s)        
 
Total download size: 5.8 M
Is this ok [y/N]: y
Downloading Packages:
(1/17): libXdmcp-devel-1.0.1-2.1.i386.rpm                | 7.6 kB     00:00    
(2/17): libXrender-devel-0.9.1-3.1.i386.rpm              | 8.9 kB     00:00    
(3/17): libXau-devel-1.0.1-3.1.i386.rpm                  |  11 kB     00:00    
(4/17): libXft-devel-2.1.10-1.1.i386.rpm                 |  16 kB     00:00    
(5/17): libart_lgpl-devel-2.3.17-4.i386.rpm              |  21 kB     00:00    
(6/17): libXext-devel-1.0.1-2.1.i386.rpm                 |  57 kB     00:00    
(7/17): zlib-devel-1.2.3-3.i386.rpm                      | 100 kB     00:00    
(8/17): cairo-devel-1.2.4-5.el5.i386.rpm                 | 130 kB     00:00    
(9/17): freetype-devel-2.2.1-21.el5_3.i386.rpm           | 146 kB     00:00    
(10/17): fontconfig-devel-2.4.1-7.el5.i386.rpm           | 168 kB     00:00    
(11/17): libpng-devel-1.2.10-7.1.el5_3.2.i386.rpm        | 181 kB     00:00    
(12/17): xorg-x11-proto-devel-7.1-13.el5.i386.rpm        | 247 kB     00:00    
(13/17): pango-devel-1.14.9-6.el5.i386.rpm               | 274 kB     00:00    
(14/17): mesa-libGL-devel-6.5.1-7.7.el5.i386.rpm         | 465 kB     00:00    
(15/17): libX11-devel-1.0.3-11.el5.i386.rpm              | 661 kB     00:00    
(16/17): glib2-devel-2.12.3-4.el5_3.1.i386.rpm           | 1.2 MB     00:00    
(17/17): libxml2-devel-2.6.26-2.1.2.8.i386.rpm           | 2.1 MB     00:00    
——————————————————————————–
Total                                           2.1 MB/s | 5.8 MB     00:02    
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : zlib-devel                                              1/17
  Installing     : glib2-devel                                             2/17
  Installing     : freetype-devel                                          3/17
  Installing     : fontconfig-devel                                        4/17
  Installing     : libpng-devel                                            5/17
  Installing     : libXau-devel                                            6/17
  Installing     : libxml2-devel                                           7/17
  Installing     : libart_lgpl-devel                                       8/17
  Installing     : xorg-x11-proto-devel                                    9/17
  Installing     : libX11-devel                                           10/17
  Installing     : libXrender-devel                                       11/17
  Installing     : libXft-devel                                           12/17
  Installing     : cairo-devel                                            13/17
  Installing     : libXext-devel                                          14/17
  Installing     : libXdmcp-devel                                         15/17
  Installing     : mesa-libGL-devel                                       16/17
  Installing     : pango-devel                                            17/17
 
Installed:
  cairo-devel.i386 0:1.2.4-5.el5        freetype-devel.i386 0:2.2.1-21.el5_3   
  libart_lgpl-devel.i386 0:2.3.17-4     libpng-devel.i386 2:1.2.10-7.1.el5_3.2 
  libxml2-devel.i386 0:2.6.26-2.1.2.8   pango-devel.i386 0:1.14.9-6.el5        
 
Dependency Installed:
  fontconfig-devel.i386 0:2.4.1-7.el5    glib2-devel.i386 0:2.12.3-4.el5_3.1   
  libX11-devel.i386 0:1.0.3-11.el5       libXau-devel.i386 0:1.0.1-3.1         
  libXdmcp-devel.i386 0:1.0.1-2.1        libXext-devel.i386 0:1.0.1-2.1        
  libXft-devel.i386 0:2.1.10-1.1         libXrender-devel.i386 0:0.9.1-3.1     
  mesa-libGL-devel.i386 0:6.5.1-7.7.el5  xorg-x11-proto-devel.i386 0:7.1-13.el5
  zlib-devel.i386 0:1.2.3-3            
 
Complete!
 
 
步骤2:下载最新版本的RRDTool源码包
#cd /opt/
#wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.3.1.tar.gz
 
#tar -zxvf rrdtool-1.3.1.tar.gz
#cd  rrdtools
步骤3:编译和安装RRDTool:
您需要设置PKG_CONFIG_PATH,请输入
#export PKG_CONFIG_PATH=/usr/lib/pkgconfig/
 
#./configure
 
现在,在RHEL上编译和安装RRDTool。
#make
#make install
#cd /usr/local/
#ln -s rrdtool-1.3.1/ rrdtool/
#cd rrdtool
#ls –l
 
如何验证我的安装呢?
现在RRDTool已经安装上了,并且已经准备好,可以被使用了。您可以到/usr/local/rrdtool/share/rrdtool/examples/ directory 下运行它们去查看你是否成功安装了RRDTool?
 
#cd /usr/local/rrdtool/share/rrdtool/examples/
#./stripes.pl
#ls -l
#cp stripes.png  /var/www/html/  (这一步骤的前提是你本机是个WWW服务器器)
 
 
在浏览器中输入http://www.linuxidc.com/ stripes.png ,看看自己的图形;


500)this.width=500;” border=0>


出现以上图,说明我们的安装是成功的。
 
***可选编译时间设置*****
默认情况下RRDTool将安装在/usr/local/rrdtool-1.3.1/ directory。 如果想修改默认安装目录,使用一下命令安装:
#./configure –prefix=/usr/local/rrdtool
#make install

使用一下命令,让您查看所有编译设置选项:
#./configure  -help
输出一下信息:
`configure’ configures rrdtool 1.3.1 to adapt to many kinds of systems.
 
Usage: ./configure [OPTION]… [VAR=VALUE]…
 
To assign environment variables (e.g., CC, CFLAGS…), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.
 
Defaults for the options are specified in brackets.
 
Configuration:
  -h, –help              display this help and exit
      –help=short        display options specific to this package
      –help=recursive    display the short help of all the included packages
  -V, –version           display version information and exit
  -q, –quiet, –silent   do not print `checking…’ messages
      –cache-file=FILE   cache test results in FILE [disabled]
  -C, –config-cache      alias for `–cache-file=config.cache’
  -n, –no-create         do not create output files
      –srcdir=DIR        find the sources in DIR [configure dir or `..’]
 
Installation directories:
  –prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local/rrdtool-1.3.1]
  –exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]
 
By default, `make install’ will install all the files in
`/usr/local/rrdtool-1.3.1/bin’, `/usr/local/rrdtool-1.3.1/lib’ etc.  You can specify
an installation prefix other than `/usr/local/rrdtool-1.3.1′ using `–prefix’,
for instance `–prefix=$HOME’.
 
For better control, use the options below.
 
Fine tuning of the installation directories:
  –bindir=DIR           user executables [EPREFIX/bin]
  –sbindir=DIR          system admin executables [EPREFIX/sbin]
  –libexecdir=DIR       program executables [EPREFIX/libexec]
  –sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
  –sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
  –localstatedir=DIR    modifiable single-machine data [PREFIX/var]
  –libdir=DIR           object code libraries [EPREFIX/lib]
  –includedir=DIR       C header files [PREFIX/include]
  –oldincludedir=DIR    C header files for non-gcc [/usr/include]
  –datarootdir=DIR      read-only arch.-independent data root [PREFIX/share]
  –datadir=DIR          read-only architecture-independent data [DATAROOTDIR]
  –infodir=DIR          info documentation [DATAROOTDIR/info]
  –localedir=DIR        locale-dependent data [DATAROOTDIR/locale]
  –mandir=DIR           man documentation [DATAROOTDIR/man]
  –docdir=DIR           documentation root [DATAROOTDIR/doc/rrdtool]
  –htmldir=DIR          html documentation [DOCDIR]
  –dvidir=DIR           dvi documentation [DOCDIR]
  –pdfdir=DIR           pdf documentation [DOCDIR]
  –psdir=DIR            ps documentation [DOCDIR]
 
Program names:
  –program-prefix=PREFIX            prepend PREFIX to installed program names
  –program-suffix=SUFFIX            append SUFFIX to installed program names
  –program-transform-name=PROGRAM   run sed PROGRAM on installed program names
 
System types:
  –build=BUILD     configure for building on BUILD [guessed]
  –host=HOST       cross-compile to build programs to run on HOST [BUILD]
  –target=TARGET   configure for building compilers for TARGET [HOST]
 
Optional Features:
  –disable-FEATURE       do not include FEATURE (same as –enable-FEATURE=no)
  –enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  –enable-maintainer-mode  enable make rules and dependencies not useful
                          (and sometimes confusing) to the casual installer
  –disable-rrdcgi        disable building of rrdcgi
  –disable-mmap          disable mmap in rrd_update, use seek+write instead
  –disable-pthread       disable multithread support
  –enable-static-programs  Build static programs
  –disable-dependency-tracking  speeds up one-time build
  –enable-dependency-tracking   do not reject slow dependency extractors
  –enable-shared[=PKGS]  build shared libraries [default=yes]
  –enable-static[=PKGS]  build static libraries [default=yes]
  –enable-fast-install[=PKGS]
                          optimize for fast installation [default=yes]
  –disable-libtool-lock  avoid locking (might break parallel builds)
  –disable-libintl        i18n support (libintl)
  –disable-perl          do not build the perl modules
  –enable-perl-site-install   by default the rrdtool perl modules are installed
                          together with rrdtool in $prefix/lib/perl. You have to
                          put a ‘use lib qw($prefix/lib/perl)’ into your scripts
                          when you want to use them. When you set this option
                          the perl modules will get installed wherever
                          your perl setup thinks it is best.
  –disable-ruby          do not build the ruby modules
  –enable-ruby-site-install   by default the rrdtool ruby modules are installed
                          together with rrdtool in $prefix/lib/ruby. You have to
                          add $prefix/lib/ruby/$ruby_version/$sitearch to you $: variable
                          for ruby to find the RRD.so file.
  –disable-tcl           do not build the tcl modules
  –enable-tcl-site        install the tcl extension in the tcl tree
  –disable-python        do not build the python modules
 
Optional Packages:
  –with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  –without-PACKAGE       do not use PACKAGE (same as –with-PACKAGE=no)
  –with-rrd-default-font=OPTIONS  set the full path to your default font.
  –with-gnu-ld           assume the C compiler uses GNU ld [default=no]
  –with-pic              try to use only PIC/non-PIC objects [default=use
                          both]
  –with-tags[=TAGS]      include additional configurations [automatic]
  –with-perl-options=OPTIONS  options to pass on command-line when
                          generating Makefile from Makefile.PL. If you set this
                          option, interesting things may happen unless you know
                          what you are doing!
  –with-ruby-options=OPTIONS  options to pass on command-line when
                          generating Makefile from extconf.rb. If you set this
                          option, interesting things may happen unless you know
                          what you are doing!
  –with-tcllib=DIR       location of the tclConfig.sh
 
Some influential environment variables:
  RRDGRAPH_YLEGEND_ANGLE
              Vertical label angle: -90.0 (default) or 90.0
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor
  CXX         C++ compiler command
  CXXFLAGS    C++ compiler flags
  CXXCPP      C++ preprocessor
  F77         Fortran 77 compiler command
  FFLAGS      Fortran 77 compiler flags
  PERLCC      [] C compiler for Perl modules
  PERLCCFLAGS [] CC flags for Perl modules
  PERLLD      [same], [as], [PERLCC] Linker for Perl modules
  PERLLDFLAGS [] LD flags for Perl modules
  RRDDOCDIR   [DATADIR/doc/PACKAGE-VERSION] Documentation directory
 
Use these variables to override the choices made by `configure’ or to help
it to find libraries and programs with nonstandard names/locations.
 
 
好了,我们RRDTool就安装完成了。

赞(0) 打赏
转载请注明出处:服务器评测 » 在Red Hat Enterprise Linux 5.3安装RRDTool
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏