Gateway watchdog/alarm

Hi, Im new to Chirpstack and is looking for a way to get an automatic alarm or info if my connection to the gateway is lost?
Any ideas how to do this?

Hi, Welcome to the forum!

As far as I know, there is no way of doing this out of the box in ChirpStack.

However you can achieve this easily by either:

  • Monitor the MQTT topic $SYS/broker/connection/<gateway client id>/state, which tells you if the gateway has established an mqtt connection to your broker
  • Monitor the MQTT topic <region>/gateway/<gateway eui>/state/conn. Note that the content published on this topic is serialized using protobuf so you’ll have to deserialize it to get the data you want.

Then program a tool that sends alert when the gateway status changes.

Hope this helps,

Nicolas

2 Likes

Thanks for the welcome and the MQTT tips @nj-tensio !!
Ill try this for sure.

Hello again, I can find:

gateway/<id>/state/conn

and

eu868/gateway/<id>/event/up

that makes sense from MQTT explorer.
What about those?

Mosquitto_sub to them to get the connection / uplink data respectively.

1 Like

Hi Tomas,

eu868/gateway/<id>/event/up would be of no use in your use case since this message is sent each time the gateway receive an uplink from a device, thus giving no information about when the gateway is actually offline.

gateway/<id>/state/conn is the one you are looking for. However, be aware that this message is usually preceded by the region the gateway is operating in (i.e: eu868/gateway/<id>/state/conn). I assume this is probably a copy/paste issue from your side. In order to use this message, you will have to deserialize it using protobuf. Have a look here for the message definition.

If you are not familiar with protobuf, $SYS/broker/connection/<gateway client id>/state would be easier to work with in your case since it directly contain the gateway mqtt connection state. This however offers no guarantee that the gateway is effectively talking with ChirpStack, only that a MQTT connection is established with your broker. Make sure you are subscribed to this topic in MQTT explorer, otherwise you won’t see any messages published on this topic.

Hope this helps,

Nicolas

2 Likes

On $SYS I can only see this!?
Screenshot_20241126_213600

Sorry about that, I just realized that the topic $SYS/broker/connection/<gateway client id>/state only applies to broker bridges, not normal client, which is not your case. So this is normal that you don’t see it.

You will have to solely rely on <region>/gateway/<gateway eui>/state/conn topic then.

1 Like

Well it doesn’t match here, this is what I have:
Screenshot_20241128_212616

I have tested gateway//state/conn but I’m not sure how it works yet?
The object has “retain: false” or “true” but it doesn’t make sense when Im testing :upside_down_face:

I think Iv got it running now with gateway/<gateway eui>/state/conn and the parameter retain.
Thanks for your help!