mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
feature: collect sysDescr and sysObjectID for stats to improve os detection (#5510)
This commit is contained in:
committed by
Neil Lathwood
parent
713176f6db
commit
b06153d7e9
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user