ITPub博客

首页 > Linux操作系统 > Linux操作系统 > MTRG配置

MTRG配置

原创 Linux操作系统 作者:yhj20041128001 时间:2011-03-14 09:38:06 0 删除 编辑

1.Vi 命令编辑 snmpd.conf (/etc/snmp/snmpd.conf)

    去掉行:#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

2.配置MRTG

在目录:/var/www/html    cd /var/www/html 创建目录  mkdir mrtg/

以命令行的模式生成指令:

#cfgmaker public@localhost > /var/www/html/mrtg/mrtg.cfg

在mrtg.cfg文件中   vi /var/www/html/mrtg/mrtg.cfg

添加如行: WorkDir: /var/www/html/mrtg

3.生成监控信息文件

env LANG=C /usr/bin/./mrtg   /var/www/html/mrtg/mrtg.cfg 连续执行三次

4生成监控网页:

indexmaker /var/www/html/mrtg.mrtg.cfg > /var/www/html/mrtg/index.html

5配置httpd  vi /etc/httpd/conf/httpd.conf 找到 DocumentRoot "/var/www/html" 改为

DocumentRoot "/var/www/html/mrtg"

 

6.配置开机启动snmpd ,httpd 服务

setup  ->system services  choose snmpd,httpd(空格键)-tab键退出,确定

service httpd restart 

service snmpd restart

 7.配置http service (setup)

service settings -http    更改文件路径

/var/www/html/mrtg

添加一个搜索页面  index.html

Main Server Name: MRTG

Available Address :191.168.10.11  Port: 80

9检查监控页面信息是否浏览 http://IP/index.html

10.添加其他监控项

cpu 脚本

#!/bin/bash

tmp=`sar -u 1 5 | tail -n 1`

cpuuser=`echo $tmp | awk ' {print $3}' `

cpusystem=`echo $tmp | awk ' {print $5}' `

echo $cpuuser

echo $cpusystem

echo 0

echo `hostname`

Memory脚本

#!/bin/bash

tmp=`sar -r 1 5 | tail -n 1`

memory=`echo $tmp | awk ' {print $4}' `

swap=`echo $tmp | awk ' {print $10}' `

 

 

echo $memory

echo $swap

echo 0

echo `hostname`

 

disk io脚本

#!/bin/sh

used1=`iostat -d /dev/disk 2 3|tail -n 2|awk '{print $3}'`

used2=`iostat -d /dev/disk 2 3|tail -n 2|awk '{print $4}'`

echo $used1

echo $used2

echo 0

echo 0

 

mrtg.cfg文件:


Target[CPU]: `sh /var/www/html/mrtg/cpu.sh`
MaxBytes[CPU]: 100
Options[CPU]: gauge,nopercent,growright
Ylegend[CPU]: CPU Loading (%)
YSize[CPU]: 100
ShortLegend[CPU]: %
LegendI[CPU]: CPU USER
LegendO[CPU]: CPU SYSTEM
Title[CPU]: CPU Watch
PageTop[CPU]:

CPU Watch


 
       
  
  
       
           
 
System:TRAC1
Maintainer: DBA
Description:HP DL580 G4 (Redhat Linux + Oracle10g)
TEL:9999999999999
Ip:192.168.10.17

 

 


Target[MEMORY]: `sh /var/www/html/mrtg/memory.sh`
MaxBytes[MEMORY]: 100
Options[MEMORY]: gauge,growright
Ylegend[MEMORY]: Used (%)
YSize[MEMORY]: 100
ShortLegend[MEMORY]: %
LegendI[MEMORY]:Used Memory
LegendO[MEMORY]:Used Swap
Title[MEMORY]: Memory & Swap Watch
PageTop[MEMORY]:

Memory & Swap Watch


 
       
  
  
       
           
 
System:TRAC1
Maintainer: DBA
Description:HP DL580 G4 (Redhat Linux + Oracle10g)
TEL:99999999999
Ip:192.168.10.11

 


Target[wy1_IO]: `sh /var/www/html/mrtg/diskio.sh`
Xsize[wy1_IO]: 300
Ysize[wy1_IO]: 100
Ytics[wy1_IO]: 7
MaxBytes[wy1_IO]: 10000
ShortLegend[wy1_IO]:
kmg[wy1_IO]: K/s,M/s
kilo[wy1_IO]:1024
YLegend[wy1_IO]: DISK IO SPEED
Legend1[wy1_IO]: IO speed:
Legend2[wy1_IO]: IO speed:
LegendI[wy1_IO]: IO read:
LegendO[wy1_IO]: IO write:
Options[wy1_IO]: growright,gauge,nopercent
Title[wy1_IO]: DISK IO IP 192.168.11.10

PageTop[wy1_IO]:

DISK I/O (Transfer rate 320m/s)State


 
       
  
  
       
           
 
System:N82 SFC DB --mlb21
Maintainer: DBA
Description:HP DL580(Redhat Linux + Oracle9i)
TEL:9999999
Ip:192.168.11.10

 

Options[storage_sda]: growright,gauge,nopercent
Target[storage_sda]: `sh /var/www/html/mrtg/storage-sda.sh`
Xsize[storage_sda]: 300
Ysize[storage_sda]: 100
Ytics[storage_sda]: 7
MaxBytes[storage_sda]: 10000
ShortLegend[storage_sda]:
kmg[storage_sda]: K/s,M/s
kilo[storage_sda]:1024
YLegend[storage_sda]: DISK IO SPEED
Legend1[storage_sda]: IO read:
Legend2[storage_sda]: IO write:
LegendI[storage_sda]: IO read:
LegendO[storage_sda]: IO write:
Title[storage_sda]: STORAGE IO IP 192.168.11.10

PageTop[storage_sda]:

STORAGE I/O (Transfer rate 650m/s)State


 
      
 
 
      
          
 
System:TRAC1
Maintainer: DBA
Description: EVA4000
TEL:9999999
Ip:192.168.11.10

 

方向相反的時候:

網絡流量方向相反圖像

Options[192.168.11.10_2]: growright, bits

 


 

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

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

注册时间:2010-09-17

  • 博文量
    163
  • 访问量
    360308