mirror of
https://github.com/librenms/librenms.git
synced 2024-09-22 10:58:42 +00:00
fix: Always send 10 data points for netstats-tcp (#5020)
This commit is contained in:
parent
9fb02bbcd3
commit
e469aa97b0
@ -19,7 +19,7 @@ if ($device['os'] != 'Snom') {
|
||||
$rrd_def = array();
|
||||
$snmpstring = '';
|
||||
foreach ($oids as $oid) {
|
||||
$oid_ds = truncate($oid, 19, '');
|
||||
$oid_ds = substr($oid, 0, 19);
|
||||
$rrd_def[] = " DS:$oid_ds:COUNTER:600:U:10000000"; // Limit to 10MPPS
|
||||
$snmpstring .= ' TCP-MIB::'.$oid.'.0';
|
||||
}
|
||||
@ -28,23 +28,27 @@ if ($device['os'] != 'Snom') {
|
||||
$snmpstring .= ' tcpHCOutSegs.0';
|
||||
|
||||
$data = snmp_get_multi($device, $snmpstring, '-OQUs', 'TCP-MIB');
|
||||
$fields = $data[0];
|
||||
$data = $data[0];
|
||||
|
||||
// use HC Segs if we have them.
|
||||
if (isset($fields['tcpHCInSegs'])) {
|
||||
if (!empty($fields['tcpHCInSegs'])) {
|
||||
$fields['tcpInSegs'] = $fields['tcpHCInSegs'];
|
||||
$fields['tcpOutSegs'] = $fields['tcpHCOutSegs'];
|
||||
if (isset($data['tcpInSegs']) && isset($data['tcpOutSegs'])) {
|
||||
$fields = array();
|
||||
foreach ($oids as $oid) {
|
||||
$fields[$oid] = isset($data[$oid]) ? $data[$oid] : 'U';
|
||||
}
|
||||
|
||||
// use HC Segs if we have them.
|
||||
if (isset($data['tcpHCInSegs'])) {
|
||||
if (!empty($data['tcpHCInSegs'])) {
|
||||
$fields['tcpInSegs'] = $data['tcpHCInSegs'];
|
||||
$fields['tcpOutSegs'] = $data['tcpHCOutSegs'];
|
||||
}
|
||||
}
|
||||
unset($fields['tcpHCInSegs'], $fields['tcpHCOutSegs']);
|
||||
}
|
||||
|
||||
if (isset($fields['tcpInSegs']) && isset($fields['tcpOutSegs'])) {
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device, 'netstats-tcp', $tags, $fields);
|
||||
|
||||
$graphs['netstat_tcp'] = true;
|
||||
}
|
||||
|
||||
unset($oids, $data, $fields, $oid, $protos, $snmpstring);
|
||||
unset($oids, $data, $fields, $oid, $snmpstring);
|
||||
}//end if
|
||||
|
Loading…
Reference in New Issue
Block a user