Create HTTP-GET alert via python-gvm


can someone give me an example of calling create_alert() function, with method=HTTP_GET. I am in trouble with method_data parameter, how can I correctly use if to specify URL for GET request.

Firstly I tried to use a dict such this {"http_get_url": ""}, but it didn’t work.

I tried to create alert via web UI, then looked in postgres base, and checked alert_method_data table, for this alert there was something more, then just http_get_url, and i tried dict like

    "delta_type": "None",
    "http_get_url": "",
    "delta_report_id": "",
    "details_url": "$t&info_id=$o&details=1&token=guest"

but, unfortunately, it didn’t work too. After this I checked API docs and python-gvm docs, and didn’t find there an answer.

So, can someone please give me correct example how to call create_alert() function in such way.

Used python-gvm version 1.6.0, with GMP connection.

Apologize if I used wrong category, and for my english :slight_smile:

Thank you!


So I just ran into the same use-case, I solved it by first creating one manually in GSA, then using the get_alert method to see how it’s called:

This worked for me on 20.08:

resp = gmp.create_alert(
    event_data={"status": "Done"},
        "URL": "$n".format(env)

It appears it’s case sensative.


Thank you a lot, it works for me too!