]> pere.pagekite.me Git - homepage.git/blob - linux/mrtg/unix-load.sh
Generated.
[homepage.git] / linux / mrtg / unix-load.sh
1 #!/bin/sh
2 #
3 # Expected output from uptime:
4 # 8:50pm up 26 days, 6:46, 24 users, load average: 0.13, 0.14, 0.13
5
6 UPTIME=`uptime`
7 LOAD=`echo $UPTIME|rev|cut -d: -f1|rev`
8
9 AVG1=`echo $LOAD |awk '{print $1}'|cut -d, -f1`
10 VALUE1=`echo "$AVG1 * 100"|bc|cut -d. -f1`
11
12 AVG5=`echo $LOAD|awk '{print $2}'|cut -d, -f1`
13 VALUE5=`echo "$AVG5 * 100"|bc|cut -d. -f1`
14
15 UP=`echo $UPTIME|cut -d, -f 1,2`
16
17 echo $VALUE1
18 echo $VALUE5
19 echo $UP
20 echo localhost