Skip to content

Update performance data unit of measure - #61

Open
dropthemic wants to merge 1 commit into
wernerfred:masterfrom
dropthemic:patch-2
Open

Update performance data unit of measure#61
dropthemic wants to merge 1 commit into
wernerfred:masterfrom
dropthemic:patch-2

Conversation

@dropthemic

Copy link
Copy Markdown
Contributor

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=2211c

After change:
...|/volume1=4998GB /volume2=2211GB

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 c to KB, and storage perfdata from c to GB.
  • Remove the c UOM from temperature perfdata (disk temps, system temp).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread check_synology.py
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 + '%')
Comment thread check_synology.py
# 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 + ' '
Comment thread check_synology.py

# 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)
@wernerfred

Copy link
Copy Markdown
Owner

@dropthemic any objections on the AI suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants