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

Mosquitto plugin string-value Regex not works #5081

Open
mdepedrof opened this issue Jun 24, 2024 · 1 comment
Open

Mosquitto plugin string-value Regex not works #5081

mdepedrof opened this issue Jun 24, 2024 · 1 comment

Comments

@mdepedrof
Copy link

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
image

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.
image

However, I always get the same result: OK: value: false

@lucie-dubrunfaut
Copy link
Contributor

Hello :)

Thank you for this feedback, we will inspect the problem and get back to you when we know more about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants