feature: collect sysDescr and sysObjectID for stats to improve os detection (#5510)

This commit is contained in:
Tony Murray
2017-01-30 11:45:22 -06:00
committed by Neil Lathwood
parent 713176f6db
commit b06153d7e9
2 changed files with 14 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ Now onto the bit you're interested in, what is submitted and what we do with tha
#### What is submitted ####
- All data is anonymous.
- Generic statistics are taken from the database, these include things like device total, type and os, port types, speeds and total, total bgp peers. Take a look at the code for full details.
- Pairs of sysDescr and sysObjectID from devices with a small amount of sanitation to prevent things like hostnames from being submitted.
- We record version numbers of php, mysql, net-snmp and rrdtool
- A random UUID is generated on your own install.
- That's it!
@@ -21,6 +22,7 @@ Now onto the bit you're interested in, what is submitted and what we do with tha
- We store it, not for long - 3 months at the moment although this could change.
- We use it to generate pretty graphs for people to see.
- We use it to help prioritise issues and features that need to be worked on.
- We use sysDescr and sysObjectID to create unit tests and improve OS discovery
#### Questions? ####
- Q. How often is data submitted? A. We submit the data once a day according to running daily.sh via cron. If you disable this then opting in will not have any affect.

View File

@@ -73,9 +73,21 @@ if ($enabled == 1) {
$response['rrdtool_version'][] = array('total' => 1, 'version' => $version['rrdtool_ver']);
$response['netsnmp_version'][] = array('total' => 1, 'version' => $version['netsnmp_ver']);
// collect sysDescr and sysObjectID for submission
$device_info = dbFetchRows('SELECT COUNT(*) AS `count`,`os`, `sysDescr`, `sysObjectID` FROM `devices`
WHERE `sysDescr` IS NOT NULL AND `sysObjectID` IS NOT NULL GROUP BY `os`, `sysDescr`, `sysObjectID`');
// sanitize sysDescr
$device_info = array_map(function ($entry) {
$entry['sysDescr'] = preg_replace('/^Linux [A-Za-z\-0-9\.]+ (?=[0-9\.]{5,9})/', 'Linux hostname ', $entry['sysDescr']);
$entry['sysDescr'] = preg_replace('/ SN: [A-Z0-9]{12}/', ' SN: 0A0A0A0A0A0A ', $entry['sysDescr']);
return $entry;
}, $device_info);
$output = array(
'uuid' => $uuid,
'data' => $response,
'info' => $device_info,
);
$data = json_encode($output);
$submit = array('data' => $data);