Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Issue #94 #106

Merged
merged 5 commits into from
Jun 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions src/bin/mrtg
Original file line number Diff line number Diff line change
Expand Up @@ -675,17 +675,19 @@ sub getcurrent {
# (OID:community@host or OID) that may have been specified with the RouterUptime
# target keyword
if( defined $rcfg->{ routeruptime }{ $rou } ) {
my( $noid, $nloc ) = split( /:/, $rcfg->{ routeruptime }{ $rou }, 2 );
# If only location (community@host) was specified then
# move the location details into the right place
if( $noid =~ /@/ ) {
$nloc = $noid;
$noid = undef;
}
# If no OID (community@host) was specified use the hardcoded default
if( not $noid ) {
$noid = 'sysUptime';
}
my ( $noid, $comm );
#break apart at the right most at symbol
my( $noidcomm, $nloc ) = $rcfg->{ routeruptime }{ $rou } =~ /^(.*)@([^@]+)$/;
debug("base","noidcom $noidcomm and nloc $nloc");
#now assess for presence of custom OID for uptime
if ($noidcomm =~ /:/ ) {
( $noid, $comm ) = split( /:/, $noidcomm, 2);
}
else {
$noid='sysUptime';
$comm=$noidcomm;
}
debug("base","noid is $noid and comm is $comm");
lukerg marked this conversation as resolved.
Show resolved Hide resolved
# If no location (community@host) was specified use values from the
# unique target referred to in the monitored data calculation
if( not $nloc ){
Expand All @@ -699,10 +701,10 @@ sub getcurrent {
}
}

$uploc = $nloc;
$uploc = "$comm\@$nloc";
# Get the device uptime if $noid(OID) and $nloc (community@host) have been specified
# one way or the other
debug('base', "Fetching sysUptime and sysName from: $noid:$nloc");
debug('base', "Fetching sysUptime and sysName from: $noid:$uploc");
( $uptime, $name ) = snmpget( $uploc, $rcfg->{ snmpoptions }{ $rou }, $noid, 'sysName');
}

Expand Down