limit perf array index length to 19 characters due to limitation in ds-name rrdtool. nagios plugin check_mysql has performance counters that exceed a 19 character limit found in rrdtool.
limit perf array index length to 19 charaters due to limitation in ds…
…-name per rrdtool
Auto-Deploy finished, Test PR at http://4731.ci.librenms.org or https://4731.ci.librenms.org
This needs a little more safety checks in. This at the moment has the chance that two DS' will have the same name if we just strip additional chars off. The new 19 char long name should be compared to the array to see if it exists and if it does, it will need changing again.
p.s some code formatting issues are flagged by Travis, these will also need fixing.
Merge branch 'master' of https://github.com/librenms/librenms into is…
merging in cisco updates
create unique ds-name for rrdtool. avoid name collisions in perf array
clean up style
I thin I have address the issues concerning name collisions and style.
clean up style white spaces
declare $DS = array();
I was trying to figure out how best to deal with this and the approach is right but I think it could be simplified in just using the service_id from the DB table. It's available as $service['service_id'] as the 19th char. It's always going to be unique so we avoid clashes. The only time this causes an issue is if someone removes a service and re-adds (but only if the name was > 19 chars anyway).
That would reduce the loops down and make things a bit cleaner - @librenms/reviewers ?
After some discussion on irc. service id can be greater than 9 and does not offer sequential numbering to differentiate multiple performance counters per a single service.
Remember that the number and order of datasets in an rrd basically needs to be fixed. The only time the dsname is used is when generating graphs.
dsnames not only need to be unique, but they need to be stable and deterministic.
I've just rebased this ready for merge but then did realise - we have no way to actually view the data in graph format as services doesn't seem to have that support or am I missing something.
I would like to try and solve this in a slightly different manner. I think there is a chance that the array order will be rearranged. The problem with that is, during the update cycle the order numbers applied would go to the wrong field. example the following service perf (DS) names:
the rrdcreate command will be run with a field order of
But the rrdupdate commands will continue to place values in the original order.
I and going to add another value to the array when dealing with the length to avoid the ordering issue.
My mistake. That is the fixed version... You can check functionality with the following code:
Moved ds normalization from function poll_service to function check_s…
Changed echo to d_echo
php script that emulates changes to includes/services.inc.php for testing
increase size of service_ds for check_mysql format mysql
rename sql update to avoid conflict
remove extra blank line :(
extra blank line :(
check_mysql Uptime should be rrd type GAUGE
rebase against master
The inspection completed: 2 new issues, 1 updated code elements
All good with me. @librenms/reviewers anyone else?