-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_qnap_qad.sh
89 lines (80 loc) · 2.27 KB
/
check_qnap_qad.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
SYSINFO="/sbin/getsysinfo"
CPUTEMPFILE="/share/homes/monitoring/monitoring/cputemp.txt"
SYSTEMPFILE="/share/homes/monitoring/monitoring/systemp.txt"
FANFILE="/share/homes/monitoring/monitoring/fan.txt"
HDFILE="/share/homes/monitoring/monitoring/hd.txt"
VOLFILE="/share/homes/monitoring/monitoring/vol.txt"
> $CPUTEMPFILE
> $SYSTEMPFILE
> $FANFILE
> $HDFILE
> $VOLFILE
CPUTEMP=`$SYSINFO cputmp`
SYSTEMP=`$SYSINFO systmp`
SYSFANNR=`$SYSINFO sysfannum`
HDNR=`$SYSINFO hdnum`
SYSVOLNR=`$SYSINFO sysvolnum`
# Get CPUtemperature
if [ -z "$CPUTEMP" ];then
echo "No CPU temperature received!"
exit 2
else
echo "CPUTemp: $CPUTEMP" >> $CPUTEMPFILE
fi
# Get systemtemperature
if [ -z "$SYSTEMP" ];then
echo "No system temperature received!"
exit 2
else
echo "SYSTemp: $SYSTEMP" >> $SYSTEMPFILE
fi
# Get faninfo
if [ "$SYSFANNR" -ge "1" ];then
for ((i=1; i<=SYSFANNR; i+=1)); do
SYSFAN=`$SYSINFO sysfan $i`
echo "Systemfan Nr $i: $SYSFAN" >> $FANFILE
done
else
echo "No system fans found!"
exit 2
fi
# Get diskinfo
if [ "$HDNR" -ge "1" ];then
for ((j=1; j<=HDNR; j+=1)); do
HDMODEL=`$SYSINFO hdmodel $j`
HDCAP=`$SYSINFO hdcapacity $j`
HDTEMP=`$SYSINFO hdtmp $j`
HDSTATUS=`$SYSINFO hdstatus $j`
HDSMART=`$SYSINFO hdsmart $j`
echo "### DiskNr $j:" >> $HDFILE
echo "Model: $HDMODEL" >> $HDFILE
echo "Capacity: $HDCAP" >> $HDFILE
echo "Temperature: $HDTEMP" >> $HDFILE
echo "Status: $HDSTATUS" >> $HDFILE
echo "SMART: $HDSMART" >> $HDFILE
echo "" >> $HDFILE
done
else
echo "No disks found!"
exit 2
fi
# Get volumeinfo
if [ "$SYSVOLNR" -ge "1" ];then
for ((k=1; k<=SYSVOLNR; k+=1)); do
VOLDESC=`$SYSINFO vol_desc $k`
VOLSTATUS=`$SYSINFO vol_status $k`
VOLFS=`$SYSINFO vol_fs $k`
VOLTOTALSIZE=`$SYSINFO vol_totalsize $k`
VOLFREESIZE=`$SYSINFO vol_freesize $k`
echo "### Volnr $k:" >> $VOLFILE
echo "Description: $VOLDESC" >> $VOLFILE
echo "Status: $VOLSTATUS" >> $VOLFILE
echo "Filesystem: $VOLFS" >> $VOLFILE
echo "Totalsize: $VOLTOTALSIZE" >> $VOLFILE
echo "Freesize: $VOLFREESIZE" >> $VOLFILE
done
else
echo "No system volumes found!"
exit 2
fi