mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
bug - Fix Cisco NTP values (#15639)
* ntp fix style * Number::unsignedAsSigned
This commit is contained in:
@@ -54,9 +54,23 @@ if (is_array($components) && count($components) > 0) {
|
||||
|
||||
// Extract the statistics and update rrd
|
||||
$rrd['stratum'] = $array['stratum'];
|
||||
$rrd['offset'] = hexdec($cntpPeersVarEntry['1.3.6.1.4.1.9.9.168.1.2.1.1'][23][$array['UID']]);
|
||||
$rrd['delay'] = hexdec($cntpPeersVarEntry['1.3.6.1.4.1.9.9.168.1.2.1.1'][24][$array['UID']]);
|
||||
$rrd['dispersion'] = hexdec($cntpPeersVarEntry['1.3.6.1.4.1.9.9.168.1.2.1.1'][25][$array['UID']]);
|
||||
|
||||
// Cisco NTPSignedTimeValue - 16 bits of signedint, and 16 bits of unsignedint for fractional
|
||||
// The time in seconds that could represent signed quantities like time delay with respect to some
|
||||
// source. This textual-convention is specific to Cisco implementation of NTP where 32-bit integers are
|
||||
// used for such quantities. The signed integer part is in the first 16 bits and the fraction part is in
|
||||
// the last 16 bits.
|
||||
|
||||
$hexoffset = $cntpPeersVarEntry['1.3.6.1.4.1.9.9.168.1.2.1.1'][23][$array['UID']];
|
||||
$rrd['offset'] = Number::unsignedAsSigned(hexdec(substr($hexoffset, 0, 5)), 16) + hexdec(substr($hexoffset, -5)) / 65536;
|
||||
|
||||
$hexdelay = $cntpPeersVarEntry['1.3.6.1.4.1.9.9.168.1.2.1.1'][24][$array['UID']];
|
||||
$rrd['delay'] = Number::unsignedAsSigned(hexdec(substr($hexdelay, 0, 5)), 16) + hexdec(substr($hexdelay, -5)) / 65536;
|
||||
|
||||
// Cisco NTPUnsignedTimeValue - 16 bits of unsignedint, and 16 bits of unsignedint for fractional
|
||||
$hexdisp = $cntpPeersVarEntry['1.3.6.1.4.1.9.9.168.1.2.1.1'][25][$array['UID']];
|
||||
$rrd['dispersion'] = hexdec(substr($hexdisp, 0, 5)) + hexdec(substr($hexdisp, -5)) / 65536;
|
||||
|
||||
$tags = compact('ntp', 'rrd_name', 'rrd_def', 'peer');
|
||||
data_update($device, 'ntp', $tags, $rrd);
|
||||
|
||||
|
Reference in New Issue
Block a user