Skip to content

Commit

Permalink
Fix Issue #94 (#106)
Browse files Browse the repository at this point in the history
* RouterUpTime accepts & uses colon options
  • Loading branch information
lukerg committed Jun 21, 2023
1 parent b1e132d commit c2f79f4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
6 changes: 4 additions & 2 deletions src/CHANGES
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
From: fweimer-rh
* Future C compilers are likely to reject implicit function declarations by default. This language feature was officially removed in 1999. @ffwmeier-rh

Changes 2.17.11, 2022-??-??
---------------------------
From: lukerg
* RouterUpTime accepts & uses colon options

From: youpong
* stop making an orphan symlink (mrtg-mailer.pod)
* fix Brazilian translation(Issue #74)
Expand Down
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");
# 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

0 comments on commit c2f79f4

Please sign in to comment.