'How to use Zabbix's CurlHttpRequest() in JavaScript?
I am learning Zabbix. I would like to use CurlHttpRequest() and all these functions: 
I can't find the documentation (what's going on inside). I would like to run a JavaScript script on my computer. How can I do that? I have a problem that even this simple line of code is undefined:
var req = new CurlHttpRequest();
Solution 1:[1]
While you are configuring javascript in zabbix media types, you have an option to test the script.
var response,
json_payload,
params = JSON.parse(value),
wurl = params.URL,
msg = params.Message,
request = new CurlHttpRequest();
json_payload = '{"attachments": [{"text": "' + msg + '"}] }';
Zabbix.Log(4, '[ cURL-log ] Sending request: ');
request.AddHeader('Content-Type: application/json');
response = request.Post(wurl, json_payload);
Zabbix.Log(4, '[ cURL-log ] Received response with status code ' + request.Status() + '\n' + response);
you cab use Zabbix.Log to generate logs like console.log in javascript.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
