mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-24 09:57:09 +00:00
Fixed overflow with >4Gb memory
This commit is contained in:
parent
1a5575ed90
commit
f5dd2be453
1 changed files with 37 additions and 37 deletions
|
@ -48,8 +48,8 @@ if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_memory$/)
|
|||
$host = $1;
|
||||
if ($host =~ /^([^:]+):(\d+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
}
|
||||
elsif (!defined($host))
|
||||
|
@ -62,9 +62,9 @@ elsif (!defined($host))
|
|||
my $hrSWRunPerfMem = "1.3.6.1.2.1.25.5.1.1.2.";
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined ($session))
|
||||
|
@ -88,16 +88,16 @@ if (defined $ARGV[0] and $ARGV[0] eq "config")
|
|||
|
||||
if ($memsize > 0)
|
||||
{
|
||||
print "graph_args --base 1024 -l 0 --upper-limit $memsize\n";
|
||||
print "graph_args --base 1024 -l 0 --upper-limit $memsize\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "graph_args --base 1024 -l 0\n";
|
||||
print "graph_args --base 1024 -l 0\n";
|
||||
}
|
||||
|
||||
print "memory.draw AREA\n";
|
||||
print "memory.label memory\n";
|
||||
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
@ -122,13 +122,13 @@ sub get_single
|
|||
|
||||
if (!defined $response->{$oid})
|
||||
{
|
||||
print "undef\n" if $DEBUG;
|
||||
return undef;
|
||||
print "undef\n" if $DEBUG;
|
||||
return undef;
|
||||
}
|
||||
else
|
||||
{
|
||||
print "\"$response->{$oid}\"\n" if $DEBUG;
|
||||
return $response->{$oid};
|
||||
print "\"$response->{$oid}\"\n" if $DEBUG;
|
||||
return $response->{$oid};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,34 +141,34 @@ sub get_by_regex
|
|||
my $num = 0;
|
||||
my $ret = $oid . "0";
|
||||
my $response;
|
||||
|
||||
|
||||
print "# Starting browse of $oid...\n" if $DEBUG;
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
if ($num == 0)
|
||||
{
|
||||
print "# Checking for $ret...\n" if $DEBUG;
|
||||
$response = $handle->get_request ($ret);
|
||||
}
|
||||
if ($num or !defined $response)
|
||||
{
|
||||
print "# Checking for sibling of $ret...\n" if $DEBUG;
|
||||
$response = $handle->get_next_request ($ret);
|
||||
}
|
||||
if (!$response)
|
||||
{
|
||||
return undef;
|
||||
}
|
||||
my @keys = keys %$response;
|
||||
$ret = $keys[0];
|
||||
print "# Analyzing $ret (compared to $oid)...\n" if $DEBUG;
|
||||
last unless ($ret =~ /^$oid/);
|
||||
$num++;
|
||||
next unless ($response->{$ret} =~ /$regex/);
|
||||
@keys = split (/\./, $ret);
|
||||
$result->{$keys[-1]} = $response->{$ret};;
|
||||
print "# Index $num: ", $keys[-1], " (", $response->{$ret}, ")\n" if $DEBUG;
|
||||
if ($num == 0)
|
||||
{
|
||||
print "# Checking for $ret...\n" if $DEBUG;
|
||||
$response = $handle->get_request ($ret);
|
||||
}
|
||||
if ($num or !defined $response)
|
||||
{
|
||||
print "# Checking for sibling of $ret...\n" if $DEBUG;
|
||||
$response = $handle->get_next_request ($ret);
|
||||
}
|
||||
if (!$response)
|
||||
{
|
||||
return undef;
|
||||
}
|
||||
my @keys = keys %$response;
|
||||
$ret = $keys[0];
|
||||
print "# Analyzing $ret (compared to $oid)...\n" if $DEBUG;
|
||||
last unless ($ret =~ /^$oid/);
|
||||
$num++;
|
||||
next unless ($response->{$ret} =~ /$regex/);
|
||||
@keys = split (/\./, $ret);
|
||||
$result->{$keys[-1]} = $response->{$ret};;
|
||||
print "# Index $num: ", $keys[-1], " (", $response->{$ret}, ")\n" if $DEBUG;
|
||||
};
|
||||
return $result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue