diff --git a/Template Active OS Linux Disk Performance.xml b/Template Active OS Linux Disk Performance.xml new file mode 100644 index 0000000..15d43ba --- /dev/null +++ b/Template Active OS Linux Disk Performance.xml @@ -0,0 +1,1478 @@ + + + 4.0 + 2019-03-22T19:44:41Z + + + Templates + + + + + + diff --git a/Template Disk Performance.xml b/Template Disk Performance.xml index dc4a0dc..802fc1a 100644 --- a/Template Disk Performance.xml +++ b/Template Disk Performance.xml @@ -29,7 +29,7 @@ 0 - custom.vfs.discover_disks + custom.vfs.dev.discovery 3600 0 diff --git a/lld-disks.py b/lld-disks.py deleted file mode 100644 index 48fd3d6..0000000 --- a/lld-disks.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/python -import os -import json - -if __name__ == "__main__": - # Iterate over all block devices, but ignore them if they are in the - # skippable set - skippable = ("sr", "loop", "ram") - devices = (device for device in os.listdir("/sys/class/block") - if not any(ignore in device for ignore in skippable)) - data = [{"{#DEVICENAME}": device} for device in devices] - print(json.dumps({"data": data}, indent=4)) diff --git a/userparameter_diskstats.conf b/userparameter_diskstats.conf index c5efc35..4bcf82a 100644 --- a/userparameter_diskstats.conf +++ b/userparameter_diskstats.conf @@ -1,5 +1,6 @@ -UserParameter=custom.vfs.discover_disks,/usr/local/bin/lld-disks.py +UserParameter=custom.vfs.dev.discovery,DEVS=`grep -E -v 'fd|loop|ram|sr|major|^$|dm-' /proc/partitions | awk '{if($2==0||($2%8==0))print $4}'|sed 's/\//\!/g'`;POSITION=1;echo "{";echo " \"data\":[";for DEV in $DEVS;do if [ $POSITION -gt 1 ];then echo -n ",";fi;echo -n " { \"{#DEVICENAME}\": \"$DEV\"}";POSITION=`expr $POSITION + 1`;done;echo "";echo " ]";echo "}" +# see https://www.kernel.org/doc/Documentation/iostats.txt UserParameter=custom.vfs.dev.read.ops[*],awk '{print $$1}' /sys/class/block/$1/stat UserParameter=custom.vfs.dev.read.merged[*],awk '{print $$2}' /sys/class/block/$1/stat UserParameter=custom.vfs.dev.read.sectors[*],awk '{print $$3}' /sys/class/block/$1/stat @@ -11,3 +12,8 @@ UserParameter=custom.vfs.dev.write.ms[*],awk '{print $$8}' /sys/class/block/$1/s UserParameter=custom.vfs.dev.io.active[*],awk '{print $$9}' /sys/class/block/$1/stat UserParameter=custom.vfs.dev.io.ms[*],awk '{print $$10}' /sys/class/block/$1/stat UserParameter=custom.vfs.dev.weight.io.ms[*],awk '{print $$11}' /sys/class/block/$1/stat +# discards +UserParameter=custom.vfs.dev.discards.ops[*],awk '{if($$12=="")print 0;else print $$12;}' /sys/class/block/$1/stat +UserParameter=custom.vfs.dev.discards.merged[*],awk '{if($$13=="")print 0;else print $$13;}' /sys/class/block/$1/stat +UserParameter=custom.vfs.dev.discards.sectors[*],awk '{if($$14=="")print 0;else print $$14;}' /sys/class/block/$1/stat +UserParameter=custom.vfs.dev.discards.ms[*],awk '{if($$15=="")print 0;else print $$15;}' /sys/class/block/$1/stat