1 |
#!/usr/bin/perl -W |
2 |
|
3 |
$datetime = `date -u '+%Y%m%d.%H:%M:%S'`; |
4 |
chomp $datetime; |
5 |
|
6 |
$sensors = `sensors`; |
7 |
$sensors =~ /SYS Temp: +([+-][0-9.]+)/; |
8 |
$sys = $1; |
9 |
$sensors =~ /CPU Temp: +([+-][0-9.]+)/; |
10 |
$cpu = $1; |
11 |
|
12 |
$df = `df -k`; |
13 |
$hda1u = $hda1f = $hda3u = $hda3f = $hdc1u = $hdc1f = '-'; |
14 |
($hda1u, $hda1f) = ($1, $2) if $df =~ m|/dev/hda1\s+[0-9]+\s+([0-9]+)\s+([0-9]+)|; |
15 |
($hda3u, $hda3f) = ($1, $2) if $df =~ m|/dev/hda3\s+[0-9]+\s+([0-9]+)\s+([0-9]+)|; |
16 |
($hdc1u, $hdc1f) = ($1, $2) if $df =~ m|/dev/hdc1\s+[0-9]+\s+([0-9]+)\s+([0-9]+)|; |
17 |
|
18 |
$ip = `ip -s -o link show eth0`; |
19 |
$ip =~ /RX:.*?([0-9]+)/; |
20 |
$rx = $1; |
21 |
$ip =~ /TX:.*?([0-9]+)/; |
22 |
$tx = $1; |
23 |
|
24 |
print "$datetime $sys $cpu $hda1u $hda1f $hda3u $hda3f $hdc1u $hdc1f $rx $tx\n"; |