Hi,
I'm a new Zabbix user, and I wrote a webbook to write a notification to one of my REST endpoints.
Currently I'm running Zabbix 6.2.4 on Ubuntu 22.04 in a Virtual Box Image, DB MySQL. I followed the Ubuntu install instructions on the Zabbix page.
Strangely the webhook works. The receiving system gets the POST message, processes it and responds, but Zabbix reports an error.
The error I receive is:
The log has the following:
Dr Google has proven no help.
I have simplified my code below, but it still reproduces the error.
Any suggestions on what to look into next?
I'm a new Zabbix user, and I wrote a webbook to write a notification to one of my REST endpoints.
Currently I'm running Zabbix 6.2.4 on Ubuntu 22.04 in a Virtual Box Image, DB MySQL. I followed the Ubuntu install instructions on the Zabbix page.
Strangely the webhook works. The receiving system gets the POST message, processes it and responds, but Zabbix reports an error.
The error I receive is:
Failed with error: TypeError: undefined not callable (property 'Status' of [object Object])
00:00:00.000 [Debug] [ My webhook ] Request: [object Object]
00:00:00.000 [Debug] [ My webhook ] Request: {}
00:00:01.878 [Warning] [ My webhook ] Sending failed. Error: TypeError: undefined not callable (property 'Status' of [object Object])
00:00:00.000 [Debug] [ My webhook ] Request: {}
00:00:01.878 [Warning] [ My webhook ] Sending failed. Error: TypeError: undefined not callable (property 'Status' of [object Object])
I have simplified my code below, but it still reproduces the error.
Any suggestions on what to look into next?
Code:
try {
var request = new HttpRequest();
var response;
Zabbix.log(4, '[ My webhook ] Request: ' + request);
Zabbix.log(4, '[ My webhook ] Request: ' + JSON.stringify(request));
response = request.post('https://myharcdoded.url/endpoint/', 'My Hard Coded Data');
Zabbix.log(4, '[ My webhook ] Responded with code: ' + request.Status() + '. Response: ' + response);
try {
response = JSON.parse(response);
} catch (error) {
if (request.getStatus() < 200 || request.getStatus() >= 300) {
throw 'Request failed with status code ' + request.getStatus();
} else {
throw 'Request success, but response parsing failed.';
}
}
if (request.getStatus() !== 200 || !response.ok || response.ok === 'false') {
throw response.error;
}
return 'OK';
} catch (error) {
Zabbix.log(3, '[ My webhook ] Sending failed. Error: ' + error);
throw 'Failed with error: ' + error;
}
Comment