NAME
VBTK::Wrapper::Vmstat - System monitoring with 'vmstat'
SYNOPSIS
# If you like all the defaults, then there's no need to over-ride them.
$o = new VBTK::Wrapper::Vmstat ();
$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 'vmstat' monitoring process.
METHODS
The following methods are supported
- $o = new VBTK::Wrapper::Vmstat (<parm1> => <val1>, <parm2> => <val2>, ...)
-
This method calls 'new VBTK::Wrapper' after defaulting the parameters to best monitor the 'vmstat' 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 => 60,
- Execute
-
Defaults to run the 'vmstat' command with an interval of 60 seconds.
Execute => 'vmstat 60',
- Split
-
Split into columns on whitespace.
Split => '\s+',
- Filter
-
Filter out all rows which don't start with numeric data. This gets rid of the headers from the 'vmstat' command.
Filter => '^\s*\d+[^a-zA-Z]*$',
- SkipLines
-
Skip the first 3 lines of vmstat, since they contain data from before the interval was started.
Skiplines => 3,
- VBServerURI
-
A URI which specifies which VB Server to report results to. Defaults to the environment variable $VBURI.
VBServerURI => 'http://myvbserver:4712',
- VBHeader
-
Defaults to standard vmstat headers.
- VBDetail
-
Show the time with the exact text as received from vmstat.
VBDetail => [ '$time $data' ],
- LogHeader
-
Same as VBHeader
- LogDetail
-
Same as VBDetail
- RotateLogAt
-
Rotate at 12:00am
RotateLogAt => '12:00am',
- Follow
-
This has to run in follow mode, since the 'vmstat 60' command never terminates.
Follow => 1,
- FollowTimeout
-
FollowTimeout => (2 * Interval) + 10,
- DebugHeader
-
DebugHeader => 'vmstat',
- NumCpus
-
A number indicating how many CPU's are in the host to be monitored. This value is specific to the VBTK::Wrapper::Vmstat class and is not passed on to the VBTK::Parser. If not specified, the class will attempt to determine it by using the 'psrinfo' command. The value is used later on to determine 'Warning' and 'Failed' thresholds when setting defaults in the call to 'addVBObj'. (Defaults to 1 if it can't be determined with the 'psrinfo' command)
NumCpus => 2,
- $vbObj = $o->addVBObj(<parm1> => <val1>, <parm2> => <val2>, ...)
-
This method calls VBTK::Wrapper::addVBObj after defaulting unspecified parameters to best monitor the 'vmstat' 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.cpu",
- TextHistoryLimit
-
TextHistoryLimit => 100,
- ReverseText
-
Reverse the text, so that we see the most recently reported lines first.
ReverseText => 1,
- Rules
-
If run queue exceeds 'NumCpus', then set to Warning. If it exceeds 3 times 'NumCpus', then set to Failed.
Rules => { "(\$data[1] > <NumCpus>)" => 'Warn', "(\$data[1] > <NumCpus * 3>)" => 'Fail' },
- StatusHistoryLimit
-
Limit to storing the last 30 status changes
StatusHistoryLimit => 30,
- StatusUpgradeRules
-
StatusUpgradeRules => 'Upgrade to Failed if Warning occurs 2 times in 6 min',
- ExpireAfter
-
ExpireAfter => (<Interval> * 3) seconds
- Description
-
Description = qq( This object uses the 'vmstat' command to monitor the CPU utilization on $::HOST. It will set the status to 'Warning' or 'Failed' based on the value of the run queue and the CPU idle time. ),
- RrdColumns
-
Save the user CPU, system CPU, run-queue, and scan-rate values into the Rrd database so that we can graph them.
RrdColumns => [ '$data[19]', '$data[20]', '$data[0]', '$data[11]' ],
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 => 'user,system,runQueue,scanRate', Title => "$::HOST cpu", );
This defines a graphGroup for the VBObject. See VBTK::ClientObject for details on the 'addGraphGroup' method.
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.