Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add multiplier option to check_snmp which is available since monitori… #9975

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nicolasberens
Copy link
Contributor

monitoring-plugins added a multiplier option in 2.3.3: https://github.com/monitoring-plugins/monitoring-plugins/releases/tag/v2.3.3

This PR adds the option to the ITL definition for check_snmp

It Fixes #9907

@cla-bot cla-bot bot added the cla/signed label Jan 18, 2024
@Al2Klimov Al2Klimov added the area/itl Template Library CheckCommands label Mar 11, 2024
@Al2Klimov Al2Klimov added this to the 2.15.0 milestone Mar 11, 2024
Copy link
Member

@yhabteab yhabteab left a comment

Choose a reason for hiding this comment

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

Apart from the comments below, could you please also document the new options in check_snmp and check_snmpv3 accordingly. Thanks!

Comment on lines +1771 to +1773
"-M" = {
value = "$snmp_multiplier$"
description = "Multiplies current value, 0 < n < 1 works as divider, defaults to 1"
Copy link
Member

Choose a reason for hiding this comment

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

Please either use set_if instead of value here or set the vars.snmp_multiplier custom variable at the end of the command definition to its default value (1), otherwise Icinga 2 may just pass it with an empty string (-M '').

Choose a reason for hiding this comment

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

I do not think this is how it works, empty variables don't get passed and neither does the key preceeding them.

Copy link
Member

Choose a reason for hiding this comment

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

You are right! I just had such a command in my mind /etc/icinga2/scripts/mail-service-notification.sh' '-4' '127.0.0.1' '-6' '::1' '-X' '' '-b' '' '-c' '' '-e' 'hallo' '-l' 'master1' '-n' 'master1' '-o', but that doesn't seem to be the case with check commands..

Copy link
Member

Choose a reason for hiding this comment

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

It is actually the same with check commands as well if you explicitly set them to an empty string:

...
vars.snmp_multiplier = ""

results to this: /icinga2/prefix/etc/icinga2/check_snmp' '-M' '' where set_if would've omitted it.

@@ -1896,6 +1900,10 @@ object CheckCommand "snmpv3" {
value = "$snmpv3_miblist$"
description = "List of SNMP MIBs for translating OIDs between numeric and textual representation"
}
"-M" = {
value = "$snmpv3_multiplier$"
Copy link
Member

Choose a reason for hiding this comment

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

Same here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/itl Template Library CheckCommands cla/signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update ITL for check_snmp
4 participants