关于MRTG获取脚本的一点点理解。
时间:2006-02-24 来源:mantou
MRTG对监控设备和系统的监控作用还是不错的,可以绘出近期工作状态的图象。
在使用中,用MRTG监控本机器的cpu,mem等信息。
#!/bin/sh
memory=`/usr/bin/free -m | grep Mem |awk '{print $4}'`
swap=`/usr/bin/free -m | grep Swap |awk '{print $4}'`
#/usr/bin/free -m | grep Swap |awk '{print $2}'
#/usr/bin/free -m | grep Mem |awk '{print $2}' echo $memory
echo $swap
echo 0
###############Memory info
Target[MEMORY_M]: `/root/memfree`
MaxBytes[MEMORY_M]: 300
Title[MEMORY_M]: Memory & Swap Storge
PageTop[MEMORY_M]: <H1> Memory & Swap Storge </H1>
Options[MEMORY_M]: gauge
Ylegend[MEMORY_M]: Used (M)
#YSize[MEMORY_M]: 280
ShortLegend[MEMORY_M]: M
LegendI[MEMORY_M]: Free Memory
LegendO[MEMORY_M]: Free Swap 他们的数据是如何对应的呢。通过使用发现, 从脚本出来的1,2数据对应 LegendI[***],LegendO[***],这里
LegendI,LegendO谁在前后无所谓,脚本的第一个数据对应 Legend的第一个,可能是I,或O。 如果脚本中有3,4数据,对应at which time 'HUAWEI-3COM BR304' had been up for 4 days, 15:50:16.
这里的机器名和时间吧。 其他的暂时还没有发现,慢慢研究中。
在使用中,用MRTG监控本机器的cpu,mem等信息。
#!/bin/sh
memory=`/usr/bin/free -m | grep Mem |awk '{print $4}'`
swap=`/usr/bin/free -m | grep Swap |awk '{print $4}'`
#/usr/bin/free -m | grep Swap |awk '{print $2}'
#/usr/bin/free -m | grep Mem |awk '{print $2}' echo $memory
echo $swap
echo 0
###############Memory info
Target[MEMORY_M]: `/root/memfree`
MaxBytes[MEMORY_M]: 300
Title[MEMORY_M]: Memory & Swap Storge
PageTop[MEMORY_M]: <H1> Memory & Swap Storge </H1>
Options[MEMORY_M]: gauge
Ylegend[MEMORY_M]: Used (M)
#YSize[MEMORY_M]: 280
ShortLegend[MEMORY_M]: M
LegendI[MEMORY_M]: Free Memory
LegendO[MEMORY_M]: Free Swap 他们的数据是如何对应的呢。通过使用发现, 从脚本出来的1,2数据对应 LegendI[***],LegendO[***],这里
LegendI,LegendO谁在前后无所谓,脚本的第一个数据对应 Legend的第一个,可能是I,或O。 如果脚本中有3,4数据,对应at which time 'HUAWEI-3COM BR304' had been up for 4 days, 15:50:16.
这里的机器名和时间吧。 其他的暂时还没有发现,慢慢研究中。
相关阅读 更多 +