mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-25 18:38:30 +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;
|
$host = $1;
|
||||||
if ($host =~ /^([^:]+):(\d+)$/)
|
if ($host =~ /^([^:]+):(\d+)$/)
|
||||||
{
|
{
|
||||||
$host = $1;
|
$host = $1;
|
||||||
$port = $2;
|
$port = $2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif (!defined($host))
|
elsif (!defined($host))
|
||||||
|
@ -62,9 +62,9 @@ elsif (!defined($host))
|
||||||
my $hrSWRunPerfMem = "1.3.6.1.2.1.25.5.1.1.2.";
|
my $hrSWRunPerfMem = "1.3.6.1.2.1.25.5.1.1.2.";
|
||||||
|
|
||||||
my ($session, $error) = Net::SNMP->session(
|
my ($session, $error) = Net::SNMP->session(
|
||||||
-hostname => $host,
|
-hostname => $host,
|
||||||
-community => $community,
|
-community => $community,
|
||||||
-port => $port
|
-port => $port
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!defined ($session))
|
if (!defined ($session))
|
||||||
|
@ -88,16 +88,16 @@ if (defined $ARGV[0] and $ARGV[0] eq "config")
|
||||||
|
|
||||||
if ($memsize > 0)
|
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
|
else
|
||||||
{
|
{
|
||||||
print "graph_args --base 1024 -l 0\n";
|
print "graph_args --base 1024 -l 0\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "memory.draw AREA\n";
|
print "memory.draw AREA\n";
|
||||||
print "memory.label memory\n";
|
print "memory.label memory\n";
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,13 +122,13 @@ sub get_single
|
||||||
|
|
||||||
if (!defined $response->{$oid})
|
if (!defined $response->{$oid})
|
||||||
{
|
{
|
||||||
print "undef\n" if $DEBUG;
|
print "undef\n" if $DEBUG;
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "\"$response->{$oid}\"\n" if $DEBUG;
|
print "\"$response->{$oid}\"\n" if $DEBUG;
|
||||||
return $response->{$oid};
|
return $response->{$oid};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,34 +141,34 @@ sub get_by_regex
|
||||||
my $num = 0;
|
my $num = 0;
|
||||||
my $ret = $oid . "0";
|
my $ret = $oid . "0";
|
||||||
my $response;
|
my $response;
|
||||||
|
|
||||||
print "# Starting browse of $oid...\n" if $DEBUG;
|
print "# Starting browse of $oid...\n" if $DEBUG;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if ($num == 0)
|
if ($num == 0)
|
||||||
{
|
{
|
||||||
print "# Checking for $ret...\n" if $DEBUG;
|
print "# Checking for $ret...\n" if $DEBUG;
|
||||||
$response = $handle->get_request ($ret);
|
$response = $handle->get_request ($ret);
|
||||||
}
|
}
|
||||||
if ($num or !defined $response)
|
if ($num or !defined $response)
|
||||||
{
|
{
|
||||||
print "# Checking for sibling of $ret...\n" if $DEBUG;
|
print "# Checking for sibling of $ret...\n" if $DEBUG;
|
||||||
$response = $handle->get_next_request ($ret);
|
$response = $handle->get_next_request ($ret);
|
||||||
}
|
}
|
||||||
if (!$response)
|
if (!$response)
|
||||||
{
|
{
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
my @keys = keys %$response;
|
my @keys = keys %$response;
|
||||||
$ret = $keys[0];
|
$ret = $keys[0];
|
||||||
print "# Analyzing $ret (compared to $oid)...\n" if $DEBUG;
|
print "# Analyzing $ret (compared to $oid)...\n" if $DEBUG;
|
||||||
last unless ($ret =~ /^$oid/);
|
last unless ($ret =~ /^$oid/);
|
||||||
$num++;
|
$num++;
|
||||||
next unless ($response->{$ret} =~ /$regex/);
|
next unless ($response->{$ret} =~ /$regex/);
|
||||||
@keys = split (/\./, $ret);
|
@keys = split (/\./, $ret);
|
||||||
$result->{$keys[-1]} = $response->{$ret};;
|
$result->{$keys[-1]} = $response->{$ret};;
|
||||||
print "# Index $num: ", $keys[-1], " (", $response->{$ret}, ")\n" if $DEBUG;
|
print "# Index $num: ", $keys[-1], " (", $response->{$ret}, ")\n" if $DEBUG;
|
||||||
};
|
};
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue