From: Florian Forster Date: Sun, 20 Apr 2008 08:19:40 +0000 (+0200) Subject: teamspeak2 plugin: Collect `servers' and `channels', too. X-Git-Tag: collectd-4.4.0~32 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=f68d0cd83afd68aeb829c1ff45809571fa34a7d2;p=collectd.git teamspeak2 plugin: Collect `servers' and `channels', too. --- diff --git a/src/teamspeak2.c b/src/teamspeak2.c index aa10742c..3bad6b0e 100644 --- a/src/teamspeak2.c +++ b/src/teamspeak2.c @@ -500,6 +500,8 @@ static int tss2_read_vserver (vserver_list_t *vserver) int status; gauge_t users = NAN; + gauge_t channels = NAN; + gauge_t servers = NAN; counter_t rx_octets = 0; counter_t tx_octets = 0; counter_t rx_packets = 0; @@ -602,6 +604,8 @@ static int tss2_read_vserver (vserver_list_t *vserver) value++; /* Check for known key and save the given value */ + /* global info: users_online, + * server info: currentusers. */ if ((strcmp ("currentusers", key) == 0) || (strcmp ("users_online", key) == 0)) { @@ -609,6 +613,22 @@ static int tss2_read_vserver (vserver_list_t *vserver) if (value != endptr) valid |= 0x01; } + /* global info: channels, + * server info: currentchannels. */ + else if ((strcmp ("currentchannels", key) == 0) + || (strcmp ("channels", key) == 0)) + { + channels = strtod (value, &endptr); + if (value != endptr) + valid |= 0x40; + } + /* global only */ + else if (strcmp ("servers", key) == 0) + { + servers = strtod (value, &endptr); + if (value != endptr) + valid |= 0x80; + } else if (strcmp ("bytesreceived", key) == 0) { rx_octets = strtoll (value, &endptr, 0); @@ -690,6 +710,12 @@ static int tss2_read_vserver (vserver_list_t *vserver) if ((valid & 0x20) == 0x20) tss2_submit_gauge (plugin_instance, "percent", "packet_loss", packet_loss); + if ((valid & 0x40) == 0x40) + tss2_submit_gauge (plugin_instance, "gauge", "channels", channels); + + if ((valid & 0x80) == 0x80) + tss2_submit_gauge (plugin_instance, "gauge", "servers", servers); + if (valid == 0) return (-1); return (0);