Skip to content

Commit

Permalink
Fixing irrelevant values rpm packetloss (librenms#13010)
Browse files Browse the repository at this point in the history
* Fixing irrelevant value for Juniper RPM percentage packetloss

Old MIB values fron generic DISMAN ping pingResultsProbeResponses and pingResultsSentProbes are
querying current probe values so if a probe is still pending, irrelevant value are taken. It results
in high percentage packetloss that not match reality.
Using the Juniper MIB values jnxPingLastTestResultProbeResponses and jnxPingLastTestResultSentProbes
seem to fix this.
At the same time we take here jnxPingLastTestResultAvgRttUs instead of jnxPingResultsRttUs which
is more accurate.

* Fixing typo in the name of Cisco MIB for Cisco SLA's polling

* Delete old comment about SNMP values : getting the all values once instead of one by one

* Adding test files for Juniper RPM last modification

* Revert "Adding test files for Juniper RPM last modification"

This reverts commit 0209b18.

Reverting to keep snmprec junos_vmx already generated file

* Regenerating JSON test file and keeping snmprec file
  • Loading branch information
geg347 authored Jul 8, 2021
1 parent fd597db commit 3bf1118
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
18 changes: 8 additions & 10 deletions LibreNMS/OS/Junos.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ public function pollSlas($slas)

// Go get some data from the device.
$data = snmpwalk_group($device, 'pingCtlRowStatus', 'DISMAN-PING-MIB', 2);
$data = snmpwalk_group($device, 'pingResultsProbeResponses', 'DISMAN-PING-MIB', 2, $data);
$data = snmpwalk_group($device, 'pingResultsSentProbes', 'DISMAN-PING-MIB', 2, $data);
$data = snmpwalk_group($device, 'jnxPingResultsTable', 'JUNIPER-PING-MIB', 2, $data);
$data = snmpwalk_group($device, 'jnxPingLastTestResultTable', 'JUNIPER-PING-MIB', 2, $data);

// Get the needed information
foreach ($slas as $sla) {
Expand All @@ -117,8 +115,8 @@ public function pollSlas($slas)
// Use DISMAN-PING Status codes. 0=Good 2=Critical
$sla->opstatus = $data[$owner][$test]['pingCtlRowStatus'] == '1' ? 0 : 2;

$sla->rtt = $data[$owner][$test]['jnxPingResultsRttUs'] / 1000;
$time = Carbon::parse($data[$owner][$test]['jnxPingResultsTime'])->toDateTimeString();
$sla->rtt = $data[$owner][$test]['jnxPingLastTestResultAvgRttUs'] / 1000;
$time = Carbon::parse($data[$owner][$test]['jnxPingLastTestResultTime'])->toDateTimeString();
echo 'SLA : ' . $rtt_type . ' ' . $owner . ' ' . $test . '... ' . $sla->rtt . 'ms at ' . $time . "\n";

$fields = [
Expand All @@ -140,11 +138,11 @@ public function pollSlas($slas)
case 'IcmpEcho':
case 'IcmpTimeStamp':
$icmp = [
'MinRttUs' => $data[$owner][$test]['jnxPingResultsMinRttUs'] / 1000,
'MaxRttUs' => $data[$owner][$test]['jnxPingResultsMaxRttUs'] / 1000,
'StdDevRttUs' => $data[$owner][$test]['jnxPingResultsStdDevRttUs'] / 1000,
'ProbeResponses' => $data[$owner][$test]['pingResultsProbeResponses'],
'ProbeLoss' => (int) $data[$owner][$test]['pingResultsSentProbes'] - (int) $data[$owner][$test]['pingResultsProbeResponses'],
'MinRttUs' => $data[$owner][$test]['jnxPingLastTestResultMinRttUs'] / 1000,
'MaxRttUs' => $data[$owner][$test]['jnxPingLastTestResultMaxRttUs'] / 1000,
'StdDevRttUs' => $data[$owner][$test]['jnxPingLastTestResultStdDevRttUs'] / 1000,
'ProbeResponses' => $data[$owner][$test]['jnxPingLastTestResultProbeResponses'],
'ProbeLoss' => (int) $data[$owner][$test]['jnxPingLastTestResultSentProbes'] - (int) $data[$owner][$test]['jnxPingLastTestResultProbeResponses'],
];
$rrd_name = ['sla', $sla_nr, $rtt_type];
$rrd_def = RrdDefinition::make()
Expand Down
2 changes: 1 addition & 1 deletion LibreNMS/OS/Shared/Cisco.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public function pollSlas($slas)
$device = $this->getDeviceArray();

$data = snmpwalk_group($device, 'rttMonLatestRttOperTable', 'CISCO-RTTMON-MIB');
$data = snmpwalk_group($device, 'ttMonLatestOper', 'CISCO-RTTMON-MIB', 1, $data);
$data = snmpwalk_group($device, 'rttMonLatestOper', 'CISCO-RTTMON-MIB', 1, $data);

$time_offset = time() - $this->getDevice()->uptime;

Expand Down
25 changes: 24 additions & 1 deletion tests/data/junos_vmx.json
Original file line number Diff line number Diff line change
Expand Up @@ -12554,7 +12554,30 @@
}
]
},
"poller": "matches discovery"
"poller": {
"slas": [
{
"sla_nr": 664440489,
"owner": "test-rpm3",
"tag": "timestamp",
"rtt_type": "IcmpTimeStamp",
"rtt": 0,
"status": 1,
"opstatus": 0,
"deleted": 0
},
{
"sla_nr": 1077751536,
"owner": "test-rpm",
"tag": "internet",
"rtt_type": "IcmpEcho",
"rtt": 0,
"status": 1,
"opstatus": 0,
"deleted": 0
}
]
}
},
"sensors": {
"discovery": {
Expand Down

0 comments on commit 3bf1118

Please sign in to comment.