# requires textproc/p5-XML-LibXML
#
use warnings;
+use strict;
use XML::LibXML;
my %dict;
my $offset = 10;
+
while (1) {
print scalar localtime() . "\n";
+ print "------------------------\n" ;
system("/usr/bin/vmstat -z --libxo xml >$filename");
- $doc = XML::LibXML->load_xml(location => $filename);
- foreach my $id ( $doc->findnodes('//zone')) {
+ my $doc = XML::LibXML->load_xml(location => $filename);
+ foreach my $id ($doc->findnodes('//zone')) {
my $name=$id->findvalue('name');
my $used=$id->findvalue('used');
+ my $val = int($used);
if ($name eq "vm pgcache") {
next;
if (exists $dict{$name}) {
my $v0=$dict{$name} + $offset;
- if ($v0 < int($used)) {
- print "$name: $v0 => $used \n";
- $dict{$name}=int(${used});
+ if ($v0 < $val) {
+format DIFF_V0V1 =
+ @<<<<<<<<<<<<<<<<<<<<<< @######## => @########
+ $name,$v0,$val
+.
+ $~ = "DIFF_V0V1";
+ write;
+ $dict{$name} = $val;
}
} else {
- $dict{$name}=int(${used});
+ $dict{$name} = $val;
}
}
- print "------------------------\n" ;
+
+ print "\n";
sleep(5);
}
+