Customization connector instance Zabbix with tag values ​​in additional information of the event

BrunaF
Tera Contributor

Hello,

We are customizing the JavaScript of the Zabbix connector definition in ServiceNow. This script customization is intended to return the values of the tags in the additional information of the events.

Initially, we included the line "selectTags": "extend" so that all tags of the event are returned in the REST API. After that, we added lines to search the tags from the Zabbix REST API and get the value of each tag, creating a key in the event's additional information with the tag value coming from Zabbix.

After line 359 of the "ZabbixV2_JS" script, the following lines were included:

this.eventSetProperty(sEvent,"event_integ_itom_category", this.findChild(event.tags, "tag", "Category").value);
this.eventSetProperty(sEvent,"event_integ_itom_service", this.findChild(event.tags, "tag", "Service").value);
this.eventSetProperty(sEvent,"event_integ_itom_svc_offering", this.findChild(event.tags, "tag", "Service Offering").value);
this.eventSetProperty(sEvent,"event_integ_itom_symptom", this.findChild(event.tags, "tag", "Symptom").value);

For a few hours, the connection works, returning these tag values without any issues. However, at a certain point, the connector throws an error with the following message attached.

Could anyone advise whether this error is related to a configuration issue in Zabbix or if there might be an adjustment needed in the ServiceNow JavaScript itself that is causing it to read an unreadable value?

Thansks,

Bruna

5 REPLIES 5

Adrian V_
Tera Expert

Hello @BrunaF ,

 

Did you finally get a solution on this? We are also struggling with obtaining tags from Zabbix.

 

Regards,

Adrian

Finally we could get all the tags from Zabbix using a for loop and iterating on function porposed by the creator of the post.

Bj_rn1
Tera Contributor

Hi @Adrian V_,

 

I would be delighted if you could share with us what adjustments you have made.

 

Regards,

Björn

Hello,

 

You can try to run the loop on the command proposed by the host, replacing the name of the tag by event.tags[].value to get its value.

 

Code will result in the following (or you can use something equivalent).

 

for (var j = 0; j < event.tags.length; j++){
	this.eventSetProperty(sEvent,event.tags[j].tag, this.findChild(event.tags,"tag",event.tags[j].tag).value);
}

 

Regards,

Adrian