Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Thinking about health checks for a MQTT client running in a container

Obviously, it's going to depend a little bit on how the application behaves and other general circumstances / expectations, but one idea that comes to my mind is to touch a file when messages are pushed or received (better yet on built-in ping / ping responses), and check how fresh the file is.

On Fri, Oct 20, 2023 at 6:44 AM Steve Prior via mosquitto-dev <mosquitto-dev@xxxxxxxxxxx> wrote:
I have a bunch of services running in containers which are "pure" MQTT
clients - the service subscribes to MQTT topics and when it receives a
message it performs some action.  The service doesn't have an http
service or a tcp port it's listening on - all its connections are outbound.

I'm trying to think about what would make sense as a health check for
such an application.   I'm not very excited about adding a http listener
just as a health check endpoint and nothing else. Sending a MQTT message
to a special health check topic that the service replies to may work but
I'm not sure there aren't problems there too.

So I'm curious what (if anything) others are doing.  Another thought I
had is could it be possible to query the mosquitto server about the
health of the client service's connection to it - the health check is
does the mosquitto server have a current ping for the MQTT client?  It's
just a little weird to ask a third party (the mosquitto server) about
the health of one of it's clients, but maybe not wrong.  I'm sure that
it gets a little tricky to have that kind of health check know the
client id which would be needed to query in the mosquitto server unless
the mqtt client service uses a hardcoded client id (which wouldn't be
desireable).

Thoughts?

Steve

_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/mosquitto-dev

Back to the top