static char *races_list[] = /* {{{ */
{
NULL,
- "Warrior", /* 1 */
- "Paladin", /* 2 */
- "Hunter", /* 3 */
- "Rogue", /* 4 */
- "Priest", /* 5 */
- NULL,
- "Shaman", /* 7 */
- "Mage", /* 8 */
- "Warlock", /* 9 */
- NULL,
- "Druid" /* 11 */
-}; /* }}} */
-#define RACES_LIST_LENGTH STATIC_ARRAY_SIZE (races_list)
-
-static char *classes_list[] = /* {{{ */
-{
- NULL,
"Human", /* 1 */
"Orc", /* 2 */
"Dwarf", /* 3 */
"Bloodelf", /* 10 */
"Draenei" /* 11 */
}; /* }}} */
+#define RACES_LIST_LENGTH STATIC_ARRAY_SIZE (races_list)
+
+static char *classes_list[] = /* {{{ */
+{
+ NULL,
+ "Warrior", /* 1 */
+ "Paladin", /* 2 */
+ "Hunter", /* 3 */
+ "Rogue", /* 4 */
+ "Priest", /* 5 */
+ NULL,
+ "Shaman", /* 7 */
+ "Mage", /* 8 */
+ "Warlock", /* 9 */
+ NULL,
+ "Druid" /* 11 */
+}; /* }}} */
#define CLASSES_LIST_LENGTH STATIC_ARRAY_SIZE (classes_list)
static char *genders_list[] = /* {{{ */
typedef struct player_info_s player_info_t;
#define PLAYER_INFO_STATIC_INIT { -1, -1, -1, -1, -1 }
-static char *url = NULL;
-static char *user = NULL;
-static char *pass = NULL;
-static char *cacert = NULL;
+static char *url = NULL;
+static char *user = NULL;
+static char *pass = NULL;
+static char *verify_peer = NULL;
+static char *verify_host = NULL;
+static char *cacert = NULL;
static CURL *curl = NULL;
"URL",
"User",
"Password",
+ "VerifyPeer",
+ "VerifyHost",
"CACert"
};
static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "ascent");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "ascent", sizeof (vl.plugin));
if (plugin_instance != NULL)
sstrncpy (vl.plugin_instance, plugin_instance,
sizeof (vl.plugin_instance));
+ sstrncpy (vl.type, type, sizeof (vl.type));
+
if (type_instance != NULL)
sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
- plugin_dispatch_values (type, &vl);
+ plugin_dispatch_values (&vl);
return (0);
} /* }}} int ascent_submit_gauge */
value = ((double) ps->level_sum) / ((double) ps->level_num);
ascent_submit_gauge (NULL, "gauge", "avg-level", value);
+ /* Latency is in ms, but we store seconds. */
if (ps->latency_num <= 0)
value = NAN;
else
- value = ((double) ps->latency_sum) / ((double) ps->latency_num);
- ascent_submit_gauge (NULL, "gauge", "avg-latency", value);
+ value = ((double) ps->latency_sum) / (1000.0 * ((double) ps->latency_num));
+ ascent_submit_gauge (NULL, "latency", "average", value);
return (0);
} /* }}} int ascent_submit_players */
ascent_xml_submit_gauge (doc, child, NULL, "players", "horde");
else if (xmlStrcmp ((const xmlChar *) "qplayers", child->name) == 0)
ascent_xml_submit_gauge (doc, child, NULL, "players", "queued");
+ else if ((xmlStrcmp ((const xmlChar *) "acceptedconns", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "avglat", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "cdbquerysize", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "cpu", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "fthreads", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "gmcount", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "lastupdate", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "ontime", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "oplayers", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "peakcount", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "platform", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "ram", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "threads", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "uptime", child->name) == 0)
+ || (xmlStrcmp ((const xmlChar *) "wdbquerysize", child->name) == 0))
+ /* ignore */;
else
{
WARNING ("ascent plugin: ascent_xml_status: Unknown tag: %s", child->name);
return (config_set (&user, value));
else if (strcasecmp (key, "Password") == 0)
return (config_set (&pass, value));
+ else if (strcasecmp (key, "VerifyPeer") == 0)
+ return (config_set (&verify_peer, value));
+ else if (strcasecmp (key, "VerifyHost") == 0)
+ return (config_set (&verify_host, value));
else if (strcasecmp (key, "CACert") == 0)
return (config_set (&cacert, value));
else
{
int status;
- status = snprintf (credentials, sizeof (credentials), "%s:%s",
+ status = ssnprintf (credentials, sizeof (credentials), "%s:%s",
user, (pass == NULL) ? "" : pass);
if (status >= sizeof (credentials))
{
"credentials have been truncated.");
return (-1);
}
- credentials[sizeof (credentials) - 1] = '\0';
curl_easy_setopt (curl, CURLOPT_USERPWD, credentials);
}
curl_easy_setopt (curl, CURLOPT_URL, url);
+ if ((verify_peer == NULL) || (strcmp (verify_peer, "true") == 0))
+ curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 1);
+ else
+ curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 0);
+
+ if ((verify_host == NULL) || (strcmp (verify_host, "true") == 0))
+ curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 2);
+ else
+ curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 0);
+
if (cacert != NULL)
curl_easy_setopt (curl, CURLOPT_CAINFO, cacert);