$CENTREONPLUGINS$/centreon_generic_snmp.pl --plugin=apps::protocols::snmp::plugin --mode=string-value --hostname=$HOSTADDRESS$ --snmp-community='$_HOSTSNMPCOMMUNITY$' --snmp-version=$_HOSTSNMPVERSION$ $_HOSTSNMPEXTRAOPTIONS$ --oid='$_SERVICEOID$' --map-values='$_HOSTATTENDU$=>$_HOSTATTENDU$' --map-value-other='Critical' --critical-regexp='Critical' --format-ok='%{details_ok}' --format-critical='%{details_ok} non ok : $_HOSTATTENDU$ attendu' --snmp-autoreduce
if it’s ok --format-ok='%{details_ok}' returne the good value to oid check
but if it’s critical -format-critical='%{details_ok} non ok’ %{details_ok} is empty
they are other way to do this ?
thk
Hello
If i refer to the code of the plugin, for each status you need to change the syntax
- If ok, you used the correct syntax => %{details_ok}
- If warning, use %{details_warning}
- If critical, %{details_critical}
- If unknown, %{details_unknown}
The details will be placed in one of these variables according to the service status
So you parameters should be --format-critical='%{details_critical}
Hope it helps
hello if i use %{details_critical} : is not the same value of %{details_ok}
i want the result return by the snmp extend check.
my check if a script who return number : for instance 5
if ok map value 5 %{details_ok} = 5
i want use print in critical : number is : 5 no good
thk for your help
I don’t understand what you are trying to obtain.
Can you explain what values the OID is returning and what output message you want to get out of it ?
I want this :
-
Successful Check (OK): If the SNMP check returns the expected version number (e.g., 10.5), the output message should indicate that the check is OK, along with the current version number.
Output message:
OK: Current version 10.5
-
Failed Check (Critical): If the SNMP check returns a version number different from the expected one (e.g., 10.4 instead of 10.5), the output message should indicate that the check is critical, along with both the current and expected version numbers.
Output message:
Critical: Current version 10.4, Expected version 10.5
But I am unable to retrieve the version, for example 10.4, returned by the script in the output of the critical message.
This way, the output message clearly indicates whether the check is successful or not, along with the necessary version information for further analysis.
Can you try you command without the mapping, and with this arguments?
./centreon_generic_snmp.pl --plugin=apps::protocols::snmp::plugin --mode=string-value --hostname=$HOSTADDRESS$ --snmp-community='$_HOSTSNMPCOMMUNITY$' --snmp-version=$_HOSTSNMPVERSION$ $_HOSTSNMPEXTRAOPTIONS$ --oid='$_SERVICEOID$' --format-ok='Current version %{details_ok}' --format-critical='Current version %{details_critical}, Expected version VALEURATTENDU' --critical-regexp='(?!VALEURATTENDU)'
The argument critical-regexp will turn the status to Critical if the regex expression match
In your case, i put a negative match, so if the value returned doesn’t match your pattern, the status will be critical
yep it’s work fine thank you.
hmm isn't really good because when the version is okay "VALEURATTENDU" is the correct version, it still shows as critical because it's the critical regex.
Status: CRITICAL: Current version 10.0.14, Expected version : 10.0.14
:(
Try to escape the dots in the regex , like this
--critical-regexp='(?!10\.0\.14)'
i can’t it’s variable :
--critical-regexp='(?!$_HOSTVERSIONATTENDU$)'
Okay try with this syntax
--critical-regexp='^(?!10.0.14$)'
#Or in the command
--critical-regexp='^(?!$_HOSTVERSIONATTENDU$$)'
well done. it’s ok
thank you.
Reply
Login to the community
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.