Check_command usage metrics over the whole icinga configuration

Hello,

is there an easy way to find out how often a check_command is used within the whole icinga setup?
I need to find out how often snmp-based checks are used.

My approach whould be to write a script which parses the output of ‘icinga2 object list --type Service’ and filter for commands which have snmp-like arguments…
Is there a better way to do this?

1 Like

Hello @K0nne!

You could query all hosts and services (you likely want to limit this query attributes to only the check_command, ?attrs=check_command), unJSONify the response and count the check_command-s.

Best,
AK

2 Likes

icinga2 object list -t service | grep check_command | grep snmp | wc -l

2 Likes

Thank you for the input! I will test it.

I was able to solve the problem with the following command, which simulates a “group by”:

icinga2 object list -t service | grep check_command | sort | uniq -c

1 Like