While MuleSoft does provide functional monitoring for MuleSoft applications, if you’re already using the Elastic Stack, it is useful to have all application monitoring in one place. Elastic Uptime allows you to monitor applications via a small agent called Heartbeat. Heartbeat uses HTTP, TCP, and ICMP monitors to determine if an application is available. This can be used to monitor your MuleSoft APIs and other APIs and services to provide a consolidated view of up-time. It also provides a historical view of uptime so you can see your applications' historical uptime.
Setting Up MuleSoft Monitors
After configuring Heartbeat to output to your Elastic cluster, you will need to configure monitors for all of the endpoints that you need to monitor. Since your MuleSoft application should be using some authentication, your monitors will also need to authenticate to determine if your application is available.
Heartbeat allows you to send headers and payloads to your application, so it is as easy as configuring client_id and client_secret headers in the request when using the Client ID authentication policy.
- type: http
schedule: '@every 30s'
name: My Test API - Prod
If you prefer not to have the client_id and client_secret in the Heartbeat configuration file, you can use the Heartbeat secrets keystore to secure those values.
Which endpoint should you monitor?
We suggest adding a health check endpoint to MuleSoft applications that can be used to determine the health status of the applications. This endpoint should check the application’s ability to connect to dependent systems. Calling your application’s health check endpoint from Heartbeat will then indicate if the application is up and that it should be able to respond to requests.
If you don’t have a health check endpoint, be sure to execute something that will indicate the application is actually available. It must be something that you can repeatedly execute without changing production data.
Elastic Uptime provides a default dashboard that shows the status of all of your monitored applications. It also shows the uptime history of your applications over the time period you have specified. This screenshot shows the status over the last seven days.
You can drill into one of your applications to see more details, including the overall availability of that application over the period you have selected.
Once you have the monitoring set up in Elastic, you can create a Monitor status alert that will send an alert to monitor is down, or an availability threshold is breached. Several actions can be triggered when an alert is triggered, from sending an email to sending a Slack message to invoking a webhook.
What should you do next?
Check out our Monitoring MuleSoft Runtimes article for additional monitoring suggestions.