Checking if process runtime with AWS Cloudwatch

497 views Asked by At

I am writing some application (in Go) that will run continuously on a server and perform various tasks. Some are web services and others are internal services with Thrift interface. There will also be a few batch processes.

I would like to monitor that these processes are running and figure I can use AWS Cloudwatch to do this.

Would a simple implementation be as follows?:

Spin up a separate worker thread where I basically publish a custom cloudwatch metric every 5 minutes that says "I am still running". I then create alarms that trigger if messages stop being received every 5 minutes?

What are best practices for this type of thing? Please note I am not really asking about monitoring the availability of webservices, which is more trivial.

Thanks

1

There are 1 answers

0
helloV On

One suggestion to run a cron job that executes a script every 5 minutes. In that script, you can put all your logic.

To start with I'll publish one metric (with dimension Count) that sends the number of processes/services that are running on the instance. If the threshold goes below the desired number of processes/services, you can configure Cloudwatch to send an alarm. Once you have this basic setup working, you can expand this to publish more detailed (multiple) metrics.