The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

VBTK::Wrapper::DiskFree - Sun hardware disk space monitoring with 'df'

SUPPORTED PLATFORMS

  • Solaris

SYNOPSIS

  # If you like all the defaults, then there's no need to over-ride them.
  $o = new VBTK::Wrapper::DiskFree ();
  $vbObj = $o->addVBObj();

  VBTK::runAll;

DESCRIPTION

This perl library is a front-end to the VBTK::Wrapper class. It supports the same public methods as the VBTK::Wrapper class, but with common defaults to simplify the setup of a 'df' monitoring process.

METHODS

The following methods are supported

$o = new VBTK::Wrapper::DiskFree (<parm1> => <val1>, <parm2> => <val2>, ...)

::TBD::

This method calls 'new VBTK::Wrapper' after defaulting the parameters to best monitor the 'df' command. For a detailed description of the parameters, see VBTK::Wrapper. The defaults are as follows. If you like all the defaults then you don't have to pass in any parms.

Interval
    Interval => 300,
Execute
    Execute => '/usr/bin/df -k 2>&1',
VBHeader
    VBHeader => [ 
        'Time               Mount                          MB   Used  Avail  Pct',
        '------------------ -------------------------- ------ ------ ------ ----' ],
VBDetail
    VBDetail => [ 
        '@<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<< @>>>>> @>>>>> @>>>>> @>>>',
        '$time, $data[5], int($data[1]/1024), int($data[2]/1024), int($data[3]/1024), $data[4]' ],
LogHeader

Same as VBHeader, but used for the log file.

LogDetail

Same as VBDetail, but used for the log file.

Split
    Split => '\s+',
Filter

Only accept the lines which begin in '/dev' (Unix) or '<x>:' (Windows).

    Filter => '^/dev|^[A-Za-z]:\s+',
Ignore

Ignore the CD-rom drive if it shows up in the output

    Ignore => '/cdrom',
Timeout
    Timeout => 60,
TimeoutStatus
    TimeoutStatus => 'Fail',
NonZeroExitStatus
    NonZeroExitStatus => 'Warn',
DebugHeader
    DebugHeader => 'prtdiag',
$vbObj = $o->addVBObj(<parm1> => <val1>, <parm2> => <val2>, ...)

This method runs the above wrapper object once to determine how many filesystems reside on the local host. For each filesystem found, a separate VB object is created by calling VBTK::Wrapper::addVBObj after defaulting unspecified parameters to best monitor diskspace with the 'df' command. For a detailed description of the addVBObj parameters, see VBTK::Parser. The defaults are as follows. If you like all the defaults then you don't have to pass in any parms

VBObjName

Name the VBObject using the local host's name.

    VBObjName => ".<Host>.diskfree.<filesystem>",
TextHistoryLimit
    TextHistoryLimit => 50,
ReverseText
    ReverseText => 1,
Rules

If space used exceeds 90%, set to warn. If above 95%, set to Failed.

    Rules => {
        '($data[4] > 90)' => 'Warn',
        '($data[4] > 95)' => 'Fail' },
StatusHistoryLimit

Limit to storing the last 30 status changes

    StatusHistoryLimit => 30,
ExpireAfter
    ExpireAfter => "(<Interval> * 3) seconds"
Description
    Description = qq(
        This object uses the 'df' command to monitor the disk utilization on
        $::HOST.  It will set the status to 'Warning' or 'Failed' based on the
        amount of free disk space on the local filesystems. ),
RrdColumns

Graph the pct utilization for each filesytem.

    RrdColumns => [ 'int($data[4])' ],
RrdMin
    RrdMin => 0,
RrdCF

Use the 'MAX' consolidation function so that we see peaks, rather than averages, in the graphs.

    RrdCF => 'MAX',

In addition to passing these defaults on in a call to VBTK::Wrapper::addVBObj, this method captures the resulting VBTK::ClientObject pointer ($vbObj) and makes the following call to '$vbObj->addGraphGroup':

  $vbObj->addGraphGroup (
    GroupNumber    => 1,
    Labels         => 'pct-utilization',
    Title          => 'Disk Utilization on <Host>, <filesystem>',
    CF             => 'MAX',
  );

This defines a graphGroup for the VBObject. See VBTK::ClientObject for details on the 'addGraphGroup' method.

A second call to 'addGraphGroup' is then made which combines all filesystems for this host into a single graph group.

  $vbObj->addGraphGroup (
    GroupNumber    => 2,
    DataSourceList => <built from list of filesystems>,
    Labels         => <build from list of filesystems>,
    Title          => "Disk Utilization on <Host>",
    CF             => 'MAX',
  );

SEE ALSO

VBTK, VBTK::Wrapper, VBTK::Parser, VBTK::ClientObject, VBTK::Server

AUTHOR

Brent Henry, vbtoolkit@yahoo.com

COPYRIGHT

Copyright (C) 1996-2002 Brent Henry

This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation available at: http://http://www.gnu.org/copyleft/gpl.html

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.