monitors:diskstat.pl

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
monitors:diskstat.pl [2019/02/12 16:28] – [Changelog] wnelismonitors:diskstat.pl [2019/02/12 16:43] – [To do] wnelis
Line 5: Line 5:
 ^ Requirements | Perl, Linux | ^ Requirements | Perl, Linux |
 ^ Download | None | ^ Download | None |
-^ Last Update | 2012-04-02 |+^ Last Update | 2019-02-12 |
  
 ===== Description ===== ===== Description =====
Line 33: Line 33:
 === Server side === === Server side ===
  
-At the Xymon server, the status message from script diskstat.pl is to be handled by script rrd_status.pl. This is accomplished by merging the following configuration into file ~xymon/server/etc/tasks.cfg:+At the Xymon server, it must be configured that this test uses the Devmon formatTherefore add the following two lines to ~xymon/server/etc/xymonserver.cfg or write them in a file named ~xymon/server/etc/xymonserver.d/diskstat.cfg:
  
 <code> <code>
-[rrdstatus] +TEST2RRD+=",diskstat=devmon" 
-  ENVFILE /path/to/xymon/server/etc/xymonserver.cfg +GRAPHS+=",diskstat::1,diskstat0::1,diskstat1::1,diskstat2::1"
-  NEEDS xymond +
-  CMD xymond_channel --channel=status --log=$XYMONSERVERLOGS/rrd-status.log xymond_rrd --extra-tests=diskstat --extra-script=/path/to/xymon/server/ext/rrd_status.pl --rrddir=$XYMONVAR/rrd+
 </code> </code>
- 
-Install the following script, named rrd_status.pl, in directory ~xymon/server/ext. However, it could be that there is already a script with a similar purpose for other tests: in that case you should merge it with the script below. 
- 
-<hidden onHidden="Show rrd_status.pl ⇲" onVisible="Hide rrd_status.pl ⇱"> 
-<code perl> 
-#!/usr/bin/perl 
-# 
-# This script handles a list of NCVs, send by a Xymon client, and prepares it to 
-# be stored in an RRA. This script is used in cases in which a fixed-size group 
-# of two or more values should be put together into a single RRA. The algorithm 
-# is specific for each test / client. 
-# 
-# This script is invoked with three parameters: the name of the host, the name 
-# of the test and the name of the file containing the message sent by the 
-# client, containing the NCVs to be handled. 
-# 
-use strict; 
- 
-# 
-# Installation constants. 
-# ----------------------- 
-# 
-# %Struct defines the datasets of the various tests. 
-# 
-my %Struct= ( 
-        diskstat => [           # Must be sorted! 
-                "DS:IoQueue:GAUGE:600:0:U\n"  , 
-                "DS:IoTime:DERIVE:600:0:U\n"  , 
-                "DS:IoWTime:DERIVE:600:0:U\n" , 
-                "DS:RdAmount:DERIVE:600:0:U\n", 
-                "DS:RdMerge:DERIVE:600:0:U\n"   , 
-                "DS:RdRequest:DERIVE:600:0:U\n"   , 
-                "DS:RdTime:DERIVE:600:0:U\n"  , 
-                "DS:WrAmount:DERIVE:600:0:U\n", 
-                "DS:WrMerge:DERIVE:600:0:U\n"   , 
-                "DS:WrRequest:DERIVE:600:0:U\n"   , 
-                "DS:WrTime:DERIVE:600:0:U\n"   ] 
-   ) ;  # of %Struct 
- 
-# 
-# Global variables. 
-# ----------------- 
-# 
-my ( $HostName, $TestName, $FileName )= @ARGV ; 
-# 
-my %Var= () ;                           # Save area measurements 
-my ( $Line, @Line ) ;                   # List of values of one measurement 
-my $key ;                               # Loop control variable 
- 
- 
-# 
-# Main program. 
-# ------------- 
-# 
- 
-# 
-# Handle test "diskstat". 
-# 
-# An attempt has been undertaken to make this code a little bit more general. 
-# The name of an NCV should consist of two names separated by "/". The first 
-# name becomes (part of) the name of the RRA, the second name becomes the 
-# name of the DS. The DS-ses are written in sorted order. 
-# 
-if ( $TestName eq "diskstat" ) { 
-  open( FH, "<", $FileName )    or die ; 
-  while ( <FH> ) { 
-    chomp ; 
-    next                        unless m/^([\w\.\,-]+)\/(\w+)\s+:\s+(U|[\d\.]+)\s*$/ ; 
-    $Var{$1}{$2}= $3 ; 
-  }  # of while 
-  close( FH ) ; 
- 
-  print @{$Struct{$TestName}} ; 
-  foreach $key ( sort keys %Var ) { 
-    @Line= () ; 
-    push @Line, $Var{$key}{$_}  foreach ( sort keys %{$Var{$key}} ) ; 
-    print "$TestName.$key.rrd\n" ; 
-    print join( ":", @Line ) . "\n" ; 
-  }  # of foreach 
-}  # of if 
- 
-exit 0 ; 
-</code> 
-</hidden> 
  
 The results are displayed in 4 graphs, named [diskstat], [diskstat0], [diskstat1] and [diskstat2]. These graphs are multi-graphs and use script genlgt.pl to generate the graph title. The results are displayed in 4 graphs, named [diskstat], [diskstat0], [diskstat1] and [diskstat2]. These graphs are multi-graphs and use script genlgt.pl to generate the graph title.
Line 240: Line 154:
 </code> </code>
  
-Define the diskstat graphs to be multi-graphs, which should show only one disk per graph, with the following modification in ~xymon/server/etc/cgioptions.cfg+Define the diskstat graphs to be multi-graphs with the following modification in ~xymon/server/etc/cgioptions.cfg:
 <code> <code>
 CGI_SVC_OPTS="... --multigraphs=diskstat,diskstat0,diskstat1,diskstat2" CGI_SVC_OPTS="... --multigraphs=diskstat,diskstat0,diskstat1,diskstat2"
-</code> 
-and the following modifications in ~xymon/server/etc/xymonserver.cfg: 
-<code> 
-TEST2RRD="...,diskstat" 
-GRAPHS="...,diskstat::1,diskstat0::1,diskstat1::1,diskstat2::1" 
 </code> </code>
  
Line 447: Line 356:
  
 ===== To do ===== ===== To do =====
-An option is to rework this script to send a trends-message to Xymon in stead of a status message. An advantage is that there is no need any more for script rrd_status.pl, a disadvantage might be the lack of a column named 'diskstat'.+An option is to rework this script to send a trends-message to Xymon in stead of a status message. The lack of a column named 'diskstat' might be an advantage for some.
  
 ===== Changelog ===== ===== Changelog =====
Line 453: Line 362:
   * **2012-04-02**   * **2012-04-02**
     * Initial release     * Initial release
-  * **2019-2-12**+  * **2019-02-12**
     * Use Devmon format to pass the statistics to xymon / RRD in stead of the NCV format.     * Use Devmon format to pass the statistics to xymon / RRD in stead of the NCV format.
  
  • monitors/diskstat.pl.txt
  • Last modified: 2019/02/16 17:53
  • by wnelis