Customization connector instance Zabbix with tag values in additional information of the event
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 11:38 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2024 03:10 AM
Hello @BrunaF ,
Did you finally get a solution on this? We are also struggling with obtaining tags from Zabbix.
Regards,
Adrian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2024 08:12 AM - edited 11-27-2024 01:24 AM
Finally we could get all the tags from Zabbix using a for loop and iterating on function porposed by the creator of the post.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 07:58 AM
Hi @Adrian V_,
I would be delighted if you could share with us what adjustments you have made.
Regards,
Björn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2025 04:33 AM
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