mrtg+cpu等的GD图库

由 leaper 在 07-20-2004 16:48 发表:

mrtg+cpu等的GD图库

1.所需要的软件包

gd-2.0.15.tar.gzjpeg-v6b.tar.gz

libpng-1.2.5.tar.gz

zlib-1.1.4.tar.gz

freetype-2.1.5.tar.bz2

rpm -ivh net-snmp-5.06-17.i386.rpm (这个在redhat9.0的第二张上有)

2、安装jpeg-6b

#./configure

make

make install

make install-lib

//以前因为没有执行这一步安装导致在编译php时报错

3、libpng-1.2.5的安装配置

#cp scripts/makefile.gcmmx makefile

//makefile.gcmmx是针对MMX指令集优化的

#make && make install

4、zlib-1.1.4安装配置

#./configure --shared

//shared生成zlib的共享库文件

#make && make install

5、freetype-2.1.5安装配置

#./configure

#make

#make install

6.gd-1.0.15安装配置

#./configure

//配置完成后,注意输出的信息是否如下:

//** Configuration summary for gd 2.0.15:

// Support for PNG library: yes

// Support for JPEG library: yes

// Support for Freetype 2.x library: yes

// Support for Xpm library: no

// Xpm库以前安装不成功,如果程序部门不常用用,一般PNG/JPEG/FREETYPE三个库打开支持就行

#make && make install

#cp gd.h /usr/local/lib

//编译PHP的时候会缺少这个文件出错

9、安装net-snmp

#rpm -ivh net-snmp-5.06-17.i386.rpm

#rpm -ivh net-snmp-devel-5.06-17.i386.rpm

10、安装mrtg

#tar xzvf mrtg-2.9.29.tar.gz

#./configure --prefix=/usr/local/mrtg --with-gd=/usr/include --with-gd-lib=/usr/lib --with-gd-inc=/usr/include --with-png=/usr/include --with-zlib=/usr/include

#vi /etc/snmp/snmpd.conf

#make

#make install

//安装完以后,配置/etc/snmp/snmpd.conf文件,使其能配合mrtg工作。

//把下面的#号去掉

//#view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc

//access notConfigGroup "" any noauth exact systemview none none

//改为:

//access notConfigGroup "" any noauth exact mib2 none none

//找到以下行,如果没有请在最后加上,一定要加上,注意再注

// rocommunity mrtg

//ok,改完以后,就可以启动snmpd服务,SNMP配置也到此完成了。

#/etc/rc.d/init.d/snmpd start

11、配置mrtg:

#mkdir /data/www/htdocs/mrtg

#cp images/* /data/www/htdocs/mrtg

#/usr/local/mrtg/bin/cfgmaker --output=/data/www/htdocs/mrtg/mrtg.cfg > [email protected]

//这里是创建一个mrtg.cfg文件

//特别注意:在 [email protected]这一行呢,mrtg 是有其意义的(在 snmp 这个通讯服务里面的预设搜寻的一个代码,默认的可能是public,这就是刚才要查看/etc/snmp/snmpd.conf里的原因了),所以,如果你的主机的动态 DNS 名称为 your.domain.name 则你就『一定』要写成 [email protected] 才行!

//在/data/www/htdocs/mrtg目录下,并且监控192.168.0.1的地址,本例这个地址是本机的网卡IP地址

#vi /data/www/htdocs/mrtg/mrtg.cfg

#修改mrtg.cfg文件,主要修改以下内容,以符合你的实际情况

WorkDir: /var/www/html/mrtg

Options[_]: growright, bits

Language:GB2312

#/usr/local/mrtg/bin/mrtg /data/www/htdocs/mrtg/mrtg.cfg

12、制作首页:index.html

#/usr/local/mrtg/bin/indexmaker --output=/data/www/htdocs/mrtg/index.html --title=服务器流量统计 /data/www/htdocs/mrtg/mrtg.cfg

#crontab -e

*/5 * * * * /usr/local/mrtg/bin/mrtg /data/www/htdocs/mrtg/mrtg.cfg

13、# http://192.168.0.1/mrtg/

如果你的安装成功。哪么可以增加CPU的状态

14、在mrtg目录下建立一个cpu.cfg的文件

LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt

Target[cpu]:ssCpuRawUser.0&ssCpuRawIdle.0:[email protected]

RouterUptime[cpu]: [email protected]

MaxBytes[cpu]: 100

Title[cpu]: CPU LOAD

PageTop[cpu]:

1<h1>User CPU Load %</h1>

Unscaled[cpu]: ymwd

ShortLegend[cpu]: %

YLegend[cpu]: CPU Utilization

Legend1[cpu]: User CPU in % (Load)

Legend2[cpu]: Idle CPU in % (Load)

Legend3[cpu]:

Legend4[cpu]:

LegendI[cpu]: User

LegendO[cpu]: Idle

Options[cpu]: growright,nopercent

WorkDir:/data/www/htdocs/mrtg/

Language:gb2312

15、重新启动snmp服务

#/usr/local/mrtg/bin/mrtg /data/www/htdocs/mrtg/cpu.cfg

//将会在mrtg目录下建立一个cpu.html文件 这样就大功告成了

别忘记在crontab -e中增加

/usr/local/mrtg/bin/mrtg /data/www/htdocs/mrtg/cpu.cfg

其它的还在制作中。我想方法都一样的。

http://ohaha.ks.edu.tw/mrtg-cpu2.php

http://net-snmp.sourceforge.net/tut...mrtg/index.html


由 leaper 在 07-20-2004 16:55 发表:


查看CPU的状态只要在 http://url/mrtg/cpu.html

如有什么问题请回复。本人在安装过程中出现了不少问题

但最后还是解决了。本人的平台是:redhat 9.0

其它平台上没有试过。欢迎交流。


由 Snoopy 在 07-20-2004 19:24 发表:


支持,加精 ,兄弟继续努力咯


And then in the evening light, when the bars of freedom fall

I watch the two of you in the shadows on the wall

How in the darkness steals some of the choices from my hand

Then will I begin to under


由 leaper 在 07-20-2004 20:52 发表:


初来贵地,多多关照


由 camor 在 07-20-2004 23:00 发表:

出错了...

/var/www/mrtg/cpu#mrtg /var/www/mrtg/cpu/04cpu.cfg

SNMP Error:

Received SNMP response with error code

error status: noSuchName

index 1 (OID: 1.3.6.1.4.1.2021.11.50.0)

SNMPv1_Session (remote host: "192.168.0.4" [192.168.0.4].161)

community: "mrtg"

request ID: 1812923572

PDU bufsize: 8000 bytes

timeout: 2s

retries: 5

backoff: 1)

at /usr/bin/../lib/mrtg2/SNMP_util.pm line 486

SNMPGET Problem for ssCpuRawUser.0 ssCpuRawIdle.0 sysUptime sysName on [email protected]::::::v4only

at /usr/bin/mrtg line 1798

ERROR: Target[cpu][IN] ' $target->[0]{$mode} ' did not eval into defined data

ERROR: Target[cpu][OUT] ' $target->[0]{$mode} ' did not eval into defined data

WARNING: Skipping Update of cpu, inlast is not defined

W

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus