Being working on a PoC with my buddies at ControlUp, we have been asked for an integration with ServiceNow to automatically create incidents for example.
As there is not a real “integration”, I started to look at both product documentations to find a way to answer this question.
As a member of the ControlUp Expert program, I do have access to an unlimited version of the product, so it was easy for me to test some customizations. The good thing is that ServiceNow proposes a fully automated development platform for free here https://developer.servicenow.com/
This was all I needed to provide a good answer to our potential customer!
Once registered for the development platform, you can logon to your own instance and you will land in the default page:
There is a dedicated menu entry for the “Email” customization.
In order to automate, we will send emails to ServiceNow, so let’s configure “Inbound Email Actions”, as you can see in the next capture, there is already some Actions already defined by ServiceNow:
We want to customize the “Create Incident”. To accomplish this, we add the following line in the action script:
if (email.body.configitem != undefined) {
current.cmdb_ci.setDisplayValue(email.body.configitem);}
This will be used to bind the incident to a “valid” Configuration Item in the CMDB.
After doing this, you need to enable the incoming email on your ServiceNow instance. This is done in the “Email Properties” menu:
By default, emails are disabled, so tick the “Yes” box and click Save:
We can now directly test the incident creation. In order to do this, you can just create an email like this:
After the email being processed, you should be able to see a new incident in your ServiceNow instance:
It’s now time to setup the ControlUp console!
In the console choose the Settings/Triggers menu:
Click Add Trigger and select the Computer down trigger
For the testing purpose select “Any of the above”:
The next screen is there to filter the servers you want to be alerted for, so will click Next:
Again click Next to validate the alert will be for all the organization:
Click “Add” in order to add an action:
Select the user you want to send the alert to (the one with the email address of your service-now instance):
Validate and click finish:
Now, each time a computer is going down, an email will be sent to the service-now instance:
As you see the configitem field is not present in the email. If you want to use the Computer name you can modify the “Create incident” inbound email action in your service-now instance like this:
var index = email.subject.indexOf(“- Computer”);
var Computer = email.subject.substring(index,index+100);
Computer = Computer.split(‘Computer ‘);
Computer = Computer[1];
Computer = Computer.split(‘.’)[0];
current.cmdb_ci.setDisplayValue(Computer);
That’s it!