mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* feature: Allow customisation of rrd step/heartbeat when creating new rrd files * revert defaults * added docs + webui config option * Move RrdDefinition to an Object to make them easier to create and remove the possibility of typos. * Fix style/lint issues and missing use statements * 3 more missing use statements * updated doc + moved schema file
56 lines
1.4 KiB
PHP
56 lines
1.4 KiB
PHP
<?php
|
|
|
|
use LibreNMS\RRD\RrdDefinition;
|
|
|
|
if (!starts_with($device['os'], array('Snom', 'asa'))) {
|
|
echo ' TCP';
|
|
|
|
$oids = array(
|
|
'tcpActiveOpens',
|
|
'tcpPassiveOpens',
|
|
'tcpAttemptFails',
|
|
'tcpEstabResets',
|
|
'tcpCurrEstab',
|
|
'tcpInSegs',
|
|
'tcpOutSegs',
|
|
'tcpRetransSegs',
|
|
'tcpInErrs',
|
|
'tcpOutRsts',
|
|
);
|
|
|
|
$rrd_def = new RrdDefinition();
|
|
$snmpstring = '';
|
|
foreach ($oids as $oid) {
|
|
$rrd_def->addDataset($oid, 'COUNTER', null, 10000000);
|
|
$snmpstring .= ' TCP-MIB::'.$oid.'.0';
|
|
}
|
|
|
|
$snmpstring .= ' tcpHCInSegs.0';
|
|
$snmpstring .= ' tcpHCOutSegs.0';
|
|
|
|
$data = snmp_get_multi($device, $snmpstring, '-OQUs', 'TCP-MIB');
|
|
$data = $data[0];
|
|
|
|
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'];
|
|
}
|
|
}
|
|
|
|
$tags = compact('rrd_def');
|
|
data_update($device, 'netstats-tcp', $tags, $fields);
|
|
|
|
$graphs['netstat_tcp'] = true;
|
|
}
|
|
|
|
unset($oids, $data, $fields, $oid, $snmpstring);
|
|
}//end if
|