centreon-plugins
centreon-plugins copied to clipboard
Mosquitto plugin string-value Regex not works
Quick description
It seems that the plugin "centreon_eclipse_mosquitto_mqtt.pl" does not work correctly when evaluating critical/warning regular expressions.
Bug report
I have a MQTT broker configured and a topic with state that can be true or false
I am running the script with these options:
/usr/lib/centreon/plugins//centreon_eclipse_mosquitto_mqtt.pl \
--plugin=apps::eclipse::mosquitto::mqtt::plugin \
--mode=string-value \
--hostname='x.x.x.x' \
--mqtt-port='1883' \
--mqtt-ca-certificate='' \
--mqtt-ssl-certificate='' \
--mqtt-ssl-key='' \
--mqtt-username='user' \
--mqtt-password='pass' \
--mqtt-ssl='0' \
--mqtt-allow-insecure \
--topic='nuki/xxxxx/connected' \
--format-custom='' \
--warning-regexp='' \
--critical-regexp='^(?!(true)).*' \
--unknown-regexp='' \
--format-ok='value: %{value}' \
--format-warning='value: %{value}' \
--format-critical='value: %{value}' \
--format-unknown='value: %{value}' \
--debug
I always get the same result OK: value: false
How to reproduce
- Environment: debian 12.5
- Version of the plugin: centreon_eclipse_mosquitto_mqtt.pl Global Version: 20240613 (1af93b2)
- Information about the monitored resource: mosquitto version 2.0.18
- Command line: provided above
Expected result
I Think the expected result would be ´´´Critical: value: false``` and the check must be critical state
Actual result
I always recieve OK: value: false
and the check always show the OK status
Additional info
I try with diferent regex as:
- false
- (false)
- ^false$
- ^(?!true$).*
Also, with the last RegExp, I have tested with an online validator and the result is correct. Match when the value is different from "true" so when you get "false" it should detect it as CRITICAL.
However, I always get the same result: OK: value: false