Ad Widget

Collapse

Configuring Webhook

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • salemmahara
    Junior Member
    • Jul 2022
    • 2

    #1

    Configuring Webhook

    Hello everyone,
    I check all examples and manuals, but I have still problem with webhook.
    We have a really simple API service which allows us sending message to out admins in case of failure.
    The only thing we are supposed to is calling that with some parameters including credential and message.
    I tried tooooo many approaches to use it in zabbix but there is always the same error: SyntaxError: unterminated statement (line 1)

    Here is the script:

    String a = https://test.com/url/send?usr=test&pass=test&number=9999999&msg=test";
    String answer= "";
    try {
    InputStream in = new URL(a).openConnection().getInputStream();
    BufferedReader reader = new BufferedReader(new InputStreamReader(in));
    String line;
    while ((line = reader.readLine()) != null) {
    answer = response + line + "\n";
    }
    } catch (Throwable e) {
    answer = "Error: " + e.getMessage();
    }

    I tried the code by removing parameters from the url and putting them in parameter boxes above the script, but the result was the same.
  • Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1782

    #2
    I have no idea about your script otherwise but the error is "unterminated statement on line 1" and your line 1 only has one quote on it, so your string a seems to miss the opening quote.

    Markku

    Comment

    Working...