mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
Plugin xen-multi: xentop bug workaround
There is a bug in xentop, its output is too high in rare cases. https://lists.xenproject.org/archives/html/xen-users/2019-04/msg00020.html Workaround to process 3 iterations after the first one (4 itrations) and choose the lowest cpusecs value line.
This commit is contained in:
parent
914180fe54
commit
57558b68bd
1 changed files with 21 additions and 8 deletions
|
@ -129,7 +129,12 @@ sub trim_label {
|
|||
# Global variables
|
||||
my (%domains,$domain,@domainlist,$munindomain,$cpusecs,$cpupercent,$memk,$nettxk,$netrxk,$vbdrd,$vbdwr);
|
||||
|
||||
open (XENTOP,"xentop -b -f -i2 |") or die "Could not execute xentop, $!";
|
||||
# There is a bug in xentop, its output is too high in rare cases.
|
||||
# https://lists.xenproject.org/archives/html/xen-users/2019-04/msg00020.html
|
||||
# Workaround to process 3 iterations after the first one (4 iterations) and
|
||||
# choose the lowest cpusecs value line.
|
||||
|
||||
open (XENTOP,"xentop -b -f -i4 |") or die "Could not execute xentop, $!";
|
||||
|
||||
# Now we build a hash of hashes to store information
|
||||
while (<XENTOP>) {
|
||||
|
@ -146,6 +151,13 @@ while (<XENTOP>) {
|
|||
|
||||
# We need the remaining data only for a normal run
|
||||
if ($ARGV[0] eq "") {
|
||||
# the cnt key counts the iterations
|
||||
# - skip the first one because xentop gives 0% cpu for the first iteration ( cnt > 1 )
|
||||
# - process if not processed yet ( !defined ) or if current cpusecs less than any earlier
|
||||
# normally the cpusecs is monotonous per domain as it grows so a smaller value means that the previous one was wrong
|
||||
|
||||
$domains{$domain}{'cnt'}++;
|
||||
if ( $domains{$domain}{'cnt'} > 1 && ( !defined $domains{$domain}{'cpusecs'} || $cpusecs < $domains{$domain}{'cpusecs'} ) ) {
|
||||
$domains{$domain}{'cpusecs'} = $cpusecs;
|
||||
$domains{$domain}{'cpupercent'} = $cpupercent;
|
||||
$domains{$domain}{'mem'} = $memk;
|
||||
|
@ -155,6 +167,7 @@ while (<XENTOP>) {
|
|||
$domains{$domain}{'vbdwr'} = $vbdwr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@domainlist = sort(keys(%domains));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue