Hallo,
I am writing a ruby script with https://github.com/express42/zabbixapi (2.2.0) for automated synchronisation of zabbix users and our directory service.
When trying to add media to an user, the request and the answer of the zabbix server looks ok but the media actually was not added.
Code snippet to add media
$zbxCon.users.add_medias( :userids => [$zbxCon.users.get_id(:alias => key)], :media => user_media ) user_media << {"mediatypeid" => media_attr["id"], "sendto" => value[media_attr["media_name"]], "active" => 0, "severity" => media_attr["severity"], "period" => "1-5,08:00-18:00" } [DEBUG] Send request: {"method":"user.addmedia","params":{"users":[{"userid":"200200000000012"}],"medias":[{"mediatypeid":"200200000000001","sendto":"[email protected]","active":0,"severity":48,"period":"1-5,08:00-18:00"},{"mediatypeid":"200200000000002","sendto":"[email protected]","active":0,"severity":48,"period":"1-5,08:00-18:00"}]},"auth":"2a899fsd4994fga52041a0df5sfac8","id":65214,"jsonrpc":"2.0"} [DEBUG] Timeout for request set to 60 seconds [DEBUG] Get answer: {"jsonrpc":"2.0","result":{"mediaids":["200200000000240","200200000000241"]},"id":65214}
Updating media is working correctly