Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
monitors:diskstat.pl [2019/02/12 18:46]
wnelis [Installation]
monitors:diskstat.pl [2019/02/16 17:53] (current)
wnelis [diskstat.pl]
Line 177: Line 177:
 # This script does not have any memory by design. It only reports the values # This script does not have any memory by design. It only reports the values
 # found in /​proc/​diskstat to Xymon, although it does convert some values to a # found in /​proc/​diskstat to Xymon, although it does convert some values to a
-# more appropiate ​unit. In most cases, the difference with the value in the+# more appropriate ​unit. In most cases, the difference with the value in the
 # previous pass is of interest. These differences are computed by RRD, prior to # previous pass is of interest. These differences are computed by RRD, prior to
 # saving the values. # saving the values.
Line 206: Line 206:
 my $InpFil= '/​proc/​diskstats'​ ; # Input file name my $InpFil= '/​proc/​diskstats'​ ; # Input file name
 # #
-# Define the name of each dataset and the unit conversion factor. As most of the +# Define the name of each data-set, ​the unit conversion factor ​and the RRD type. 
-datasets are defined to be of type DERIVED, the value passed to RRD must be an +Note that RRD requires that the values ​of type '​DERIVE'​ are integer. If 
-integer number. Thus the times expressed in [ms] are *not* converted to [s].+# however floating point numbers are used, the RRD type must be set to 
 +'​DDERIVE'​.
 # #
 my @DS= ( # Define parameters of the datasets my @DS= ( # Define parameters of the datasets
-    [ '​Name' ​    , ​  ​1, '' ​      ​], #  0 - Name of disk / partition +    [ '​Name' ​    , ​    ​1, '' ​       ], #  0 - Name of disk / partition 
-    [ '​RdRequest', ​  ​1, '​DERIVE'​ ], #  1 - Read requests +    [ '​RdRequest', ​    ​1, '​DERIVE' ​ ], #  1 - Read requests 
-    [ '​RdMerge' ​ ,   ​1, '​DERIVE'​ ], #  2 - Read request merges +    [ '​RdMerge' ​ ,     ​1, '​DERIVE' ​ ], #  2 - Read request merges 
-    [ '​RdAmount'​ , 512, '​DERIVE'​ ], #  3 - Sectors read +    [ '​RdAmount'​ ,   ​512, '​DERIVE' ​ ], #  3 - Sectors read 
-    [ '​RdTime' ​  , ​  1, 'DERIVE' ], #  4 - Time spent reading [ms] +    [ '​RdTime' ​  , ​0.001, 'DDERIVE' ], #  4 - Time spent reading [ms] 
-    [ '​WrRequest', ​  ​1, '​DERIVE'​ ], #  5 - Write requests +    [ '​WrRequest', ​    ​1, '​DERIVE' ​ ], #  5 - Write requests 
-    [ '​WrMerge' ​ ,   ​1, '​DERIVE'​ ], #  6 - Write request merges +    [ '​WrMerge' ​ ,     ​1, '​DERIVE' ​ ], #  6 - Write request merges 
-    [ '​WrAmount'​ , 512, '​DERIVE'​ ], #  7 - Sectors written +    [ '​WrAmount'​ ,   ​512, '​DERIVE' ​ ], #  7 - Sectors written 
-    [ '​WrTime' ​  , ​  1, 'DERIVE' ], #  8 - Time spent writing [ms] +    [ '​WrTime' ​  , ​0.001, 'DDERIVE' ], #  8 - Time spent writing [ms] 
-    [ '​IoQueue' ​ ,   ​1, '​GAUGE' ​ ], #  9 - Length of I/O queue +    [ '​IoQueue' ​ ,     ​1, '​GAUGE' ​  ​], #  9 - Length of I/O queue 
-    [ '​IoTime' ​  , ​  1, 'DERIVE' ], # 10 - Time spent for I/O [ms] +    [ '​IoTime' ​  , ​0.001, 'DDERIVE' ], # 10 - Time spent for I/O [ms] 
-    [ '​IoWTime' ​ ,   1, 'DERIVE' ] # 11 - Time weighted with (9)+    [ '​IoWTime' ​ , 0.001, 'DDERIVE' ] # 11 - Time weighted with (9)
 ) ; ) ;
  
Line 282: Line 283:
 # #
 # Function BuildRrdData reports the values in Devmon format to Xymon, causing # Function BuildRrdData reports the values in Devmon format to Xymon, causing
-# Xymon to write the values to an RRD. The names of the mountpoints ​are adapted+# Xymon to write the values to an RRD. The names of the mount-points ​are adapted
 # to match the Xymon conventions. # to match the Xymon conventions.
 # #
Line 312: Line 313:
       } else {       } else {
  $Val= $Val * $DS[$i][1] ; # Unit conversion  $Val= $Val * $DS[$i][1] ; # Unit conversion
- $Result.= sprintf( "​%d:",​ $Val ) ;+ if ( $DS[$i][2] eq '​DDERIVE'​ ) { 
 +   $Result.= sprintf( "​%.3f:",​ $Val ) ; 
 + } else { 
 +   ​$Result.= sprintf( "​%d:",​ $Val ) ; 
 + }  # of else
       }  # of else       }  # of else
     }  # of for     }  # of for
  • monitors/diskstat.pl.txt
  • Last modified: 2019/02/16 17:53
  • by wnelis