How do I write a monitor for an app?

Hi,

I’ve got an app that we advertise broadly on the streamlit sharing platform:
https://share.streamlit.io/jkanner/streamlit-dataview/app.py

It works well most of the time, but it occasionally crashes - maybe once every couple of weeks. While I’d like to make the app more stable, I’m not sure how to debug this.

My question is: Is there a way to write a monitor for streamlit apps? For example, if I access the app URL with an automated GET request, is it possible to tell from the response if the app is running? I can live with the occasional crashes, but I’d love to get alerted when it needs re-started, or even better, have the app re-start automatically after a crash.

I’d appreciate any hints or tricks. Thanks for considering!

Best,
jonah

Yes, of course.
There would be quite a few different possibilities.
There are hosted health check services.
You could host a health checker yourself.
You could program a health checker yourself.
If yes, on which platform and in which programming language?

@Franky1

Thank you for the quick response!

Well - I’m open to any suggestions you have for health checker’s. I don’t have much experience with these.

I am working on a linux machine, and I don’t mind writing my own monitor. I’m most comfortable working in python, but I could use bash or some other language if needed. There are also members of my team who use nagios monitors. I could try to plug-in to that infrastructure, though I’d have to get myself up the learning curve.

In any of these scenarios, I think I’d need to know what to look for in an HTTP response to tell if the app is running (right?).

Again, thank you for your help!

So if you already have a running monitoring solution in your organisation, I would definitely use that and not reinvent the wheel. With Nagios, that’s definitely possible, but I’m not familiar with it, so you’ll have to ask your colleagues. :wink: