- 论坛徽章:
- 0
|
监控端(RH9)的好像抓不到被监控服务器(Turbo 8)的内存信息。但在RH9上运行下面的代码,可以得到内存的信息
- snmpwalk -v 1 192.168.100.244 -c public .1.3.6.1.4.1.2021.53 | grep 53.101 | awk -F\" '{print $2}'
- 注:192.168.100.244为(Turbo 8被监控端)
复制代码
下面是我在两台机子的相关的配置文件:
Turbo 8
snmp.cfg:
- rocommunity public 127.0.0.1
- # sec.name source community
- com2sec notConfigUser default public
- # groupName securityModel securityName
- group notConfigGroup v1 notConfigUser
- group notConfigGroup v2c notConfigUser
- # name incl/excl subtree mask(optional)
- view all included .1
- # group context sec.model sec.level prefix read write notif
- access notConfigGroup "" any noauth exact all none none
- exec .1.3.6.1.4.1.2021.53 mfree /bin/sh /fastT/script/mfree.sh
- exec .1.3.6.1.4.1.2021.54 cpustat /bin/sh /fastT/script/cpustat.sh
- exec .1.3.6.1.4.1.2021.55 iostat /bin/sh /fastT/script/iostat.sh
复制代码
fastT/script/mfree.sh
- #!/bin/sh
- /usr/bin/free -m | grep Mem |awk '{print $4}'
- /usr/bin/free -m | grep Mem |awk '{print $2}'
复制代码
RH9-mtrg.cfg
- Target[managemem]:`snmpwalk -v 1 192.168.100.244 -c public .1.3.6.1.4.1.2021.53 | grep 53.101 | awk -F\" '{print $2}'`
- #Targey[wy1_mem]:
- memTotalReal.0&memAvailReal.0:holdata@holdata.3322.org
- Xsize[wy1_mem]: 600
- Ysize[wy1_mem]: 200
- Ytics[wy1_mem]: 9
- MaxBytes[wy1_mem]: 262144
- Title[wy1_mem]:Memory State of WY1 IP 192.168.100.244 Server
- PageTop[wy1_mem]:<H1>;Memory State of WY1 IP 192.168.100.244 Server</H1>;
- ShortLegend[wy1_mem]: MB
- kmg[wy1_mem]: MB
- kilo[wy1_mem]:1024
- YLegend[wy1_mem]: Memory Usage
- Legend1[wy1_mem]: freemem
- Legend2[wy1_mem]: totalmem
- Legend3[wy1_mem]: freemem
- Legend4[wy1_mem]: totalmem
- LegendI[wy1_mem]: freemem
- LegendO[wy1_mem]: toltalmem
- Options[wy1_mem]: growright,gauge,nopercent
复制代码
snmp.cfg
- view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
- 就把#去掉了
复制代码
我也是照葫芦画瓢,现在画不下去了。请高人指点呀!
就是为什么在RH9上执行snmpwalk -v 1 192.168.100.244 -c public .1.3.6.1.4.1.2021.53 | grep 53.101 | awk -F\" '{print $2}'可以得到192.168.100.244(Turbo 的内存信息。放进mrtg.cfg就不行了。和net-snmp ucd-snmp有关吗?我的就是这样。先谢了! |
|