Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
monitors:diskstat.pl [2019/02/12 16:16] – [Description] wnelis | monitors:diskstat.pl [2019/02/12 16:36] – [Installation] wnelis | ||
---|---|---|---|
Line 10: | Line 10: | ||
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. This list is also used to map the disk or partition name onto another name, typically the mount point. The data is sent to Xymon in Devmon format, which requires less configuration compared with the NCV format. At the generation of a graph, a custom script is invoked to extract mountpoint from the name of the RRD and rebuild the original name. | 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. This list is also used to map the disk or partition name onto another name, typically the mount point. The data is sent to Xymon in Devmon format, which requires less configuration compared with the NCV format. At the generation of a graph, a custom script is invoked to extract mountpoint from the name of the RRD and rebuild the original name. | ||
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+=",diskstat=devmon" |
- | ENVFILE / | + | |
- | 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 453: | Line 366: | ||
* **2012-04-02** | * **2012-04-02** | ||
* Initial release | * Initial release | ||
+ | * **2019-2-12** | ||
+ | * Use Devmon format to pass the statistics to xymon / RRD in stead of the NCV format. | ||