2 ################################################
3 ### Managed by someone's ansible provisioner ###
4 ################################################
5 # Part of: https://git.somenet.org/root/pub/somesible.git
6 # 2017-2024 by someone <someone@somenet.org>
10 if [ "$1" = "autoconf" ]; then
16 if [ "$1" = "config" ]; then
17 echo "graph_title Lifetime bytes read and written"
18 echo "graph_info This graph shows the bytes read and written per disk as reported by SMART"
19 echo "graph_category disk"
20 echo "graph_vlabel Lifetime bytes read (-) / written (+)"
23 HD_NAME=$(lsblk -S "/dev/$f" -o MODEL,SERIAL | tail -q -n-1 | sed -Ee 's#-#_#g' -e's# #-#g')
24 if [ "-${HD_NAME}-" != "--" ]; then
25 echo "${HD_NAME}_r.draw LINE2"
26 echo "${HD_NAME}_r.min 0"
27 echo "${HD_NAME}_r.label ${HD_NAME} not displayed"
28 echo "${HD_NAME}_r.graph no"
29 echo "${HD_NAME}_w.draw LINE2"
30 echo "${HD_NAME}_w.min 0"
31 echo "${HD_NAME}_w.label /dev/${f}"
32 echo "${HD_NAME}_w.negative ${HD_NAME}_r"
35 # echo "graph_printf %.0lf"
36 # echo "graph_scale no"
37 echo "graph_args -l 0"
44 HD_NAME=$(lsblk -S "/dev/$f" -o MODEL,SERIAL | tail -q -n-1 | sed -Ee 's#-#_#g' -e's# #-#g')
45 if [ "-${HD_NAME}-" != "--" ]; then
46 echo "${HD_NAME}_w.value $(tail -q -n-1 "/var/lib/smartmontools/attrlog.${HD_NAME}.ata.csv" 2>/dev/null | sed -Ee 's/^.*\t241;[0-9]+;([0-9]+);.*$/\1*512/' | bc)"
47 echo "${HD_NAME}_r.value $(tail -q -n-1 "/var/lib/smartmontools/attrlog.${HD_NAME}.ata.csv" 2>/dev/null | sed -Ee 's/^.*\t242;[0-9]+;([0-9]+);.*$/\1*512/' | bc)"