Skip to main content
Needs Votes

Generic SNMP plugin with multi mode : allow outputs from different states

Related products:Infra Monitoring - Connectors
  • June 18, 2024
  • 2 replies
  • 109 views

Hello,

I am trying to use as much I can the centreon plugins feature instead of creating new ones.
I would like to use multi modes to get an output with a string-value and a numeric value.
This is working great if the two modes are getting the same status, but if one value has a higher criticity, **it overrides all the output**.

Example :

- Both mode status is OK :

```
/usr/lib/centreon/plugins/centreon_generic_snmp.pl \
--plugin=apps::protocols::snmp::plugin \
--mode=multi \
--modes-exec=string-value,numeric-value \
[...]
--option-mode='string-value,--oid=1.3.6.1.4.1...6' \
--option-mode='numeric-value,--oid=1.3.6.1.4.1...6' \
--option-mode='string-value,--format-ok=%{details_ok}' \
--option-mode='string-value,--format-details-ok="my string-value is: %{value}"' \
--option-mode='string-value,--format-warning=%{details_warning}' \
--option-mode='string-value,--format-details-warning="my string-value is: %{value}"' \
--option-mode='string-value,--format-critical=%{details_critical}' \
--option-mode='string-value,--format-details-critical="my string-value is: %{value}"' \
--option-mode='string-value,--format-unknown=%{details_unknown}' \
--option-mode='string-value,--format-details-unknown="my string-value is: %{value}"' \
--option-mode='numeric-value,--perfdata-name=myCounter' \
--option-mode='numeric-value,--format="my numerical-value is: %s"' \
--option-mode='numeric-value,--perfdata-min=0' \

OK: "my string-value is: abcdefg" - "my numerical-value is: 1234" | 'myCounter'=1234;;;0;
```

- Both mode status is WARNING :

```
/usr/lib/centreon/plugins/centreon_generic_snmp.pl \
--plugin=apps::protocols::snmp::plugin \
--mode=multi \
--modes-exec=string-value,numeric-value \
[...]
--option-mode='string-value,--oid=1.3.6.1.4.1...6' \
--option-mode='numeric-value,--oid=1.3.6.1.4.1...6' \
--option-mode='string-value,--format-ok=%{details_ok}' \
--option-mode='string-value,--format-details-ok="my string-value is: %{value}"' \
--option-mode='string-value,--format-warning=%{details_warning}' \
--option-mode='string-value,--format-details-warning="my string-value is: %{value}"' \
--option-mode='string-value,--format-critical=%{details_critical}' \
--option-mode='string-value,--format-details-critical="my string-value is: %{value}"' \
--option-mode='string-value,--format-unknown=%{details_unknown}' \
--option-mode='string-value,--format-details-unknown="my string-value is: %{value}"' \
--option-mode='string-value,--warning-regexp=.*' \
--option-mode='numeric-value,--perfdata-name=myCounter' \
--option-mode='numeric-value,--format="my numerical-value is: %s"' \
--option-mode='numeric-value,--perfdata-min=0' \
--option-mode='numeric-value,--warning=~:1'

WARNING: "my string-value is: abcdefg" - "my numerical-value is: 1234" | 'myCounter'=1234;~:1;;0;
```


- Only string-value status is WARNING, numerical-value status is OK :

```
/usr/lib/centreon/plugins/centreon_generic_snmp.pl \
--plugin=apps::protocols::snmp::plugin \
--mode=multi \
--modes-exec=string-value,numeric-value \
[...]
--option-mode='string-value,--oid=1.3.6.1.4.1...6' \
--option-mode='numeric-value,--oid=1.3.6.1.4.1...6' \
--option-mode='string-value,--format-ok=%{details_ok}' \
--option-mode='string-value,--format-details-ok="my string-value is: %{value}"' \
--option-mode='string-value,--format-warning=%{details_warning}' \
--option-mode='string-value,--format-details-warning="my string-value is: %{value}"' \
--option-mode='string-value,--format-critical=%{details_critical}' \
--option-mode='string-value,--format-details-critical="my string-value is: %{value}"' \
--option-mode='string-value,--format-unknown=%{details_unknown}' \
--option-mode='string-value,--format-details-unknown="my string-value is: %{value}"' \
--option-mode='string-value,--warning-regexp=.*' \
--option-mode='numeric-value,--perfdata-name=myCounter' \
--option-mode='numeric-value,--format="my numerical-value is: %s"' \
--option-mode='numeric-value,--perfdata-min=0'


WARNING: "my string-value is: abcdefg" | 'myCounter'=1234;;;0;
```

- Only numerical-value status is WARNING, string-value status is OK :

```
/usr/lib/centreon/plugins/centreon_generic_snmp.pl \
--plugin=apps::protocols::snmp::plugin \
--mode=multi \
--modes-exec=string-value,numeric-value \
[...]
--option-mode='string-value,--oid=1.3.6.1.4.1...6' \
--option-mode='numeric-value,--oid=1.3.6.1.4.1...6' \
--option-mode='string-value,--format-ok=%{details_ok}' \
--option-mode='string-value,--format-details-ok="my string-value is: %{value}"' \
--option-mode='string-value,--format-warning=%{details_warning}' \
--option-mode='string-value,--format-details-warning="my string-value is: %{value}"' \
--option-mode='string-value,--format-critical=%{details_critical}' \
--option-mode='string-value,--format-details-critical="my string-value is: %{value}"' \
--option-mode='string-value,--format-unknown=%{details_unknown}' \
--option-mode='string-value,--format-details-unknown="my string-value is: %{value}"' \
--option-mode='string-value,--warning-regexp=.*' \
--option-mode='numeric-value,--perfdata-name=myCounter' \
--option-mode='numeric-value,--format="my numerical-value is: %s"' \
--option-mode='numeric-value,--perfdata-min=0' \
--option-mode='numeric-value,--warning=1'

WARNING: "my numerical-value is: 1234" | 'myCounter'=1234;~:1;;0;
```

What I would like is to keep all the outputs even if the other mode status is different, but of course return only the status with the higher criticity.

Could you add this enhancement please?

Cheers
Luth1ng

 

2 replies

ltirand
Centreonian
Forum|alt.badge.img+10
  • Centreonian
  • July 16, 2024

Hello :)

Thank you for your feedback and your proposal. This idea will be submitted to community votes to allow us to measure its popularity, which may impact its priority in our delivery.

Best regards.


Forum|alt.badge.img+5
  • Centreonian
  • July 16, 2024
NewNeeds Votes