Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision Next revisionBoth sides next revision | ||
monitors:diskstat.pl [2012/04/12 07:16] – external edit 127.0.0.1 | monitors: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 ===== | ||
Script diskstat.pl is a client-side script for servers running Linux, which extracts disk I/O performance parameters from pseudo-file / | Script diskstat.pl is a client-side script for servers running Linux, which extracts disk I/O performance parameters from pseudo-file / | ||
- | As most of the parameters in / | + | As most of the parameters in / |
- | Script diskstat.pl is installed together with perl module diskstat.pm on the Xymon client. Script diskstat.pl sends all performance data of the selected disks and partitions to Xymon. The selection is defined in module diskstat.pm in hash %Disks. | + | Script diskstat.pl is installed together with perl module diskstat.pm on the Xymon client. Script diskstat.pl sends all performance data of the selected disks and partitions to Xymon. The selection is defined in module diskstat.pm in hash %Disks. |
===== Installation ===== | ===== Installation ===== | ||
Line 20: | Line 20: | ||
=== Client side === | === Client side === | ||
- | Copy script diskstat.pl and module diskstat.pm to the server to be monitored, typically to subdirectory ~xymon/ | + | Copy script diskstat.pl and module diskstat.pm to the server to be monitored, typically to subdirectory ~xymon/ |
- | Edit the following section to reflect your environment and add it to the ~xymon/ | + | Edit the following section to reflect your environment and add it to ~xymon/ |
< | < | ||
[diskstat] | [diskstat] | ||
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 | + | At the Xymon server, |
< | < | ||
- | [rrdstatus] | + | TEST2RRD+=", |
- | ENVFILE / | + | GRAPHS+=",diskstat:: |
- | NEEDS xymond | + | |
- | CMD xymond_channel --channel=status --log=$XYMONSERVERLOGS/ | + | |
</ | </ | ||
- | |||
- | Install the following script, named rrd_status.pl, | ||
- | |||
- | <hidden onHidden=" | ||
- | <code 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! | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | ) ; # 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 " | ||
- | # | ||
- | # 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 "/" | ||
- | # 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 " | ||
- | open( FH, "<", | ||
- | while ( <FH> ) { | ||
- | chomp ; | ||
- | next unless m/ | ||
- | $Var{$1}{$2}= $3 ; | ||
- | } # of while | ||
- | close( FH ) ; | ||
- | |||
- | print @{$Struct{$TestName}} ; | ||
- | foreach $key ( sort keys %Var ) { | ||
- | @Line= () ; | ||
- | push @Line, $Var{$key}{$_} | ||
- | print " | ||
- | print join( ":", | ||
- | } # of foreach | ||
- | } # of if | ||
- | |||
- | exit 0 ; | ||
- | </ | ||
- | </ | ||
The results are displayed in 4 graphs, named [diskstat], [diskstat0], | The results are displayed in 4 graphs, named [diskstat], [diskstat0], | ||
Line 240: | Line 154: | ||
</ | </ | ||
- | Define the diskstat graphs to be multi-graphs, which should show only one disk per graph, | + | Define the diskstat graphs to be multi-graphs with the following modification in ~xymon/ |
< | < | ||
CGI_SVC_OPTS=" | CGI_SVC_OPTS=" | ||
- | </ | ||
- | and the following modifications in ~xymon/ | ||
- | < | ||
- | TEST2RRD=" | ||
- | GRAPHS=" | ||
</ | </ | ||
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 option is to rework this script to send a trends-message to Xymon in stead of a status message. |
===== Changelog ===== | ===== Changelog ===== | ||
Line 453: | Line 362: | ||
* **2012-04-02** | * **2012-04-02** | ||
* Initial release | * Initial release | ||
+ | * **2019-02-12** | ||
+ | * Use Devmon format to pass the statistics to xymon / RRD in stead of the NCV format. | ||