/**
 * Get alert metrics results for the named alert types(s) for the data from the given url
 * @param $url the url for the data to process
 * @param $alerttypes one or more alert types to get the metrics for (comma sparated list).
 * @param $timeout (optional) the length of time the metrics server should cache the data for in seconds. Default to 60
 * @param $userids (optional) one or more userid of the users to get alerts for (comma sparated list)
 * @param $root (optional) the post id of the map tree to process within the given data
 * @return false, if the call failed, else the response data from the call (will be a json string).
 */
function getAlertMetrics($url, $cipher, $alerttypes, $timeout = 60, $userids = "", $root = "")
{
    global $CFG;
    $requests = createAlertMetricRequestPostField($alerttypes, $cipher, $userids, $root);
    $results = callAnalyticsAPIWithURL('POST', $requests, $url, $timeout);
    if (!$results) {
        $message = "Metrics server unreachable for: " . $url;
        sendMailMessage("Alert Metrics down on " . $CFG->SITE_TITLE, $CFG->ERROR_ALERT_RECIPIENT, $message);
    }
    return $results;
}
/**
 * Get alert metrics results for the named alert types(s) for the data from the given url
 * @param $url the url for the data to process
 * @param $alerttypes one or more alert types to get the metrics for (comma sparated list).
 * @param $timeout (optional) the length of time the metrics server should cache the data for in seconds. Default to 60
 * @param $userids (optional) one or more userid of the users to get alerts for (comma sparated list)
 * @param $root (optional) the post id of the map tree to process within the given data
 * @return false, if the call failed, else the response data from the call (will be a json string).
 */
function getAlertMetrics($url, $alerttypes, $timeout = 60, $userids = "", $root = "")
{
    $requests = createAlertMetricRequestPostField($alerttypes, $userids, $root);
    return callAnalyticsAPIWithURL('POST', $requests, $url, $timeout);
}