Skip to content

add additional flags to place 'count' and 'problem count' ~ 'failed' perfdata metrics to the front of metrics array.#385

Open
inqrphl wants to merge 2 commits into
mainfrom
check-service-add-flags-to-prepend-count-metrics
Open

add additional flags to place 'count' and 'problem count' ~ 'failed' perfdata metrics to the front of metrics array.#385
inqrphl wants to merge 2 commits into
mainfrom
check-service-add-flags-to-prepend-count-metrics

Conversation

@inqrphl
Copy link
Copy Markdown
Contributor

@inqrphl inqrphl commented May 29, 2026

this flag is for CheckData struct, so it can be used alongside any other check that utilizes addCountMetrics.

existing: addCountMetrics
added: addCountMetricsToFront
existing: addProblemCountMetrics
added: addProblemCountMetricsToFront

prepending is slower than appending if its a long list, so its a flag. behavior is opt-in and not default.

toggle this flag for check_service, this was the intended target for this. when each service has its own perfdata metric, which could be above 100 metrics total, the count would be appended to the end and truncated in previews.

./snclient run check_service warn="count gt 10"
WARNING - found 75 services |'count'=75;10;;0 'failed'=0;;;0 'acpid'=4 'apache2'=4 'apparmor'=3 ......

…perfdata metrics to the front of metrics array. this flag is for CheckData struct

prepending is slower than appending if its a long list, so its a flag. behavior is opt-in and not default.

toggle this flag for check_service, this was the intended target for this. when each service has its own perfdata metric, the count would be appended to the end and generally truncated in previews.
@lgmu
Copy link
Copy Markdown
Contributor

lgmu commented May 29, 2026

If we want to check the count, there is no need to print the state of each service as perf data.
Currently when using count in the critical condition, this is already correct and doesn't list the services.

The failed perf data is a nice extra, but then it should also apply for OK and CRITICAL then.

Expected Output:

OK - found 75 services | 'count'=75;100;200;0 'failed'=0;;;0
WARNING - found 75 services | 'count'=75;10;200;0 'failed'=0;;;0
CRITICAL - found 75 services | 'count'=75;10;20;0 'failed'=0;;;0

…ly in perfdata as metric

if count is not used, it adds all serices individually
@inqrphl
Copy link
Copy Markdown
Contributor Author

inqrphl commented May 29, 2026

New behavior: If "count" is used in the thresholds, stop adding each service as perfdata individually.

./snclient run check_service
OK - All 75 service(s) are ok. |'count'=75;;;0 'failed'=0;;;0 'acpid'=4 'apache2'=4 'apparmor'=3 'atd'=4 .........

./snclient run check_service warn="count gt 10"
WARNING - found 75 services |'count'=75;10;;0 'failed'=0;;;0

./snclient run check_service crit="count gt 10"
CRITICAL - found 75 services |'count'=75;;10;0 'failed'=0;;;0

./snclient run check_service warn="count gt 10000"
OK - All 75 service(s) are ok. |'count'=75;10000;;0 'failed'=0;;;0

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.

2 participants