Показать сообщение отдельно
  #18   Пожаловаться на это сообщение  
Старый 28-07-2010, 07:28
kolaCZek kolaCZek вне форума
Junior Member
 
Регистрация: Jul 2010
Адрес: Prague, Czech Republic
Сообщения: 10
Отправить сообщение для  kolaCZek с помощью ICQ
Lightbulb

Some interesting MRTG settings and scripts...

CPU



MRTG settings
Код:
Target[cpu]: `/opt/etc/mrtg/cpu.sh`
MaxBytes[cpu]: 500
Title[cpu]: server CPU Load (5 minute average)
YLegend[cpu]: Load*100
ShortLegend[cpu]: load
Legend1[cpu]: CPU Load (x 100)
Legend2[cpu]:
LegendI[cpu]: 1min load
LegendO[cpu]: 5min load
PageTop[cpu]: server 5-minute average CPU Load
Options[cpu]: gauge,nopercent,integer,growright
cpu.sh
Код:
#!/bin/sh

awk </proc/loadavg '{print (100*$1) "\n" (100*$2) }'
hostname;
echo "loadavg";
Memory


(blue - RAM, green - Swap)

MRTG settings
Код:
Target[memory]: `/opt/etc/mrtg/memory.sh`
Title[memory]: Mem and Swap Usage
PageTop[memory]: <h1>Memory and Swap Usage</h1>
MaxBytes[memory]: 100000000000
ShortLegend[memory]: B
YLegend[memory]: Memory
LegendI[memory]: Swap
LegendO[memory]: Mem
Legend1[memory]: Swap
Legend2[memory]: Mem
Options[memory]: gauge,growright,nopercent
memory.sh
Код:
#!/bin/sh
/usr/bin/free | awk '\
NR==2 {ramUsed = $3 * 1000 }\
NR==3 {swapUsed = $3 * 1000 }\
END { print swapUsed "\n" ramUsed "\n0\n0" }'

Ping



MRTG settings
Код:
Title[ping]: RTT to google.com
PageTop[ping]: <H1>Round Trip Time</H1>
Target[ping]: `/opt/etc/mrtg/ping.sh`
MaxBytes[ping]: 2000
Options[ping]: growright,unknaszero,nopercent,gauge
LegendI[ping]: Pkt loss %
LegendO[ping]: Avg RTT
YLegend[ping]: RTT (ms)
ping.sh
Код:
#!/bin/sh
PING="/bin/ping"
ADDR="google.com"
DATA=`$PING -c10 $ADDR -q `
LOSS=`echo $DATA | awk '{print $18 }' | tr -d %`
echo $LOSS
if [ $LOSS = 100 ];
        then echo 0
else
        echo $DATA | awk -F/ '{print $5 }'
fi
/opt usage



MRTG settings
Код:
Target[df_opt]: `/opt/etc/mrtg/df_opt.sh`
Title[df_opt]: /opt usage
PageTop[df_opt]: <h1>/opt usage</h1>
MaxBytes[df_opt]: 100000000000
ShortLegend[df_opt]: M
YLegend[df_opt]: /opt
LegendI[df_opt]: Free
LegendO[df_opt]: Used
Legend1[df_opt]: Free
Legend2[df_opt]: Used
Options[df_opt]: gauge,growright,nopercent
df_opt.sh
Код:
#!/bin/sh

/bin/df | awk '\
NR==5 {used = $2 / 1024}\
NR==5 {free = $3 / 1024}\
END { print free "\n" used "\n0\n0" }'
/tmp/harddisk usage



MRTG settings
Код:
Target[df_harddisk]: `/opt/etc/mrtg/df_harddisk.sh`
Title[df_harddisk]: /tmp/harddisk usage
PageTop[df_harddisk]: <h1>/tmp/harddisk usage</h1>
MaxBytes[df_harddisk]: 100000000000
ShortLegend[df_harddisk]: M
YLegend[df_harddisk]: /tmp/harddisk
LegendI[df_harddisk]: Free
LegendO[df_harddisk]: Used
Legend1[df_harddisk]: Free
Legend2[df_harddisk]: Used
Options[df_harddisk]: gauge,growright,nopercent
df_harddisk.sh
Код:
#!/bin/sh

/bin/df | awk '\
NR==7 {used = $2 / 1024}\
NR==7 {free = $3 / 1024}\
END { print free "\n" used "\n0\n0" }'
__________________
WL-500gPv2 - 1.9.2.7-d-r2381

Последний раз редактировалось kolaCZek, 12-11-2010 в 11:55.
Ответить с цитированием