Source
xxxxxxxxxx
throw 'Request failed with status code ' + request.getStatus() + '. Check debug log for more information.';
zabbix_export
version'5.4'
date'2020-11-06T13:56:32Z'
media_types
-
name iTop
type WEBHOOK
parameters
0
name alert_message
value'{ALERT.MESSAGE}'
1
name alert_subject
value'{ALERT.SUBJECT}'
2
name event_recovery_value
value'{EVENT.RECOVERY.VALUE}'
3
name event_source
value'{EVENT.SOURCE}'
4
name event_update_status
value'{EVENT.UPDATE.STATUS}'
5
name event_value
value'{EVENT.VALUE}'
6
name itop_api_version
value'1.3'
7
name itop_class
value UserRequest
14
name itop_comment
value'Created by Zabbix action {ACTION.NAME}'
8
name itop_id
value'{EVENT.TAGS.__zbx_itop_id}'
9
name itop_log
value private_log
10
name itop_organization_id
value'<PLACE ORGANIZATION ID>'
11
name itop_password
value'<PLACE PASSWORD OR TOKEN>'
12
name itop_url
value'<PLACE YOUR ITOP URL>'
13
name itop_user
value'<PLACE LOGIN>'
script
var Itop = {
params: {},
setParams: function (params) {
if (typeof params !== 'object') {
return;
}
if (params.log !== 'private_log' && params.log !== 'public_log') {
throw 'Incorrect "itop_log" parameter given: ' + params.log + '\nMust be "private_log" or "public_log".';
}
Itop.params = params;
if (typeof Itop.params.url === 'string') {
if (!Itop.params.url.endsWith('/')) {
Itop.params.url += '/';
}
Itop.params.url += 'webservices/rest.php?version=' + encodeURIComponent(Itop.params.api_version);
}
},
setProxy: function (HTTPProxy) {
Itop.HTTPProxy = HTTPProxy;
},
setCreatePayload: function () {
json_data.operation = 'core/create';
json_data.fields.org_id = Itop.params.organization_id;
json_data.fields.title = params.alert_subject;
json_data.fields.description = params.alert_message.replace('<', '<')
.replace('>', '>')
.replace(/(?:\r\n|\r|\n)/g, '<br>');
},
setUpdatePayload: function () {
json_data.operation = 'core/update';