Update performance data unit of measure - #61
Open
dropthemic wants to merge 1 commit into
Open
Conversation
The performance data has the wrong unit, all are marked as "c" which is a continuous counter. Per Nagios guidelines, load averages should have no unit, and memory/storage should be in KB/GB/B units.
There was a problem hiding this comment.
Pull request overview
This PR updates Nagios perfdata unit-of-measure (UOM) strings emitted by check_synology.py so that graphing tools (e.g., pnp4nagios) interpret load averages as unitless and storage/memory as size units rather than as “counter” metrics.
Changes:
- Remove the
c(counter) UOM from load-average perfdata. - Change memory perfdata from
ctoKB, and storage perfdata fromctoGB. - Remove the
cUOM from temperature perfdata (disk temps, system temp).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| state = 'CRITICAL' | ||
|
|
||
| print(state + ' - {:0.1f}% '.format(memory_percent) + 'usable ({0:0.1f} MB free and {1:0.1f} MB cached out of {2:0.1f} MB)'.format((memory_unused / 1024), (memory_cached / 1024), (memory_total / 1024)), '|memory_total=%dc' % memory_total, 'memory_unused=%dc' % memory_unused, 'memory_cached=%dc' % memory_cached, 'memory_usable=%dc' % memory_usable, 'memory_percent=%d' % memory_percent + '%') | ||
| print(state + ' - {:0.1f}% '.format(memory_percent) + 'usable ({0:0.1f} MB free and {1:0.1f} MB cached out of {2:0.1f} MB)'.format((memory_unused / 1024), (memory_cached / 1024), (memory_total / 1024)), '|memory_total=%dKB' % memory_total, 'memory_unused=%dKB' % memory_unused, 'memory_cached=%dKB' % memory_cached, 'memory_usable=%dKB' % memory_usable, 'memory_percent=%d' % memory_percent + '%') |
| # 2. Compute textual and perfdata output. | ||
| output += ' - ' + disk_name + ': Status: ' + disk_status + ', Temperature: ' + disk_temp + ' C' + ', Health status: ' + disk_health_status | ||
| perfdata += 'temperature' + disk_name + '=' + disk_temp + 'c ' | ||
| perfdata += 'temperature' + disk_name + '=' + disk_temp + ' ' |
|
|
||
| # 3. Respond with textual and perfdata output and propagate exit code. | ||
| print(state + ' - Model: %s, S/N: %s, System Temperature: %s C, System Status: %s, System Fan: %s, CPU Fan: %s, Powersupply : %s' % (status_model, status_serial, status_temperature, status_system, status_system_fan, status_cpu_fan, status_power) + ' | system_temp=%sc' % status_temperature) | ||
| print(state + ' - Model: %s, S/N: %s, System Temperature: %s C, System Status: %s, System Fan: %s, CPU Fan: %s, Powersupply : %s' % (status_model, status_serial, status_temperature, status_system, status_system_fan, status_cpu_fan, status_power) + ' | system_temp=%s' % status_temperature) |
Owner
|
@dropthemic any objections on the AI suggestions? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The performance data has the wrong unit, all are marked as "c" which is a continuous counter. Per Nagios guidelines, load averages should have no unit, and memory/storage should be in KB/GB/B units.
When using pnp4nagios, the graphs are incorrectly rendered with the continuous counter UOM, this patch fixes the issue.
Sample perf data before change:
...| /volume1=4998c /volume2=2211cAfter change:
...|/volume1=4998GB /volume2=2211GB