顯示具有 mrtg 標籤的文章。 顯示所有文章
顯示具有 mrtg 標籤的文章。 顯示所有文章

2012/01/20


Some of examples how to monitor cpu and memory usage

CPU Usage

/etc/mrtg/cpu.cfg

WorkDir: /var/www/localhost/htdocs/mrtg
LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt
Target[localhost.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:public@127.0.0.1+ ssCpuRawSystem.0&ssCpuRawSystem.0:public@127.0.0.1+
ssCpuRawNice.0&ssCpuRawNice.0:public@127.0.0.1
RouterUptime[localhost.cpu]: public@127.0.0.1
MaxBytes[localhost.cpu]: 100
Title[localhost.cpu]: CPU Load
PageTop[localhost.cpu]: <H1>Active CPU Load %</H1>
Unscaled[localhost.cpu]: ymwd
ShortLegend[localhost.cpu]: %
YLegend[localhost.cpu]: CPU Utilization
Legend1[localhost.cpu]: Active CPU in % (Load)
Legend2[localhost.cpu]:
Legend3[localhost.cpu]:
Legend4[localhost.cpu]:
LegendI[localhost.cpu]: Active
LegendO[localhost.cpu]:
Options[localhost.cpu]: growright,nopercent

Memory Usage

/etc/mrtg/mem.cfg

LoadMIBs: /usr/share/snmp/mibs/HOST-RESOURCES-MIB.txt
Target[localhost.mem]: .1.3.6.1.4.1.2021.4.6.0&.1.3.6.1.4.1.2021.4.6.0:public@localhost
PageTop[localhost.mem]: <H1>Free Memory</H1>
WorkDir: /var/www/localhost/htdocs/mrtg
Options[localhost.mem]: nopercent,growright,gauge,noinfo
Title[localhost.mem]: Free Memory
MaxBytes[localhost.mem]: 1000000
kMG[localhost.mem]: k,M,G,T,P,X
YLegend[localhost.mem]: bytes
ShortLegend[localhost.mem]: bytes
LegendI[localhost.mem]: Free Memory:
LegendO[localhost.mem]:
Legend1[localhost.mem]: Free memory, not including swap, in bytes

2012/01/19

有問昨天給的OID的問題 在cacti上一直無法成功 想到退回來用mrtg 初步測試是ok的
做一下記錄

安裝完mrtg後手動產生一個test.cfg的檔案如下 (取自vbird) 部分尚未修改完成


# Created by
#          VBird 2001/10/29
### Global Config Options
WorkDir: /var/www/html

### CPU Loading detecting ...
Target[tsai.adsldns.org_person]: `/tmp/2`
MaxBytes[tsai.adsldns.org_person]: 5000000000
Options[tsai.adsldns.org_person]: bits,growright
YLegend[tsai.adsldns.org_person]: Online Users
ShortLegend[tsai.adsldns.org_person]: %
LegendI[tsai.adsldns.org_person]: &nbsp; 連線數目 :
LegendO[tsai.adsldns.org_person]: &nbsp; 上線人數 :
Title[tsai.adsldns.org_person]: WWW 上線人數統計表
PageTop[tsai.adsldns.org_person]: <H1> WWW 主機上線人數 </H1>
 <TABLE>
  <TR><TD>System:</TD>   <TD>Aerosol Lab. in Redhat 6.1 Kernel 2.2.18</TD></TR>
   <TR><TD>Maintainer:</TD> <TD>VBird</TD></TR>
 </TABLE>

另外 2這個檔是去撈private的oid值 如下


#!/bin/bash
in=`/usr/bin/snmpwalk -v 2c -c public 10.0.0.1 1.3.6.1.4.1.8837.4.1.2.3.2.    .4|cut -d '=' -f 2|cut -d ':' -f 2|tr -d ' '`
out=`/usr/bin/snmpwalk -v 2c -c public 10.0.0.1 1.3.6.1.4.1.8837.4.1.2.3.2    1.5|cut -d '=' -f 2|cut -d ':' -f 2|tr -d ' '`
uptime=`/usr/bin/snmpwalk -v 2c -c public 10.0.0.1|grep Up|cut -d ')' -f 2
echo $in
echo $out
echo 設備名稱
echo $uptime


mrtg一定要吃到四個值

接下來進行排程 就可以在 WordDir看到東西了
*/5 * * * * /usr/bin/mrtg /tmp/test.cfg