Alert Via Email On Free Heap Percentile Threshold

Posted by Hari Prasad on Nov 5, 2018 9:00:00 AM

This custom function obtains free heap memory statistics, particularly useful if you wish to be notified when the server may be experiencing performance issues. In order to get the free heap percentage you will need to use the custom function GetFreeHeapInPercentile. Refer the downloads section to use this function.


Source code and build instructions

See How to Create Custom Trigger Functions for details on installation.

How to alert via email on free heap percentile threshold

Let me now show you how to implement that.

Before creating a custom trigger you need to have build installed in the server.


1. Create a trigger to get the statistics of available heap

Login into admin console of JSCAPE MFT Server > Triggers and Click Add to create a Trigger

Give the trigger a Name and then select the  Current Time event type from the drop-down list. 



Click Next to Step 2 where a condition can be set to execute the trigger.

Consider an example that the server is too slow in responding, one of the reason for the slowness is much heap usage and the heap may not be available to allocate objects. In order to identify on what time the server is slow and when the heap usage is too high, the below mentioned expression can be used where the server checks for the free heap in percentile for ever 30 minutes in a day.


(Minute=0 OR Minute=30) AND (GetFreeHeapInPercentile() < 20)


The above expression indicates to send an email when free heap is reduced less than 20 percentage.



Once the condition is set Click Next to proceed

On Step 3 an action has to be added, in order to add an action click Add button and select the action "Send Email" from drop down list and Click OK




On OK to add and input the required parameters.



Enter all necessary parameters for sending that email notification, including the host name of your SMTP server, the port number, connection type, etc. In the Body text box, enter the message you want to relay. In the Body text box , apart from the custom message we can add the function GetFreeHeapInPercentile() to print the value of the free heap in percentage so the recipients will aware of the status of the heap.

Click Ok to save the settings.

That's it. Now you know how to use to send email on more heap usage.


Download JSCAPE MFT Server

Topics: JSCAPE MFT Server, Functions, Heap Analysis