import socket
import requests
import json


def log_event(url, event_type, event_status, event, tags):
    """Log custom event."""

    params = {
        'type': event_type,
        'status': event_status,
        'event': event,
        'tags': tags,
        'hostname': socket.getfqdn(),
    }
    headers = { 'Content-type': 'application/json' }
    r = requests.post("%s/event/add" % url, data=json.dumps(params), 
                      verify=False, headers=headers)
    r.raise_for_status()
    resp = r.json()
    return resp