X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fteamspeak2.c;h=2552ad305ffcaa51decb9ab490764a1cc907e4fb;hb=ba2ee9aec4c0454eed8f29b4c6ce96c6fc372346;hp=d4bf2aa40dcb1d3172fce8f6d4878f19461e296c;hpb=6d86a97190a193863aadc252f20f6b9dba61c263;p=collectd.git diff --git a/src/teamspeak2.c b/src/teamspeak2.c index d4bf2aa4..2552ad30 100644 --- a/src/teamspeak2.c +++ b/src/teamspeak2.c @@ -25,8 +25,8 @@ #include "common.h" #include "plugin.h" -#include #include +#include #include #include #include @@ -146,7 +146,7 @@ static void tss2_submit_gauge (const char *plugin_instance, } /* void tss2_submit_gauge */ static void tss2_submit_io (const char *plugin_instance, const char *type, - counter_t rx, counter_t tx) + derive_t rx, derive_t tx) { /* * Submits the io rx/tx tuple to the collectd daemon @@ -154,8 +154,8 @@ static void tss2_submit_io (const char *plugin_instance, const char *type, value_t values[2]; value_list_t vl = VALUE_LIST_INIT; - values[0].counter = rx; - values[1].counter = tx; + values[0].derive = rx; + values[1].derive = tx; vl.values = values; vl.values_len = 2; @@ -299,6 +299,13 @@ static int tss2_get_socket (FILE **ret_read_fh, FILE **ret_write_fh) char *buffer_ptr; buffer_ptr = fgets (buffer, sizeof (buffer), global_read_fh); + if (buffer_ptr == NULL) + { + WARNING ("teamspeak2 plugin: Unexpected EOF received " + "from remote host %s:%s.", + config_host ? config_host : DEFAULT_HOST, + config_port ? config_port : DEFAULT_PORT); + } buffer[sizeof (buffer) - 1] = 0; if (memcmp ("[TS]\r\n", buffer, 6) != 0) @@ -498,10 +505,10 @@ static int tss2_read_vserver (vserver_list_t *vserver) 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; - counter_t tx_packets = 0; + derive_t rx_octets = 0; + derive_t tx_octets = 0; + derive_t rx_packets = 0; + derive_t tx_packets = 0; gauge_t packet_loss = NAN; int valid = 0;