Hi,
I'm trying to integrate our IONA tool with Zabbix using webhook media type but getting 401 error, we have checked token is working able to curl endpoint through the server.
Below is the script I'm using for webhook integration.
\\\\\\\ {
Zabbix.log(4, '[ Zabbix Webhook ] Started with params: ' + value);
var result = {
'tags': {
'endpoint': 'zabbix'
}
};
var params = JSON.parse(value);
var req = new HttpRequest();
var payload = {
receiver: params.receiver,
status: params.status,
};
var resp;
req.addHeader('Content-Type', 'application/json');
req.addHeader('Authorization', 'Basic ##################"');
resp = req.post('https://xxxxx-yyyy-privatecloud.com/zabbix/api/alerts/',
JSON.stringify(payload)
);
if (req.getStatus() != 200) {
throw 'Response code: ' + req.getStatus();
}
resp = JSON.parse(resp);
return JSON.stringify(result);
} catch (error) {
Zabbix.log(4, '[ Zabbix Webhook ] Request failed with payload: ' + JSON.stringify(payload));
Zabbix.log(3, '[ Zabbix Webhook ] Request failed with error: ' + error);
throw 'Failed with error: ' + error;
} ///////
I'm trying to integrate our IONA tool with Zabbix using webhook media type but getting 401 error, we have checked token is working able to curl endpoint through the server.
Below is the script I'm using for webhook integration.
\\\\\\\ {
Zabbix.log(4, '[ Zabbix Webhook ] Started with params: ' + value);
var result = {
'tags': {
'endpoint': 'zabbix'
}
};
var params = JSON.parse(value);
var req = new HttpRequest();
var payload = {
receiver: params.receiver,
status: params.status,
};
var resp;
req.addHeader('Content-Type', 'application/json');
req.addHeader('Authorization', 'Basic ##################"');
resp = req.post('https://xxxxx-yyyy-privatecloud.com/zabbix/api/alerts/',
JSON.stringify(payload)
);
if (req.getStatus() != 200) {
throw 'Response code: ' + req.getStatus();
}
resp = JSON.parse(resp);
return JSON.stringify(result);
} catch (error) {
Zabbix.log(4, '[ Zabbix Webhook ] Request failed with payload: ' + JSON.stringify(payload));
Zabbix.log(3, '[ Zabbix Webhook ] Request failed with error: ' + error);
throw 'Failed with error: ' + error;
} ///////