Difference between revisions of "QNAP"
(link to product page) |
(Ads nasreport) |
||
Line 14: | Line 14: | ||
== Administration == | == Administration == | ||
Under the covers, the QNAP is a Linux box, so if you want to reset someones password, you can just use the <code>passwd</code> command as usual. | Under the covers, the QNAP is a Linux box, so if you want to reset someones password, you can just use the <code>passwd</code> command as usual. | ||
+ | |||
+ | == NAS Report == | ||
+ | Here is a script which generates a script, and then runs it. Not sure why it's not just a plain script, but hey it's a neat trick. If you want to just use the script it generates, see /tmp/nasreport after invoking this. | ||
+ | <code>cat ./nas_report.sh </code> | ||
+ | <source lang="bash"> | ||
+ | #!/bin/sh | ||
+ | rm -f /tmp/nasreport | ||
+ | touch /tmp/nasreport | ||
+ | chmod +x /tmp/nasreport | ||
+ | cat <<EOF >>/tmp/nasreport | ||
+ | #!/bin/sh | ||
+ | # | ||
+ | # NAS Report by Patrick Wilson | ||
+ | # see: http://forum.qnap.com/viewtopic.php?f=185&t=82260#p366188 | ||
+ | # | ||
+ | # | ||
+ | echo "*********************" | ||
+ | echo "** QNAP NAS Report **" | ||
+ | echo "*********************" | ||
+ | echo " " | ||
+ | echo "NAS Model: \$(getsysinfo model)" | ||
+ | echo "Firmware: \$(getcfg system version) Build \$(getcfg system 'Build Number')" | ||
+ | echo "System Name: \$(/bin/hostname)" | ||
+ | echo "Workgroup: \$(getcfg system workgroup)" | ||
+ | echo "Base Directory: \$(dirname \$(getcfg -f /etc/config/smb.conf Public path))" | ||
+ | echo "NAS IP address: \$(ifconfig \$(getcfg network 'Default GW Device') | grep addr: | awk '{ print \$2 }' | cut -d: -f2)" | ||
+ | echo " " | ||
+ | echo "Default Gateway Device: \$(getcfg network 'Default GW Device')" | ||
+ | echo " " | ||
+ | ifconfig \$(getcfg network 'Default GW Device') | grep -v HWaddr | ||
+ | echo " " | ||
+ | echo -n "DNS Nameserver(s):" | ||
+ | cat /etc/resolv.conf | grep nameserver | cut -d' ' -f2 | ||
+ | echo " " | ||
+ | echo " " | ||
+ | echo "HDD Information:" | ||
+ | echo " " | ||
+ | alpha='abcdefghijklmnopqrstuvwxyz' | ||
+ | drives=\$(getcfg Storage 'Disk Drive Number') | ||
+ | for ((i=1;i<=drives;++i)) ; do | ||
+ | echo -n "HDD\$i -" | ||
+ | if [ ! -b /dev/sd\${alpha:\$i-1:1} ] ; then | ||
+ | echo "Drive absent" | ||
+ | else | ||
+ | hdparm -i /dev/sd\${alpha:\$i-1:1} | grep "Model" | ||
+ | echo " " | ||
+ | parted /dev/sd\${alpha:\$i-1:1} print | ||
+ | echo " " | ||
+ | /sbin/get_hd_smartinfo -d \$i | ||
+ | echo " " | ||
+ | fi | ||
+ | done | ||
+ | echo "Volume Status" | ||
+ | echo " " | ||
+ | mdadm -D /dev/md0 /dev/md1 2>/dev/null | ||
+ | echo " " | ||
+ | cat /proc/mdstat | ||
+ | echo " " | ||
+ | echo "Disk Space:" | ||
+ | echo " " | ||
+ | df -h | grep -v qpkg | ||
+ | echo " " | ||
+ | echo "Mount Status:" | ||
+ | echo " " | ||
+ | mount | grep -v qpkg | ||
+ | echo " " | ||
+ | #echo "Contents of \$(dirname \$(getcfg -f /etc/config/smb.conf Public path)):" | ||
+ | #echo " " | ||
+ | #ls -lF \$(dirname \$(getcfg -f /etc/config/smb.conf Public path))/ | ||
+ | echo " " | ||
+ | echo "Windows Shares:" | ||
+ | echo " " | ||
+ | for i in \$(grep \] /etc/config/smb.conf | sed 's/^\[//g' | sed 's/\]//g' | grep -v global) ;do | ||
+ | echo -n "\$i:" | ||
+ | testparm -s -l --section-name="\$i" --parameter-name=path 2>/dev/null | ||
+ | done | ||
+ | #echo " " | ||
+ | #echo "QNAP Media Scanner / Transcoder processes running: " | ||
+ | #echo " " | ||
+ | #/bin/ps | grep medialibrary | grep -v grep | ||
+ | #echo " " | ||
+ | #echo -n "MediaLibrary Configuration file: " | ||
+ | #ls -alF /etc/config/medialibrary.conf | ||
+ | #echo " " | ||
+ | #echo "/etc/config/medialibrary.conf:" | ||
+ | #cat /etc/config/medialibrary.conf | ||
+ | echo " " | ||
+ | echo "iTunes Music Store: \$(getcfg -f /etc/config/mt-daapd.conf general mp3_dir)" | ||
+ | echo " " | ||
+ | echo "Memory Information:" | ||
+ | echo " " | ||
+ | free | grep -v cache: | ||
+ | echo " " | ||
+ | echo "NASReport completed on \$(date +'%Y-%m-%d %T') (\$0) " | ||
+ | echo " " | ||
+ | EOF | ||
+ | sleep 2 | ||
+ | clear | ||
+ | /tmp/nasreport | ||
+ | #done | ||
+ | </source> | ||
[[Category:Company]] [[Category:Cloud]] [[Category:Network]] [[Category:NAS]] [[Category:Storage]] [[Category:Server]] [[Category:Backups]] | [[Category:Company]] [[Category:Cloud]] [[Category:Network]] [[Category:NAS]] [[Category:Storage]] [[Category:Server]] [[Category:Backups]] |
Revision as of 23:37, 27 July 2016
The QNAP NAS TS-231 forms the basis of our local network shares and backup
2x 2TB Western Digital "Red" drives in RAID 1 configuration = 1.8 TB storage
locally on the network, it uses DHCP, with two ethernet nics (dual-homed) Access it via your network share (at 192.168.1.4 or 192.168.1.5) or externally at http://cloud.equality-tech.com
Operating System[edit | edit source]
The QNAP uses an operating system called QTS (based on Linux and GPL) QTS 4.2.1
Administration[edit | edit source]
Under the covers, the QNAP is a Linux box, so if you want to reset someones password, you can just use the passwd
command as usual.
NAS Report[edit | edit source]
Here is a script which generates a script, and then runs it. Not sure why it's not just a plain script, but hey it's a neat trick. If you want to just use the script it generates, see /tmp/nasreport after invoking this.
cat ./nas_report.sh
#!/bin/sh
rm -f /tmp/nasreport
touch /tmp/nasreport
chmod +x /tmp/nasreport
cat <<EOF >>/tmp/nasreport
#!/bin/sh
#
# NAS Report by Patrick Wilson
# see: http://forum.qnap.com/viewtopic.php?f=185&t=82260#p366188
#
#
echo "*********************"
echo "** QNAP NAS Report **"
echo "*********************"
echo " "
echo "NAS Model: \$(getsysinfo model)"
echo "Firmware: \$(getcfg system version) Build \$(getcfg system 'Build Number')"
echo "System Name: \$(/bin/hostname)"
echo "Workgroup: \$(getcfg system workgroup)"
echo "Base Directory: \$(dirname \$(getcfg -f /etc/config/smb.conf Public path))"
echo "NAS IP address: \$(ifconfig \$(getcfg network 'Default GW Device') | grep addr: | awk '{ print \$2 }' | cut -d: -f2)"
echo " "
echo "Default Gateway Device: \$(getcfg network 'Default GW Device')"
echo " "
ifconfig \$(getcfg network 'Default GW Device') | grep -v HWaddr
echo " "
echo -n "DNS Nameserver(s):"
cat /etc/resolv.conf | grep nameserver | cut -d' ' -f2
echo " "
echo " "
echo "HDD Information:"
echo " "
alpha='abcdefghijklmnopqrstuvwxyz'
drives=\$(getcfg Storage 'Disk Drive Number')
for ((i=1;i<=drives;++i)) ; do
echo -n "HDD\$i -"
if [ ! -b /dev/sd\${alpha:\$i-1:1} ] ; then
echo "Drive absent"
else
hdparm -i /dev/sd\${alpha:\$i-1:1} | grep "Model"
echo " "
parted /dev/sd\${alpha:\$i-1:1} print
echo " "
/sbin/get_hd_smartinfo -d \$i
echo " "
fi
done
echo "Volume Status"
echo " "
mdadm -D /dev/md0 /dev/md1 2>/dev/null
echo " "
cat /proc/mdstat
echo " "
echo "Disk Space:"
echo " "
df -h | grep -v qpkg
echo " "
echo "Mount Status:"
echo " "
mount | grep -v qpkg
echo " "
#echo "Contents of \$(dirname \$(getcfg -f /etc/config/smb.conf Public path)):"
#echo " "
#ls -lF \$(dirname \$(getcfg -f /etc/config/smb.conf Public path))/
echo " "
echo "Windows Shares:"
echo " "
for i in \$(grep \] /etc/config/smb.conf | sed 's/^\[//g' | sed 's/\]//g' | grep -v global) ;do
echo -n "\$i:"
testparm -s -l --section-name="\$i" --parameter-name=path 2>/dev/null
done
#echo " "
#echo "QNAP Media Scanner / Transcoder processes running: "
#echo " "
#/bin/ps | grep medialibrary | grep -v grep
#echo " "
#echo -n "MediaLibrary Configuration file: "
#ls -alF /etc/config/medialibrary.conf
#echo " "
#echo "/etc/config/medialibrary.conf:"
#cat /etc/config/medialibrary.conf
echo " "
echo "iTunes Music Store: \$(getcfg -f /etc/config/mt-daapd.conf general mp3_dir)"
echo " "
echo "Memory Information:"
echo " "
free | grep -v cache:
echo " "
echo "NASReport completed on \$(date +'%Y-%m-%d %T') (\$0) "
echo " "
EOF
sleep 2
clear
/tmp/nasreport
#done