How to stop creating alerts for CI's in non-operational or un-installed status?


There is a Out of the box script include called EvtMgmtCustom_PostBind_Create, this is after we bind the CI but before we create an alert.

This script include is  not active out of the box but you can define your logic in this script include to ignore the creation of the alert based on Operational status. 

 For example, You can use this  piece of code which will ignore any CI with operational status (4,2,3). you will have to define these numbers based on the choice list and your requirements. You can add more logic around this code. If returned false, it will skip creation of alert. 


*****Sample code to ignore creating alerts if the CI is in operational status (4,2,3)******

(function postBindCreate(event, alert, origEventSysId){ 
gs.log('PostBind_Create custom script is active'); 

var ignore_statuses = ['4','2','3']; // 

var ciid = alert.cmdb_ci.toString(); 
var ciGr = new GlideRecord('cmdb_ci'); 
if (ciGr.get(ciid)){ 
var operation_status = ci.operational_status.toString(); 
if (ignore_statuses.indexOf(operation_status) != -1) 
return false; 

// In this part of the function make any changes to alert using glide record interface. E.g: 
// alert.setValue('source', 'new source'); 

// To abort alert creation return false; 
// returning a value other than boolean will result in an error 
return true; 
})(event, alert, origEventSysId); 

Applicable Versions

Jakarta, Kingston, London


Article Information

Last Updated:2019-08-02 21:09:41